- ;; Set Attribute Values - Lee Mac 修改增强属性块属性
- ;; Sets attributes with tags found in the association list to their associated values.
- ;; blk - [vla] VLA Block Reference Object
- ;; lst - [lst] Association list of ((<tag> . <value>) ... )
- ;; Returns: nil
- (defun LM:vl-setattributevalues ( blk lst / itm )
- (foreach att (vlax-invoke blk 'getattributes)
- (if (setq itm (assoc (vla-get-tagstring att) lst))
- (vla-put-textstring att (cdr itm))
- )
- )
- )
- ;(vla-get-tagstring (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'getattributes) )
- ; (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'getattributes)
- ;; Get Attribute Values - Lee Mac 获取增强属性块属性
- ;; Returns an association list of attributes present in the supplied block.
- ;; blk - [vla] VLA Block Reference Object
- ;; Returns: [lst] Association list of ((<tag> . <value>) ... )
- (defun LM:vl-getattributevalues ( blk )
- (mapcar '(lambda ( att ) (cons (vla-get-tagstring att) (vla-get-textstring att))) (vlax-invoke blk 'getattributes))
- )
- (setq lst '(("ZBG-BG" . "24444.85") ("SBG-BG" . "28888.81") ("SS-ZZ" . "8883.96") ("CDBG-BG"
- . "") ("SS-CD" . "") ("CD-ZZ" . ""))
- )
- (LM:vl-setattributevalues (vlax-ename->vla-object (car (entsel))) lst )
- (assoc "ZBG-BG" '(("ZBG-BG" . "24.85") ("SBG-BG" . "28.81") ("SS-ZZ" . "3.96") ("CDBG-BG" . "") ("SS-CD" . "") ("CD-ZZ" . "")))
|