There are a number of ways to refer to AutoCAD drawing objects with AutoLISP.
Note: ActiveX support in AutoLISP is limited to Windows only.
These include the following:
- VLA-objects, returned by ActiveX functions
- Entity names (enames), returned by entget and entsel, identifying objects in an open drawing
- Handles, returned by handent, which entities retain across AutoCAD sessions
- Object IDs, used by ActiveX, ObjectARX, and Managed .NET programs to identify objects
Note: ObjectARX and Managed .NET programs are not supported by AutoCAD LT.
AutoLISP provides functions to convert from one type of object identifier to another.
You may find the same drawing object represented by different identifiers and data types such as a handle string, an ename, a VLA-object, or an object ID integer. To obtain the identifier with the data type your program requires, use the following strategies:
- To find the handle associated with an ename, use the DXF 5 group of the ename's association list:
(setq handle-circle (cdr (assoc 5 (entget ename-circle)))) "4F"
- To find the ename associated with a handle, use the
handent function:
(handent handle-circle) <Entity name: 27f0538>
- To find the VLA-object associated with a handle, use the
vla-handleToObject function:
(setq vla-circle (vla-handleToObject acadDocument handle-circle)) #<VLA-OBJECT IAcadCircle 03642c24>
- To find the handle associated with a VLA-object, use
vla-get-handle to obtain the
Handle property:
(vla-get-handle vla-circle) "4F"
- To find the object ID of a VLA-object, use
vla-get-objectid to get the
objectID property:
(setq objid-Circle (vla-get-objectid vla-circle)) 41878840
- To find the VLA-object identified by an object ID, use the
ObjectID-toObject method on the AutoCAD Document object:
(vla-ObjectIDtoObject acadDocument objid-circle) #<VLA-OBJECT IAcadCircle 03642c24>