Author Topic: Vlax-get-property  (Read 9942 times)

0 Members and 1 Guest are viewing this topic.

ImaJayhawk

  • Guest
Vlax-get-property
« on: August 30, 2004, 04:49:24 PM »
I'm tryinng to get the size of ductwork by lisp.  So I

Code: [Select]

(setq e (car (entsel)))
(setq vlaobj (vlax-ename->vla-object e))
(vlax-get-property vlaobj '??????)


Is there any way to get a list of the parameters for this object other than trial and error?
Thanks.

--ImaJayhawk
ABS 3.3

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Vlax-get-property
« Reply #1 on: August 30, 2004, 04:58:51 PM »
Take a look at vlax-dump-object
TheSwamp.org  (serving the CAD community since 2003)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Vlax-get-property
« Reply #2 on: August 30, 2004, 05:11:05 PM »
Mark's right, vlax-dump-object (see the help) is invaluable.

At the risk of being self serving, if you're used to dxf codes this tool[/b] might be useful, it shows you the vlax-dump-object info, as well as the dxf codes, making it easy to compare the two representations of the data:

Code: [Select]
; IAcadPoint: AutoCAD Point Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00af9594>
;   Coordinates = (22.5004 7.7156 0.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 01038600>
;   Handle (RO) = "89"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 03090e54>
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 2130005640
;   ObjectName (RO) = "AcDbPoint"
;   OwnerID (RO) = 2130005240
;   PlotStyleName = "ByLayer"
;   Thickness = 0.0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 03093bd0>
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()
; DXF Group Codes:
;   (-1 . <Entity name: 7ef54e88>)
;   (0 . "POINT")
;   (330 . <Entity name: 7ef54cf8>)
;   (5 . "89")
;   (100 . "AcDbEntity")
;   (67 . 0)
;   (410 . "Model")
;   (8 . "0")
;   (100 . "AcDbPoint")
;   (10 22.5004 7.7156 0.0)
;   (210 0.0 0.0 1.0)
;   (50 . 0.0)

Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ImaJayhawk

  • Guest
Vlax-get-property
« Reply #3 on: August 30, 2004, 05:24:13 PM »
Thanks that's what I needed.


--ImaJayhawk

daron

  • Guest
Vlax-get-property
« Reply #4 on: August 31, 2004, 08:28:30 AM »
Remeber, you could also use (vla-get-propertyname vla-object) as well. Same with (vla-put-propertyname vla-object value)

ImaJayhawk

  • Guest
Vlax-get-property
« Reply #5 on: August 31, 2004, 08:55:22 AM »
What's the advantage in using (vla-get-propertyname vla-object) ?


--ImaJayhawk

daron

  • Guest
Vlax-get-property
« Reply #6 on: August 31, 2004, 08:59:41 AM »
Shorter? Probably nothing, just an easier way to read it, because you know the property name right away. It doesn't matter, either way. I was just throwing out another way to skin that cat.

sinc

  • Guest
Vlax-get-property
« Reply #7 on: August 31, 2004, 09:06:53 PM »
The (vla-get-propertyName vla-object) form is a binding that is resolved during compilation, while the (vlax-get-property vlaobj 'propertyName) form is a binding that is resolved at runtime.  The first version runs faster, but the difference in speed is frequently not noticeable.

The first form requires you to register a type library describing the ActiveX interface for your target object model with the VLisp environment before you can use it.  The default Autocad object model is registered automatically.  If you use vertical products (such as Land Desktop, etc.) or want to communicate with any external programs (such as Excel), you need to register the type library for that particular program explicitly as detailed here.
This form has the advantages that it runs faster, it requires less typing, syntax-highlighting will work, and you will get a compiler error if you attempt to access an invalid property.

If you don't have the type library, or don't want to load it for some reason, you can use the second form (the vlax-get-property vlaobj 'propertyName one).  The reference to the property will then be resolved while the program is running, which slows execution.  Also, if you misspell a property name or try to access an invalid property, your code will compile fine, but you'll get a runtime error.

SMadsen

  • Guest
Vlax-get-property
« Reply #8 on: September 01, 2004, 04:49:13 AM »
Very good info and nicely explained. Thanks, Richard.