Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

known SY

2 views
Skip to first unread message

John Callaway

unread,
Sep 4, 2009, 6:28:35 PM9/4/09
to
Is there a lisp routine available to draw either a circle or rectangle
with a known square yard area?

JPC

strawberry

unread,
Sep 5, 2009, 8:19:10 PM9/5/09
to
A routine like this would draw a circle at whatever size and position
specified (in your preferred working units):

; ----- CTEST.LSP -----
; Draw circles by area

(defun C:CTEST()
(setq ar (getreal "Area? "))
(setq pt (getpoint "Centerpoint?"))
(setq rad (sqrt (/ ar pi)))
(command "circle" pt rad)
(princ)
)

Rectangles are a little trickier. Do you have some way of relating the
length of the rectangle to its width?

John Callaway

unread,
Sep 6, 2009, 9:24:48 AM9/6/09
to
Strawberry,
Thanks, that is good for a circle area. I tried to set my units to 9'
(ddunits) so I can get square yards when I run your lisp, but I am
having problems. Can you guide me how to set my units to 9'?

JPC

Tom Berger

unread,
Sep 6, 2009, 12:31:22 PM9/6/09
to
Am Fri, 04 Sep 2009 18:28:35 -0400 schrieb John Callaway:

> Is there a lisp routine available to draw either a circle or rectangle
> with a known square yard area?

You can do that with Geomcal in AutoCAD or with BricsCAD with my Geomcal
compatible CADCAL application. Geomcal.arx is part of the AutoCAD
distribution, simply type 'CAL a�t the command prompt or when asked top
enter a point inside a command.

CAL (either from Geomcal or from CADCAL) let's you enter mathematical
expressions that can be used as input to commands. When your area is 123,
then you could draw a rectangle from any startpoint, and when asked for the
opposite point you could enter:
'CAL
>> expression: @+[sqrt(123),sqrt(123)]

In this expression '@' stands for the last entered point, in this case this
is the first point of your rectangle. And the rest is self explaining, as I
hope.

You can also use Lisp variables in your expressions:
(setq ar 123)
'CAL
>> expression: @+[sqrt(ar),sqrt(ar)]

If you are working with BricsCAD then you can download CADCAL from
http://www.archtools.de/cadcal.des

--
ArchTools: Architektur-Werkzeuge f�r AutoCAD (TM)
ArchDIM - Architekturbema�ung und H�henkoten
ArchAREA - Fl�chenermittlung und Raumbuch nach DIN 277
Info und Demo unter http://www.archtools.de

strawberry

unread,
Sep 6, 2009, 6:08:46 PM9/6/09
to
On Sep 6, 2:24 pm, John Callaway <jca...@erols.com> wrote:
> Strawberry,
> Thanks, that is good for a circle area. I tried to set my units to 9'
> (ddunits) so I can get square yards when I run your lisp, but I am
> having problems. Can you guide me how to set my units to 9'?
>
> JPC
>

Hi John,

Try to avoid top-posting. My provider handles it OK but it drives some
people around here absolutely bananas.

You don't really need to set your units 'to' anything. Although
AutoCAD supports conventions for inputting measurements like [ ' ] for
feet and [ " ] for inches, don't be fooled, AutoCAD really has no
interest in what your preferred units are. The issue only arises when
working with data provided by others. In your case, it seems like
you're working on a drawing drawn in 'feet'. Because there are 3 feet
in a yard just scale the drawing by 1/3rd. If the drawing's in inches
just scale it by 1/(3*12) = 1/36. When you're done using the lisp
command, just scale it back again - or at least make it very apparent
in the drawing that that's what you've done!

Also, I forgot to mention that AutoCAD's RECTANGLE command has of
course already got a feature built-in for drawing rectangles based
upon their area and a known length or width.

John Callaway

unread,
Sep 7, 2009, 8:03:23 AM9/7/09
to


Strawberry,
I posted this below your message, I didn't realize it made any
difference and do apologize. Your lisp works fine. Would it be
possible to tweak it?
2 issues
1) Could you explain further how I can insert a known area in square
yards when I use the rectang command?
2) Since I know what my area is in square yards and there are 1296 sq
inches in a square yard, could you modify the lisp you sent to prompt
for an "area SY"?

JPC


