数字奇数改红色,偶数改绿色
数字奇数改红色,偶数改绿色;; Set Attribute Values-Lee Mac 修改增强属性块属性
;; Sets attributes with tags found in the association list to their associated values.
;; blk - VLA Block Reference Object
;; 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 Block Reference Object
;; Returns: 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" . "")))
坐标系列表
(VL-LOAD-COM)
(setq AcadObject (vlax-get-acad-object)
AcadDocument (vla-get-ActiveDocument Acadobject)
UCSColl (vla-get-UserCoordinateSystems AcadDocument)
)
;(Setq LayerName (Vlax-Get UCSColl 'Name))
(setq blockNameLst nil)
(vlax-for block UCSColl
(setq blockName (Vlax-Get block 'Name ))
(setq blockNameLst (append blockNameLst (list blockName)))
)
谢谢楼主分享
页:
[1]