PDA

View Full Version : Lisp for rectangle



RRS1987
2011-10-18, 09:27 AM
Dear All,
I need Lisp to draw rectangle. I want to give only 4 inputs to draw rectangle as per attached file.
These are the inputs following,
1) P1 Center point of one side.
2) P2 Center point of another side.
3) P3 Opposing width of rectangle.
4) P4 Offset width from reference line to sides(P1&P2).
I am waiting for your assistance.
Please refer the attached file.

Thanks in advance

Tharwat
2011-10-18, 09:52 AM
What was your opinion for this post .???? :?:

http://forums.augi.com/showthread.php?t=133903

devitg.89838
2011-10-24, 02:58 AM
a crude way



(setq osmode (getvar 'osmode))
(setvar 'osmode 0)
(setq orthomode (getvar 'orthomode))
(setvar 'orthomode 1)


(setq p1 (getpoint "select the point1"))

(setq p2 (getpoint p1 "select the other point"))

(setq p3 (getdist "select the distance "))

(setq p4 (getdist p2 "select the offset"))


(setq q1 (polar p1 (/ pi 2) p4))

(setq p1-p2 (distance p1 p2))

(setq q2 (polar q1 ( * pi 1.5) (+ p4 p4 p1-p2 )))

(setq q1-q2 (distance q1 q2))

(setq a1 (polar q2 pi (/ p3 2)))
(setq a2 (polar a1 (/ pi 2) q1-q2))
(setq a3 (polar a2 0 p3))
(setq a4 (polar a1 0 p3))

(command "_pline" a1 a2 a3 a4 "C")