Share
 
 

About Determining Whether an Object is Available for Update (AutoLISP/ActiveX)

If other applications are working with any AutoCAD objects at the same time as your program, those objects might not be accessible. This is especially important to look out for if your application includes reactors, because reactors execute code segments in response to external events that cannot be predicted in advance.

Note: ActiveX support in AutoLISP is limited to Windows only.

AutoLISP provides the following functions to test the accessibility of an object before trying to use the object:

  • vlax-read-enabled-p tests whether you can read an object.
  • vlax-write-enabled-p determines whether you can modify an object's properties.
  • vlax-erased-p checks to see if an object has been erased. Erased objects may still exist in the drawing database.

These functions return T if true, nil if false. The following examples test a line object:

Determine whether the line is readable:

(vlax-read-enabled-p WhatsMyLine)
T

Determine whether the line is modifiable:

(vlax-write-enabled-p WhatsMyLine)
T

Determine if the line has been erased:

(vlax-erased-p WhatsMyLine)
nil

Erase the object assigned WhatsMyLine:

(vla-delete WhatsMyLine)
nil

Check to see if WhatsMyLine is still readable:

(vlax-read-enabled-p WhatsMyLine)
nil

Confirm the object was deleted:

(vlax-erased-p WhatsMyLine)
T

Was this information helpful?