本帖最后由 菜卷鱼 于 2014-11-17 08:41 编辑
我的也是东拼西凑整合的
- (defun DynamicValueCtrl (ent mark rusult / BlockRef plist i a b c Property )
- (setq BlockRef (vlax-ename->vla-object ent))
- (setq plist (vlax-invoke BlockRef 'GetDynamicBlockProperties))
- (setq i 0)
- (mapcar '(lambda (X)
- (setq a (vlax-get X 'PropertyName)
- ;;;;;; b (vlax-get X 'Value)
- c (vlax-variant-type(vla-get-value x)) )
- (if (= a mark) ;;;属性标记
- (progn
- (setq Property
- (vlax-safearray-get-element
- (vlax-variant-value (vla-GetDynamicBlockProperties blockref)) i))
- (vla-put-value
- Property
- (vlax-make-variant
- rusult ;;;修改的值
- c
- )
- )
- ))
- (setq i(1+ i))
- )
- plist
- )
- (prin1)
- )
- ;;;;;举例
- (defun c:dted ( )
- (setq a(car (entsel)))
- (setq b(getreal "\n输入属性值:"))
- (DynamicValueCtrl a "翻转状态" b)
- (prin1))
|