- (defun c:tt()
- (SETQ E (CAR (ENTSEL))
- BLK (vlax-ename->vla-object E)
- )
- (princ(LM:getdynpropvalue blk "标注"))
- (LM:setdynpropvalue blk "标注" 2000 )
- )
- ;; Get Dynamic Block Property Value - Lee Mac
- ;; Returns the value of a Dynamic Block property (if present)
- ;; blk - [vla] VLA Dynamic Block Reference object
- ;; prp - [str] Dynamic Block property name (case-insensitive)
- (defun LM:getdynpropvalue ( blk prp )
- (setq prp (strcase prp))
- (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value)))
- (vlax-invoke blk 'getdynamicblockproperties)
- )
- )
- ;; 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
- ;; 设置动态块特性值-Lee Mac
- ;; 修改动态块特性的值(如果存在)
- ;; blk-[vla]vla动态块引用对象
- ;; prp-[str]动态块属性名称(不区分大小写)
- ;; val-[any]属性的新值
- ;; 返回:[any]如果成功,则返回新值,否则返回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)
- )
- )
可以去找找leemac的函数
注意:vba和lisp只能是获取改变已经有的参数,无法创建新的。想要创建动态块需要net和arx |