TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Shady_Shiba on November 09, 2017, 09:32:42 AM
-
Grettings,
I wanted to be able to set an attribute from the block's dynamic property table by selecting the "sort" Value in the block, but I get an error code in return.
Im starting to think if it's the dynamic block itself. I've attached both lisp and dwg files if it is either of them or both. :idea:
(defun c:reg (/ ent)
(setq ent (car (entsel)))
(LM:setdynpropvalue ent "SORT" "04")
(princ)
)
;;-----------------------------------------------------------------------------------------------
;; 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)
)
)
-
You are passing an ename to Lee's function, when it wants a VLA object. Look into the vlax-ename->vla-object function.
-
that was exactly what I needed! :uglystupid2:
thank you kind sir
-
You are very welcome. :-)