Author Topic: Dynamic Block Properties  (Read 7569 times)

0 Members and 1 Guest are viewing this topic.

Oak3s

  • Guest
Re: Dynamic Block Properties
« Reply #15 on: October 22, 2010, 07:25:14 PM »
I could have sworn I did that...thats why I asked the question.  :roll:
Thank you.

Code: [Select]
(foreach i (vlax-invoke (vlax-ename->vla-object (entlast)) 'GetDynamicBlockProperties)
(vlax-dump-object i T)
)(princ)

Okay, so here is an attempt to us entlast to change the "Width" in the block to 6
Code: [Select]
(defun c:dyn (/ ob2)
(vl-load-com)
(foreach i (vlax-invoke (vlax-ename->vla-object (entlast)) 'GetDynamicBlockProperties)
(if (= "Width" (vla-get-PropertyName i))
        (vla-put-Value i 6)
)
)
)

I am not sure that the nil for AllowedValues is causing a problem?
Code: [Select]
; IAcadDynamicBlockReferenceProperty: AutoCAD Dynamic Block Property Interface
; Property values:
;   AllowedValues (RO) = nil
;   Description (RO) = ""
;   PropertyName (RO) = "Width"
;   ReadOnly (RO) = 0
;   Show (RO) = -1
;   UnitsType (RO) = 2
;   Value = 4.0

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Dynamic Block Properties
« Reply #16 on: October 22, 2010, 07:33:58 PM »
You may just need to update it once you change the property, or regen the drawing.  I think a nil is always returned.

I tested your code on one of my dynamic blocks, and it changed the property, and it showed it right away.  And my property looked like yours.  The only thing I can guess is maybe that is the wrong property.  Try changing one of the others, or looking at the block in the block editor, and make sure that is the right one.  Besides that, I'm not sure what else to try, as I don't use dy blocks.
Tim

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

Please think about donating if this post helped you.

Oak3s

  • Guest
Re: Dynamic Block Properties
« Reply #17 on: October 22, 2010, 07:43:47 PM »
That gave me hope...so I added a . after the 6 and it worked...hmmmm...why would it work for you without it.

Code: [Select]
(defun c:dyn (/ ob2)
(vl-load-com)
(foreach i (vlax-invoke (vlax-ename->vla-object (entlast)) 'GetDynamicBlockProperties)
(if (= "Width" (vla-get-PropertyName i))
        (vla-put-Value i 6.)
)
)
)

I just tested this back and forth and that . is doing something. Any ideas?

Oak3s

  • Guest
Re: Dynamic Block Properties
« Reply #18 on: October 22, 2010, 07:48:55 PM »
For what its worth.
Code: [Select]
(defun c:dyn (/ ob2 val)
(vl-load-com)
(setq val (getreal "Width: "))
(foreach i (vlax-invoke (vlax-ename->vla-object (entlast)) 'GetDynamicBlockProperties)
(if (= "Width" (vla-get-PropertyName i))
        (vla-put-Value i val)
)
)
)
This seems to accomplish what I was trying to do. Now to get the thing to rotate...that is after I insert it.