The Application object is the root object for the AutoCAD object model. From the Application object, you can access any of the other objects, or the properties or methods assigned to objects.
Before you can use ActiveX functions with AutoLISP, you need to load the supporting code that enables these functions. Issue the following function call to load ActiveX support:
(vl-load-com)
vl-load-com loads ActiveX and other Visual LISP extensions to the AutoLISP language.
This function first checks if ActiveX support is already loaded; if so, the function does nothing. If ActiveX support is not already loaded,vlax-get-acad-object function to establish this connection, as in the following example:
After loading the ActiveX support functions, the first step in accessing AutoCAD objects is to establish a connection to the AutoCAD Application object. Use the(setq acadObject (vlax-get-acad-object))
vlax-get-acad-object function returns a pointer to the AutoCAD Application object. In the example above, the pointer is stored in the acadObject variable. This return value exists as a unique VLISP data type called VLA-object (VLISP ActiveX object).
Theentget to access an object and then refer to that object with an ActiveX function. The entget function returns an object of data type ename. Although you cannot use this object directly with an ActiveX function, you can convert it to a VLA-object using the vlax-ename->vla-object function. (See Converting Object References.)
When you refer to AutoCAD objects with ActiveX functions, you must specify a VLA-object type. For this reason, you cannot use