AutoCAD 2002 Bible

Скачать в pdf «AutoCAD 2002 Bible»


)


After entering and loading this function, type the following at the Console to change the start point of the line to 15,-5,0.


(Put-Group-10-Code LineEntity ‘( 15 -5 0 )) J


Activate AutoCAD to check that the line has been changed.

Using ActiveX with Visual LISP


You have just seen how to retrieve and modify object information by writing small get and put interface functions using AutoLISP. ActiveX provides a similar way to retrieve and modify objects but it requires some preparation. In the following section, you learn about using some ActiveX functions to create, retrieve, and modify an object.

Retrieving and modifying object information with ActiveX


Visual LIsP enables you to retrieve and modify any AutoCAD object using AutoCAD’s ActiveX interface. That is to say, AutoCAD exposes all of its objects to ActiveX-enabled applications. This includes Visual LISP as ActiveX objects, all of which expose their properties, including put (modify) and get (retrieve) functions.


Using Visual LISP to communicate with AutoCAD 2002 is very straightforward. You must first load all of the ActiveX functions using the vl-load-com function within Visual LISP. This exposes all of the ActiveX interface functions. You need to load the vl-load-com function only once each time you open AutoCAD because vl-load-com loads the ActiveX functions for the entire drawing session. (Using vl-load-com more than once, however, doesn’t cause any harm.)


(vl-load-com) J


once the ActiveX interface is loaded, you can interrogate the line you created previously, but first you need to convert the entity name into a vla-object. A vla-object is no different from an entity name, except that the ActiveX object exposes certain properties that its AutoLISP counterpart does not. To convert the entity name into a vla-object, you use the function vlax-ENAME->vla-object, as demonstrated here:

Скачать в pdf «AutoCAD 2002 Bible»