try reading this :
http://www.jefferypsanders.com/autolispintr_dxf.html
and take note of group Code 10 and 11
Registered forum members do not see this ad.
I want to extract values from objects such as a line, and use them as variables in Autolisp.
For instance, say I draw a line:It will draw a line 5000 units long from the origin at an angle of 37°, to an unknown point.Code:(command "line" "0,0" "@5000<37" "")
If I inspect the properties of this line, I can find that end point END X = 4000 and END Y = 3000.
Is there a way to extract these values through lisp and assign them to a variable?
eg.Conversely I also want to be able to draw a line from absolute coords point1 to point2 and get the delta x and y values, as well as the length and angle.Code:(setq endx1 ("end x value")) (setq endy1 ("end y value"))
Last edited by bpdav1; 15th Aug 2012 at 11:33 pm.


try reading this :
http://www.jefferypsanders.com/autolispintr_dxf.html
and take note of group Code 10 and 11
"Memories fade but the scars still linger...."
This ... ?
Code:(command "_.line" "0,0" "@5000<37" "") (if (setq e (entlast)) (progn (setq elist (entget e)) (setq end (cdr (assoc 11 elist))) (setq x_end (car end)) (setq y_end (cadr end)) ) )
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
Since you know both starting point and the polar displacement, you can calculate the target point, don't need to list it from entity:
I believe you already had this information on your other thread.Code:(setq pointTemp (polar '(0 0) (* (/ 37.0 180.0) pi) 5000.0) endX (car pointTemp) endY (cadr pointTemp))
Also, please edit your post and add the code tags. Thank you.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
This is much better and to guarantee that the last object is created and line entity .
Code:(if (setq e (entmakex (list '(0 . "LINE") '(10 0. 0. 0.) (cons 11 (polar '(0. 0. 0.) (* (/ 37.0 180.0) pi) 5000.0)) ) ) ) (progn (setq elist (entget e)) (setq end (cdr (assoc 11 elist))) (setq x_end (car end)) (setq y_end (cadr end)) ) )
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
bpdav1,
Please read the CODE POSTING GUIDELINES and edit your posts (in this thread and some previous threads) to include code tags.
“A narrow mind and a fat head invariably come on the same person” Zig Zigler
![]()
Sorry Tharwat, but that is totally counter-productive. Why add the entity and interrogate it later when you have access to all his features at design time?!?
Even if OP was looking for such work-around, I believe that a better approach is to advice him/her to use an effective solution.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Bookmarks