 |
|
| Computers Forum Index » Computer - Autocad » known SY... |
|
Page 1 of 2 Goto page 1, 2 Next |
|
| Author |
Message |
| John Callaway... |
Posted: Sat Sep 05, 2009 2:28 am |
|
|
|
Guest
|
Is there a lisp routine available to draw either a circle or rectangle
with a known square yard area?
JPC |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Sun Sep 06, 2009 12:19 am |
|
|
|
Guest
|
On Sep 4, 11:28 pm, John Callaway <jca... at (no spam) erols.com> wrote:
Quote: Is there a lisp routine available to draw either a circle or rectangle
with a known square yard area?
JPC
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? |
|
|
| Back to top |
|
|
|
| John Callaway... |
Posted: Sun Sep 06, 2009 5:24 pm |
|
|
|
Guest
|
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
On Sat, 5 Sep 2009 17:19:10 -0700 (PDT), strawberry
<zac.carey at (no spam) gmail.com> wrote:
Quote: On Sep 4, 11:28 pm, John Callaway <jca... at (no spam) erols.com> wrote:
Is there a lisp routine available to draw either a circle or rectangle
with a known square yard area?
JPC
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? |
|
|
| Back to top |
|
|
|
| Tom Berger... |
Posted: Sun Sep 06, 2009 8:31 pm |
|
|
|
Guest
|
Am Fri, 04 Sep 2009 18:28:35 -0400 schrieb John Callaway:
Quote: 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
Quote: expression: at (no spam) +[sqrt(123),sqrt(123)]
In this expression ' at (no spam) ' 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
Quote: expression: at (no spam) +[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 |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Sun Sep 06, 2009 10:08 pm |
|
|
|
Guest
|
On Sep 6, 2:24 pm, John Callaway <jca... at (no spam) erols.com> wrote:
Quote: 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. |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Mon Sep 07, 2009 1:47 pm |
|
|
|
Guest
|
On Sep 7, 1:03 pm, John Callaway <jca... at (no spam) erols.com> wrote:
Quote: On Sun, 6 Sep 2009 15:08:46 -0700 (PDT), strawberry
zac.ca... at (no spam) gmail.com> wrote:
On Sep 6, 2:24 pm, John Callaway <jca... at (no spam) 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.
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
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))
(setq pt (getpoint "Centerpoint?"))
(setq rad (sqrt (/ ar pi)))
(command "circle" pt rad)
(princ)
) |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Mon Sep 07, 2009 1:56 pm |
|
|
|
Guest
|
On Sep 7, 2:47 pm, strawberry <zac.ca... at (no spam) gmail.com> wrote:
Quote: On Sep 7, 1:03 pm, John Callaway <jca... at (no spam) erols.com> wrote:
On Sun, 6 Sep 2009 15:08:46 -0700 (PDT), strawberry
zac.ca... at (no spam) gmail.com> wrote:
On Sep 6, 2:24 pm, John Callaway <jca... at (no spam) 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.
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
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))
(setq pt (getpoint "Centerpoint?"))
(setq rad (sqrt (/ ar pi)))
(command "circle" pt rad)
(princ)
)
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!  |
|
|
| Back to top |
|
|
|
| John Callaway... |
Posted: Mon Sep 07, 2009 4:03 pm |
|
|
|
Guest
|
On Sun, 6 Sep 2009 15:08:46 -0700 (PDT), strawberry
<zac.carey at (no spam) gmail.com> wrote:
Quote: On Sep 6, 2:24 pm, John Callaway <jca... at (no spam) 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.
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 |
|
|
| Back to top |
|
|
|
| Tom Berger... |
Posted: Mon Sep 07, 2009 7:46 pm |
|
|
|
Guest
|
Am Sun, 6 Sep 2009 15:08:46 -0700 (PDT) schrieb strawberry:
Quote: 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.
--
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 |
|
|
| Back to top |
|
|
|
| John Callaway... |
Posted: Tue Sep 08, 2009 3:03 am |
|
|
|
Guest
|
Quote:
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))
(setq pt (getpoint "Centerpoint?"))
(setq rad (sqrt (/ ar pi)))
(command "circle" pt rad)
(princ)
)
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!
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 |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Tue Sep 08, 2009 1:21 pm |
|
|
|
Guest
|
On Sep 8, 12:03 am, John Callaway <jca... at (no spam) erols.com> wrote:
Quote: 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))
(setq pt (getpoint "Centerpoint?"))
(setq rad (sqrt (/ ar pi)))
(command "circle" pt rad)
(princ)
)
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! :-)
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
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 |
|
|
| Back to top |
|
|
|
| John Callaway... |
Posted: Wed Sep 09, 2009 2:41 am |
|
|
|
Guest
|
Quote:
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 |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Wed Sep 09, 2009 7:19 am |
|
|
|
Guest
|
Quote: Lengths & widths are not factors at all.
!?!
So you'd be just as happy with a square? |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Wed Sep 09, 2009 11:39 am |
|
|
|
Guest
|
On Sep 9, 8:19 am, strawberry <zac.ca... at (no spam) gmail.com> wrote:
Quote: Lengths & widths are not factors at all.
!?!
So you'd be just as happy with a square?
; ----- SQUARETEST.LSP -----
; Draw rectangles by area and one known length
(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)
) |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Wed Sep 09, 2009 11:40 am |
|
|
|
Guest
|
On Sep 9, 12:38 pm, John Callaway <jca... at (no spam) erols.com> wrote:
Quote: On Wed, 9 Sep 2009 00:19:58 -0700 (PDT), strawberry
zac.ca... at (no spam) 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)
) |
|
|
| Back to top |
|
|
|
|
|
All times are GMT
The time now is Mon Dec 07, 2009 1:31 pm
|
|