Vertex
Coordinates
You try to obtain the vertex coordinates of a 3D polyline using the
following AutoLISP expression.
(entget (car (entsel)))
However, this expression only returns basic information about the 3D
polyline; it does not return the vertex coordinates, which are stored as
a sub-entity of the 3D polyline.
Copy and paste the following coding into Notepad and save it as
"ListVertex.lsp."
To run the routine, type ListVertex on the command line and press ENTER.
;Start of AutoLisp Coding
(defun c:ListVertex ( / ename n elist )
(setq ename (entsel))
(setq n 0)
(setq elist (entget (car ename)))
(setq ename (cdr (assoc -1 elist)))
(while (/= (cdr (assoc 0 elist)) "SEQEND")
(progn
(setq elist (entget (setq ename
(entnext ename))))
(if (assoc 10 elist)
(progn
(princ "\n ****** Vertex number ")
(princ n)
(princ "\n X = ")
(princ (cadr (assoc 10 elist)))
(princ " Y = ")
(princ (caddr (assoc 10 elist)))
(princ " Z = ")
(princ (cadddr (assoc 10 elist)))
(setq n (+ 1 n))
);progn
);if
);progn
);while
(princ)
);defun
(princ)
;End AutoLisp Coding |
A list of all loaded ARX
applications will be created. If the geom3d.arx file is not listed, it
will be loaded, and a 3D cylinder will be created and rotated.