Listing an Object's Properties and Methods
 
 
 

Earlier in this chapter, you learned how to use the VLISP Inspect tool to display an object's properties. Another way to view an object's properties is to call the vlax-dump-object function. You can invoke this function from the VLISP Console window or from an application program. The vlax-dump-object function prints a list of the properties of the specified object and returns T. For example, the following code obtains the last object added to the model space, then issues vlax-dumpObject to print the object's properties:

_$ (setq WhatsMyLine
(vla-item mSpace (- (vla-get-count mspace) 1)))
#<VLA-OBJECT IAcadLWPolyline 036f1d0c>
_$ (vlax-dump-object
WhatsMyLine)
; IAcadLWPolyline: AutoCAD Lightweight Polyline Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00a4ae24>
;   Area (RO) = 2.46556
;   Closed = 0
;   Color = 256
;   ConstantWidth = 0.0
;   Coordinate = ...Indexed contents not shown...
;   Coordinates = (8.49917 7.00155 11.2996 3.73137 14.8 5.74379 ... )
;   Database (RO) = #<VLA-OBJECT IAcadDatabase 01e3da44>
;   Elevation = 0.0
;   Handle (RO) = "53"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 01e3d7d4>
;   Layer = "0"
;   Linetype = "BYLAYER"
;   LinetypeGeneration = 0
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 28895576
;   ObjectName (RO) = "AcDbPolyline"
;   PlotStyleName = "ByLayer"
;   Thickness = 0.0
;   Visible = -1
T

There is an optional second argument you can supply to vlax-dump-object that causes it to also list all the methods that apply to the object. Simply specify “T” following the object name:

(vlax-dump-object WhatsMyLine T)

Note that vlax-dump-object displays the information in the window from which you issued the command. However, the function returns T to the calling program, not the information displayed in the Command window.