getpoint's output vs list

getpoint's output vs list

Anonymous
Not applicable
944 Views
3 Replies
Message 1 of 4

getpoint's output vs list

Anonymous
Not applicable

Hi,

 

Is getpoint's output equal to '(1.0 2.0)?

 

Here's what i'm trying to do:

 

 (setq pt3 '((- x1 pt1x) (- y1 pt1y)))
 (setq pt4 '((+ x1 pt2x) (+ y1 pt2y)))
 (command "_ellipse" pt3 pt4 axe2)

 

0 Likes
945 Views
3 Replies
Replies (3)
Message 2 of 4

marko_ribar
Advisor
Advisor

Apostrophe in lisp syntax is treated literally, so this won't work :

 (setq pt3 '((- x1 pt1x) (- y1 pt1y)))
 (setq pt4 '((+ x1 pt2x) (+ y1 pt2y)))

 

Instead you should force ACAD to evaluate expressions using (list) function :

Now if x1, pt1x, y1, pt1y, pt2x, pt2y are reals stored in those variables, this should work :

 (setq pt3 (list (- x1 pt1x) (- y1 pt1y)))
 (setq pt4 (list (+ x1 pt2x) (+ y1 pt2y)))

 

HTH., M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 3 of 4

Ranjit_Singh
Advisor
Advisor

@Anonymous wrote:

Hi,

 Is getpoint's output equal to '(1.0 2.0)?

 ..........


Call the getpoint function at AutoCAD command prompt and pick a point. You will see that it consists of x, y and z coordinates. If the elevation of resulting ellipse does not matter then ignore z co-ordinate and the ellipse will be at default elevation. As pointed out in post 2, use list instead of quote.

0 Likes
Message 4 of 4

dbroad
Mentor
Mentor

Another approach.  For mapcar, the shortest list governs the result.

(setq p1 '(1.0 2.0) ;;assumed half major axis offsets from center
      p2 (getpoint "\nPick point: ") ;;assumed center point
      )
(setq p3 (mapcar '- p2 p1)
      p4 (mapcar '+ p2 p1)
      )
(command "._ellipse" p3 p4 pause)
Architect, Registered NC, VA, SC, & GA.