Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(USING AUTOCAD ELECTRICAL 2017)
I'm using Lee Mac's LISP function to change the value of the dynamic block. I can't seem to get this working.
;; Set Dynamic Block Property Value - Lee Mac
;; Modifies the value of a Dynamic Block property (if present)
;; blk - [vla] VLA Dynamic Block Reference object
;; prp - [str] Dynamic Block property name (case-insensitive)
;; val - [any] New value for property
;; Returns: [any] New value if successful, else nil
(defun LM:setdynpropvalue ( blk prp val )
(setq prp (strcase prp))
(vl-some
'(lambda ( x )
(if (= prp (strcase (vla-get-propertyname x)))
(progn
(vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))
(cond (val) (t))
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)
)
)
** I would love to be able to get the block by entity name (IE: do not have the user select it - the entity is already known) **
IS THIS POSSIBLE???
But just to see if I can get this working, I went ahead and used entsel to have the user select the block (ideally, I won't want the user to select anything)
I've tried to run this by using the following commands:
(setq blk (car (entsel))) (LM:setdynpropvalue (blk "Visibility1" "1 inch WC")
But I get the error:
bad argument type: VLA-OBJECT <Entity name: 4868b70>
What do I need to enter to get this function working?
Solved! Go to Solution.