strawberry

unread,
Sep 7, 2009, 9:47:08 AM9/7/09
to

1.
; ----- RECTEST.LSP -----
; Draw rectangles by area (in square yards) and one known length (in
yards)

(defun C:RECTEST()
(setq ar (getreal "AreaSY? "))
(setq ar (* ar 1296))
(setq len (getreal "LengthY? "))
(setq len (* len 36))
(setq pt (getpoint "Cornerpoint?"))
(command "rectangle" pt "a" ar "l" len )
(princ)
)

2.
; ----- CTEST.LSP -----
; Draw circles by area (in square yards)

(defun C:CTEST()
(setq ar (getreal "AreaSY? "))
(setq ar (* ar 1296))

strawberry

unread,
Sep 7, 2009, 9:56:15 AM9/7/09
to

BTW, although I'm not the world's worst lisp programmer, I'm
definitely a contender for that prize, so feel free to have a go at
this stuff yourself! :-)

Tom Berger

unread,
Sep 7, 2009, 11:46:47 AM9/7/09
to
Am Sun, 6 Sep 2009 15:08:46 -0700 (PDT) schrieb strawberry:

>> Thanks, that is good for a circle area. I tried to set my units to 9'
>> (ddunits) so I can get square yards when I run your lisp, but I am
>> having problems. Can you guide me how to set my units to 9'?
>

> Try to avoid top-posting.

And please try to remove everything from the original posting that is not
necessary for your reply :-)

Citing parts of the posting to which you reply is only necessary for one
thing: to enable the reader of your posting to understand your reply.

John Callaway

unread,
Sep 7, 2009, 7:03:30 PM9/7/09
to


The circSY lisp works great! However I have trouble with the
rectangSY lisp. Is there a way to just have the prompt ask only for
the Square Yards? When I enter the sy it then asks for one corner then
another which then will not be the square yards I entered.
I cleaned out the rest of the thread to improve my protocol.

JPC

strawberry

unread,
Sep 8, 2009, 9:21:33 AM9/8/09
to

It works fine on my machine (XP running AutoCAD2008). Your version
must be a little different.
Run through the rectang command (using the area option - and not using
my rectest routine) and post the results here, e.g.:

Command: rec RECTANG
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/
Width]: [User clicks point on screen]
Specify other corner point or [Area/Dimensions/Rotation]: a
Enter area of rectangle in current units <129600.0000>: 100

Calculate rectangle dimensions based on [Length/Width] <Length>: l

Enter rectangle length <360.0000>: 10

John Callaway

unread,
Sep 8, 2009, 6:41:32 PM9/8/09
to

>
>It works fine on my machine (XP running AutoCAD2008). Your version
>must be a little different.
>Run through the rectang command (using the area option - and not using
>my rectest routine) and post the results here, e.g.:
>
>Command: rec RECTANG
>Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/
>Width]: [User clicks point on screen]
>Specify other corner point or [Area/Dimensions/Rotation]: a
>Enter area of rectangle in current units <129600.0000>: 100
>
>Calculate rectangle dimensions based on [Length/Width] <Length>: l
>
>Enter rectangle length <360.0000>: 10

Strawberry,
I should have stated before, I am running Version R14. There
is no area option for the second corner.

JPC

strawberry

unread,
Sep 8, 2009, 7:15:49 PM9/8/09
to

14!?!? That's from 12 years ago! Pause while I get doey-eyed and
misty. Still, it was an excellent program and, unless you plan to work
in 3d, probably the only version you'd ever need.

The lisp can still be adjusted to work. I just need to remember how to
do vector maths in lisp. It would still be useful to see what the
command 'looks' like though. Is it just "select first corner, select
second corner' or is/was there more to it than that?

Also, can you define the relationship between the length of the
rectangle and its width, or is its width, say, a constant?

John Callaway

unread,
Sep 8, 2009, 9:18:08 PM9/8/09
to

>
>14!?!? That's from 12 years ago! Pause while I get doey-eyed and
>misty. Still, it was an excellent program and, unless you plan to work
>in 3d, probably the only version you'd ever need.
>
>The lisp can still be adjusted to work. I just need to remember how to
>do vector maths in lisp. It would still be useful to see what the
>command 'looks' like though. Is it just "select first corner, select
>second corner' or is/was there more to it than that?
>
>Also, can you define the relationship between the length of the
>rectangle and its width, or is its width, say, a constant?

