;;;批量写入横断线高度(佳木斯市__插件定制) (defun c:tt (/ mspace objl ss) (setq ss (ssget '((0 . "INSERT") (8 . "0")))) (if ss (progn (setq mspace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))) objL (createSelectionOfObjList ss) ) (foreach x (getDateL objL) (writeDate mspace x) ) (vlax-release-object mspace) ) (prompt "未选取到对象!") ) (princ) ) ;写入数据 (defun writeDate(mspace lst / pt str) (setq str (car lst) pt (cadr lst)) (vlax-put-property (vlax-invoke-method mspace 'AddText str pt 250) 'Color 1 ) ) ;获取数据列表(插入点,数据) (defun getDateL(objL / attobjl lst pt return str strobj) (foreach x objL (setq pt (vlax-get-property x 'InsertionPoint) attObjL (vlax-invoke-method x 'GetAttributes) strObj (car (vlax-safearray->list (vlax-variant-value attObjL))) str (vlax-get-property strObj 'TextString) ) (setq lst (list str pt)) (setq return (append return (list lst))) ) return ) ;;创建框选范围的数据的对象表 ;;(createSelectionOfDateList (ssget)) (defun createSelectionOfObjList(ss / i obj objl) (setq i 0) (repeat (sslength ss) (setq obj (list (vlax-ename->vla-object (ssname ss i))) objL (append obj objL) i (1+ i) ) ) objL )