- ;属性文字<--->单行文本相互转换
- (defun c:ta (/ ss num ee nam ent)
- (prompt "\n***属性文字与单行文字相互转换---LZYCAD做部分修改***")
- (setq ss (ssget '((0 . "ATTDEF,TEXT"))))
- (if ss (progn
- (setq num (sslength ss) ee 0)
- (repeat num
- (setq nam (ssname ss ee)
- ent (entget nam)
- )
- (cond
- ((= (cdr (assoc 0 ent)) "ATTDEF")
- (att-to-tx ent)(entdel nam)
- );1
- ((= (cdr (assoc 0 ent)) "TEXT")
- (txmtx-to-att ent)(entdel nam)
- );2
- );cond
- (setq ee (1+ ee))
- );repeat
- ));if
- (princ)
- );defun
- (prompt "\n***属性文字与单行文字相互转换---LZYCAD做部分修改,启动命令ta***\n")
- ;----------------------------------------------
- ;属性文本转单行文本
- ;----------------------------------------------
- (defun att-to-tx (ent / new dolst grp addto)
- (setq new '((0 . "TEXT")))
- (setq new (append new
- (list (cons 1 (cdr (assoc 2 ent))))
- )
- )
- (setq dolst (list 7 8 10 11 39 40 41 50 51 62 71 72 73))
- (foreach grp dolst
- (setq addto (assoc grp ent))
- (if (/= addto nil)
- (setq new (append new (list (assoc grp ent))))
- )
- )
- (entmake new)
- )
- ;----------------------------------------------
- ;单行文本转属性文本
- ;----------------------------------------------
- (defun txmtx-to-att (ent / new dolst grp addto)
- (setq new '((0 . "ATTDEF")))
- (setq new (append new
- (list (cons 1 (cdr (assoc 1 ent)))
- (cons 2 (cdr (assoc 1 ent)))
- (cons 3 (cdr (assoc 1 ent)))
- (cons 70 0)
- )
- )
- )
- (setq dolst (list 7 8 10 11 39 40 41 50 51 62 71 72 73))
- (foreach grp dolst
- (setq addto (assoc grp ent))
- (if (/= addto nil)
- (setq new (append new (list (assoc grp ent))))
- )
- )
- (entmake new)
- )
|