How to return value in vlax

Discussion in 'AutoCAD' started by Adesu, Mar 29, 2005.

  1. Adesu

    Adesu Guest

    _$ (vl-load-com)
    (setq es (car (entsel)))
    (setq veo (vlax-ename->vla-object es))
    <Entity name: 147fd80>
    #<VLA-OBJECT IAcadCircle 01aaf054>
    _$ (vlax-dump-object veo)
    ; IAcadCircle: AutoCAD Circle Interface
    ; Property values:
    ; Application (RO) = #<VLA-OBJECT IAcadApplication 00ac8928>
    ; Area = 6.9174
    ; Center = (9.28304 8.46762 0.0)
    ; Circumference = 9.32345
    ; Color = 256
    ; Diameter = 2.96775
    ; Document (RO) = #<VLA-OBJECT IAcadDocument 00eaab94>
    ; Handle (RO) = "48"
    ; HasExtensionDictionary (RO) = 0
    ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 01aaf1a4>
    ; Layer = "0"
    ; Linetype = "ByLayer"
    ; LinetypeScale = 1.0
    ; Lineweight = -1
    ; Normal = (0.0 0.0 1.0)
    ; ObjectID (RO) = 21495168
    ; ObjectName (RO) = "AcDbCircle"
    ; OwnerID (RO) = 21495032
    ; PlotStyleName = "ByLayer"
    ; Radius = 1.48387
    ; Thickness = 0.0
    ; Visible = -1
    T
    _$ (setq dia (vlax-get-property veo 'diameter))
    2.96775
    _$ (setq are (vlax-get-property veo 'area))
    6.9174
    _$ (setq rad (vlax-get-property veo 'radius))
    1.48387
    _$ (setq ctr (vlax-get-property veo 'center))
    #<variant 8197 ...>
    _$

    How to return value "#<variant 8197...> to become "(9.28304 8.46762
    0.0)",and why it display like that,can you explain to me ,thanks.
     
    Adesu, Mar 29, 2005
    #1
  2. Adesu

    Jürg Menzi Guest

    Hi Ade

    Use 'vlax-get'... This function returns a list not a variant:
    _$ (setq ctr (vlax-get veo 'Center))
    _$ (235.0 150.0 0.0)

    Otherwise you've to translate the variant to a list:
    (vlax-safearray->list
    (vlax-variant-value
    (vla-get-Center veo)
    )
    )

    Cheers
     
    Jürg Menzi, Mar 29, 2005
    #2
  3. Adesu

    Adesu Guest

    Hi Jürg,thanks for your reply,that your info very useful for me ,and you
    gave me alternative choose
    thanks a lot.
     
    Adesu, Mar 29, 2005
    #3
  4. Adesu

    Jürg Menzi Guest

    Welcome...¦-)

    Cheers
     
    Jürg Menzi, Mar 29, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.