试试这个
- (DEFUN C:TXT2ATT (/ SS1 N TXTENT AA A1 A73 LST_210 LST_10)
- (VL-CMDF "_.undo" "_group")
- (SETVAR "blipmode" 0)
- (PRINC "\n选择TEXT文本对象: ")
- (setq SS1 (SSGET '((0 . "TEXT"))))
- (VL-CMDF "_.UCS" "W")
- (setq N 0)
- (REPEAT (SSLENGTH SS1)
- (setq TXTENT (SSNAME SS1 N))
- (setq LST_210 (APPEND LST_210 (LIST (ASSOC 210 (ENTGET TXTENT)))))
- (setq LST_10 (APPEND LST_10 (LIST (ASSOC 10 (ENTGET TXTENT)))))
- (setq AA (MEMBER '(100 . "AcDbEntity") (ENTGET TXTENT)))
- (setq A73 (CDR (ASSOC 73 AA)))
- (setq A1 (CDR (ASSOC 1 AA)))
- (ENTMAKE
- (APPEND '((0 . "ATTDEF"))
- (REVERSE (CDDR (REVERSE AA)))
- '((100 . "AcDbAttributeDefinition") (70 . 8))
- (LIST (CONS 74 A73) (CONS 3 A1) (CONS 2 A1))
- )
- )
- (setq N (1+ N))
- )
- (VL-CMDF "_.erase" SS1 "")
- (VL-CMDF "_.UCS" "P")
- )
|