 |
|
| Computers Forum Index » Computer - Autocad » known SY... |
|
Page 2 of 2 Goto page Previous 1, 2 |
|
| Author |
Message |
| strawberry... |
Posted: Wed Sep 09, 2009 12:03 pm |
|
|
|
Guest
|
On Sep 9, 12:40 pm, strawberry <zac.ca... at (no spam) gmail.com> wrote:
Quote: On Sep 9, 12:38 pm, John Callaway <jca... at (no spam) erols.com> wrote:
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)
)
Hm, this solution is subject to floating point errors. It will perform
oddly when drawing far from 0,0 |
|
|
| Back to top |
|
|
|
| strawberry... |
Posted: Wed Sep 09, 2009 12:05 pm |
|
|
|
Guest
|
On Sep 9, 12:40 pm, strawberry <zac.ca... at (no spam) gmail.com> wrote:
Quote: On Sep 9, 12:38 pm, John Callaway <jca... at (no spam) erols.com> wrote:
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)
)
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)) )
; 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 12:05 pm |
|
|
|
Guest
|
On Sep 9, 12:40 pm, strawberry <zac.ca... at (no spam) gmail.com> wrote:
Quote: On Sep 9, 12:38 pm, John Callaway <jca... at (no spam) erols.com> wrote:
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)
)
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)) )
; 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 |
|
|
|
| John Callaway... |
Posted: Wed Sep 09, 2009 3:38 pm |
|
|
|
Guest
|
On Wed, 9 Sep 2009 00:19:58 -0700 (PDT), strawberry
<zac.carey at (no spam) gmail.com> wrote:
Quote: 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. |
|
|
| Back to top |
|
|
|
| John Callaway... |
Posted: Thu Sep 10, 2009 2:32 am |
|
|
|
Guest
|
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 |
|
|
| Back to top |
|
|
|
|
|
All times are GMT
The time now is Tue Dec 08, 2009 11:36 pm
|
|