PDA

View Full Version : Trying to retrieve and use X value of a point


ReachAndre
2006-11-03, 05:28 PM
Hey everyone,
I am trying to retrieve the X value of a and angled line
X-VALUE-OF-36<45 is what I am trying to retrieve.
Example:
(defun c:xtst ()
(setq pt0 (list 0 0)
(command "line" pt0 "@36<45" "")
(command "line" "X-VALUE-OF-36<45,0" "48,0")
(princ))

Hope this description is usefual and accurate.
Thanks all in advance,
Dolt

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]

rkmcswain
2006-11-03, 06:19 PM
(car (polar (list 0 0 0) (* pi 0.25) 36.0))



(car) returns the first element (X value in this case)
(polar) returns a point defined by the arguments.

First argument is the start point (0,0,0 in your case)
Second argument is the angle (expressed in radians)
Third argument is the distance


In other words, you don't actually have to draw then line and then query the endpoint.

If you already HAVE a line, then just query the endpoint and use the (car) function to get the X value.

On the other hand, if you are DRAWING lines, you can use (polar) to find the endpoint and then use (vla-addLine) or (entmake) and avoid pushing this task through the command prompt.

Adesu
2006-11-08, 07:13 AM
Hi ReachAndre,
maybe you are looking for a code like this below.

(defun c:xtst (/ pt0 el sse ep)
(setq pt0 (list 0 0))
(command "line" pt0 "@36<45" "")
(setq el (entlast))
(setq sse (entget el))
(setq ep (cdr (assoc 11 sse)))
;(command "line" "X-VALUE-OF-36<45,0" "48,0")
(command "line" ep "48,0" "")
(princ)
)


Hey everyone,
I am trying to retrieve the X value of a and angled line
X-VALUE-OF-36<45 is what I am trying to retrieve.
Example:
(defun c:xtst ()
(setq pt0 (list 0 0)
(command "line" pt0 "@36<45" "")
(command "line" "X-VALUE-OF-36<45,0" "48,0")
(princ))

Hope this description is usefual and accurate.
Thanks all in advance,
Dolt

[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]