@Anonymous wrote:
Ho do I extract input information for LISP from an AUTOCAD drawing. For example, I have an already drawn rectangle, when I call my LISP command, it is supposed to get the coordinates of the rectangle's vertex and do something with them.
If you really mean "vertex" in the singular, and by that you mean its starting vertex, and the plural "them" refers to its coordinates, there are several ways to get that. Given 'ent' as the entity name of the Polyline [assuming that's what it is, since that's what the Rectangle command draws]:
(cdr (assoc 10 (entget ent)))
which will give you only X and Y coordinates. The Z coordinate, if you need it, is the Polyline's Elevation, which you can get with:
(cdr (assoc 38 (entget ent)))
or
(vlax-get (vlax-ename->vla-object ent) 'Elevation)
Other ways to get the first vertex:
(vlax-curve-getStartPoint ent)
or
(vlax-curve-getPointAtParam ent 0)
which will give you XYZ coordinates.
But if you mean vertices in the plural, hmsilva's suggestion is a good way for XY coordinates only, but there are ways to get XYZ coordinates:
(vlax-get (vlax-ename->vla-object ent) 'Coordinates)
which will give you an undifferentiated list of XYZ coordinates, the first three being those of the first vertex, the next three those of the second vertex, etc. That will also work on "heavy" 2D and 3D Polylines, which hmsilva's approach won't.
And you can step through using
(vlax-curve-getPointAtParam ent ...)
with the ... replaced by 0 , 1, etc. integer parameter values [write back if you want more about how to do it that way].
Kent Cooper, AIA