Author Topic: Quick question from VL novice on VLA objects  (Read 1651 times)

0 Members and 1 Guest are viewing this topic.

qwrtz

  • Guest
Quick question from VL novice on VLA objects
« on: April 01, 2008, 12:51:07 PM »
When I do this:
Code: [Select]
(defun c:test ()
(vl-load-com)
(setq acadobject (vlax-get-Acad-Object))
(setq activedocument (vla-get-activedocument acadobject))
(setq DStyle (vlax-get-property activedocument 'ActiveDimStyle))
(list DStyle)
)
VL gives me this:
Code: [Select]
(#<VLA-OBJECT IAcadDimStyle 057be680>)Which is obviously not what I want.
And, ironically, VL doesn't want it either, when I try to give it back in this form:
Code: [Select]
(vlax-put-property (vlax-ename->vla-object Ent1) 'Stylename DStyle)What else do I need to get the name of the active DimStyle?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Quick question from VL novice on VLA objects
« Reply #1 on: April 01, 2008, 12:58:47 PM »
I'm assuming that you want to change a dimension object to the current dimension style.  If that is the case, then just change the name of the object's dimension style.  So you would code it like
Code: [Select]
(vla-put-StyleName (vlax-ename->vla-object Ent1) (getvar 'DimStyle))
Or the way you are going
Code: [Select]
(vlax-put-property (vlax-ename->vla-object Ent1) 'StyleName (vla-get-Name DStyle))
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

qwrtz

  • Guest
Re: Quick question from VL novice on VLA objects
« Reply #2 on: April 01, 2008, 01:13:30 PM »
Thanks, Tim. I should have thought of getvar, but I'm addled by trying to figure out all these vl-long-hyphenated-function-Names and how to use what they do.

(vla-get-Name) is what I was looking for. I'm sure it will be useful in many other cases. I have to remember to look for (vla-) ActiveX add-on stuff when I can't find what I want in the AutoLisp reference.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Quick question from VL novice on VLA objects
« Reply #3 on: April 01, 2008, 01:23:12 PM »
You're welcome.

Here are some functions that will be helpful for you.

This one will print to screen all the properties and methods of a selected object.
Code: [Select]
(defun c:dlist (/ ob1)
    (setq ob1 (car (entsel "Select entity:  ")))
    (setq ob2 (vlax-ename->vla-object ob1))
    (textpage)
    (vlax-dump-object ob2 t)
    (princ)
)

This one will work on nested objects
Code: [Select]
(defun c:dlist2 (/ ob1)
    (setq ob1 (car (nentsel "Select entity:  ")))
    (setq ob2 (vlax-ename->vla-object ob1))
    (textpage)
    (vlax-dump-object ob2 t)
    (princ)
)

And this one will work on any vla-object as the argument.
Code: [Select]
(defun Dump (VlaObject)
(vlax-dump-object VlaObject t)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.