- (defun DT3 ( lst pref / ss e num i)
- (if (and
- (setq ss (ssget "_X"
- '((0 . "INSERT") (66 . 1) (2 . "Title_A1_Text"))
- )
- )
- (= (length (layoutlist)) (setq i (sslength ss)))
- (setq of (if (< i 10)
- (strcat "0" (itoa i))
- (itoa i)
- )
- )
- )
- (repeat i
- (setq num (cdr (assoc 410 (entget (Setq e (ssname ss 0))))))
- (setq num (substr num (+ (vl-string-position 46 num) 2)))
- (if (< (atoi num) 10)
- (setq num (strcat "0" num))
- )
- (foreach itm (vlax-invoke (vlax-ename->vla-object e) 'Getattributes)
- (setq tg (assoc (vla-get-tagstring itm) lst))
- (vla-put-textstring itm
- (if (eq (cadr tg)"")
- (strcat "MEP" " (part " num " of " of ")")
- (cadr tg))))
- (ssdel e ss)
- )
- )
- (princ)
- )
- (defun c:mep ()(dt3 '(("DT1" "MAIN BUILDING")
- ("DT2" "GROUND FLOOR PARTIAL PLAN")
- ("DT3" "")) "MEP"))
现在,如果要将其用于其他图形,请将项目(“DT1”“MAIN BUILDING”)更改为新值。
我指的不仅仅是前缀的MEP,还有其他类似“ELE”或“PLB”的东西
例如,如果您为标记DT3键入STR,则上面的代码将输入值“MEP(part###of##)”,或者如果您键入MEP和“STR(part####of##)”。 |