试穿这个尺码:
- (defun c:tagger (/ *error* vLst oVars ans pTxt sTxt cnt iPt drTag bubTag drTagLst bubTagLst)
- (defun *error* (msg)
- (if oVars
- (mapcar 'setvar vLst oVars))
- (if (eq "" msg)
- (princ "\n<< Function Complete >>")
- (princ (strcat "Error: " (strcase msg))))
- (princ))
- (setq vLst (list "OSMODE" "CLAYER" "ATTREQ" "BLIPMODE")
- oVars (mapcar 'getvar vLst))
- (mapcar 'makelay '("A-DOOR-IDEN" "S-GRID-IDEN") '("5" "4"))
- (if (and (tblsearch "BLOCK" "Tagdoor1") (tblsearch "BLOCK" "Grdbub01"))
- (progn
- (if (not TG:oans) (setq TG:oans "Door"))
- (initget "Door Bubble")
- (setq ans (getkword (strcat "\nSpecify Tag Type [Door/Bubble] <" TG:oans ">: ")))
- (if (not ans) (setq ans TG:oans) (setq TG:oans ans))
- (if (and (setq pTxt (getstring t "\nSpecify Prefix Text <Enter for no Prefix>: "))
- (not (initget 5))
- (setq sNum (getint "\nSpecify Starting Number: ")
- sTxt (getstring t "\nSpecify Suffix Text <Enter for no Suffix>: ")))
- (progn
- (setq cnt 0)
- (mapcar 'setvar vLst (list 0 "0" 0 0))
- (while (setq iPt (getpoint "\nSelect Point for Symbol > "))
- (cond ((= ans "Door")
- (setvar "clayer" "A-DOOR-IDEN")
- (command "-insert" "Tagdoor1" iPt "" "" "")
- (setq drTag (entnext (entlast)))
- (while (/= "SEQEND" (cdadr (setq drTagLst (entget drTag))))
- (if (= "DR1NUM" (cdr (assoc 2 drTagLst)))
- (entmod (subst (cons 1 (strcat pTxt (rtos (+ sNum cnt) 2 0) sTxt))
- (assoc 1 drTagLst) drTagLst)))
- (setq drTag (entnext drTag)))
- (command "_regenall"))
- ((= ans "Bubble")
- (setvar "clayer" "S-GRID-IDEN")
- (command "-insert" "Grdbub01" iPt "" "" "")
- (setq bubTag (entnext (entlast)))
- (while (/= "SEQEND" (cdadr (setq bubTagLst (entget bubTag))))
- (if (= "GRIDNUM" (cdr (assoc 2 bubTagLst)))
- (entmod (subst (cons 1 (strcat pTxt (rtos (+ sNum cnt) 2 0) sTxt))
- (assoc 1 bubTagLst) bubTagLst)))
- (setq bubTag (entnext bubTag)))
- (command "_regenall")))
- (setq cnt (1+ cnt))))))
- (princ "\n<!> One or More Blocks not Found <!>"))
- (*error* "")
- (princ))
- (defun makelay (x y)
- (if (not (tblsearch "LAYER" x))
- (command "-layer" "M" x "C" y x "")))
对于门标签,输入的数字将保持不变,并在后缀文本中输入一个字符作为“开始字符”。 |