Strawberry,

The following is from my R14

Command: rectest
AreaSY? 1052
LengthY? 100
Cornerpoint?rectangle
Chamfer/Elevation/Fillet/Thickness/Width/<First corner>:
Other corner: a
Invalid 2D point.
error: Function cancelled
(COMMAND "rectangle" PT "a" AR "l" LEN)
(C:RECTEST)

Other corner:

The lisp creates a rectangle but I have no control over the SY
even though it first asks for Area SY input. It continues on to ask
for both corner points which essentially negates the first Area SY
input. If it only asked me for the SY area and then created the
rectangle using one corner, it would be fine.
Lengths & widths are not factors at all. All I need is to be
able to plug in a known SY quantity. I am converting existing
contracts to a different format using different unit factors. The
circle lisp has helped greatly. It would be perfect if I could also
use the rectang lisp to create a retangle with a known quantity of
square yards.


JPC

strawberry

unread,
Sep 9, 2009, 3:19:58 AM9/9/09
to
>         Lengths & widths are not  factors at all.

!?!

So you'd be just as happy with a square?

John Callaway

unread,
Sep 9, 2009, 7:38:30 AM9/9/09
to
On Wed, 9 Sep 2009 00:19:58 -0700 (PDT), strawberry
<zac....@gmail.com> wrote:

>> � � � � Lengths & widths are not �factors at all.


>
>!?!
>
>So you'd be just as happy with a square?

I never really thought about that, but yes, that is correct.

Message has been deleted

strawberry

unread,
Sep 9, 2009, 7:40:14 AM9/9/09
to
On Sep 9, 12:38 pm, John Callaway <jca...@erols.com> wrote:
> On Wed, 9 Sep 2009 00:19:58 -0700 (PDT), strawberry
>
> <zac.ca...@gmail.com> wrote:
> >>         Lengths & widths are not  factors at all.
>
> >!?!
>
> >So you'd be just as happy with a square?
>
> I never really thought about that, but yes, that is correct.

; ----- SQUARETEST.LSP -----
; Draw rectangles by area

(defun C:SQUARETEST()

; Degrees to Radians
(defun dtr (a)(* pi (/ a 180)) )

; Get area in square yards


(setq ar (getreal "AreaSY? "))

; Convert to square inches


(setq ar (* ar 1296))

; Get first point (bottom left-hand corner of square)
(setq p1 (getpoint "\nfirst corner of square: "))

; Calculate second point (top right-hand corner of square)
(setq p2 (polar p1 (dtr 45.0) (sqrt (+ ar ar))))

; Execute
(command "rectangle" p1 p2)

; Exit quietly
(princ)
)

strawberry

unread,
Sep 9, 2009, 8:03:48 AM9/9/09
to

Hm, this solution is subject to floating point errors. It will perform
oddly when drawing far from 0,0

strawberry

unread,
Sep 9, 2009, 8:05:23 AM9/9/09
to
On Sep 9, 12:40 pm, strawberry <zac.ca...@gmail.com> wrote:
I think this will perform better...
; ----- SQUARETEST.LSP -----
; Draw squares by area

(defun C:SQUARETEST()

; Degrees to Radians
(defun dtr (a)(* pi (/ a 180.0)) )

strawberry

unread,
Sep 9, 2009, 8:05:37 AM9/9/09
to
On Sep 9, 12:40 pm, strawberry <zac.ca...@gmail.com> wrote:
I think this will perform better...
; ----- SQUARETEST.LSP -----
; Draw squares by area

(defun C:SQUARETEST()

; Degrees to Radians
(defun dtr (a)(* pi (/ a 180.0)) )

John Callaway

unread,
Sep 9, 2009, 6:32:29 PM9/9/09
to
Strawberry,
That did the trick! Thanks for sticking with me on this. I
remember a guy named Dennis that used to be on this group all the
time. He helped me a lot over the years. I took several years off from
using cad and when I started using it again, I found out that Dennis
no longer was on this group. Also, I see there is less traffic on this
group than it used to be years ago. Thanks again for all your help.

Sincerely,
John P. Callaway

0 new messages