If it is indeed a filepath you would like the blocks referenced to, make sure you fill in the highlighted Parts to the correct Filepaths for each block (right down to the file level), using double backslashes.
i.e.
C:\\Users\\LeeMac\\Documents\\Block1.dwg
- (defun c:tagger (/ *error* vLst oVars DoorBlock BubbleBlock ans pTxt sTxt cnt iPt drTag bubTag drTagLst bubTagLst lAns 1pt 2pt lAng chrLst sChr) (vl-load-com) (defun *error* (msg) (if oVars (mapcar 'setvar vLst oVars)) (if (eq "" msg) (princ "\n>") (princ (strcat "Error: " (strcase msg)))) (princ)) (setq vLst (list "OSMODE" "CLAYER" "ATTREQ" "BLIPMODE" "CMDECHO") oVars (mapcar 'getvar vLst)) (mapcar 'setvar vLst (list 0 "0" 0 0 0)) (mapcar 'makelay '("A-DOOR-IDEN" "S-GRID-IDEN" "S-GRID") '("5" "4" "2")) (setq DoorBlock "[b][color=Red]C:\\...[/color][/b]" BubbleBlock "[color=Red][b]C:\\...[/b][/color]") (if (and DoorBlock BubbleBlock) (progn (if (not TG:oans) (setq TG:oans "Door")) (if (not TG:olans) (setq TG:olans "Yes")) (initget "Door Bubble") (setq ans (getkword (strcat "\nSpecify Tag Type [Door/Bubble] : "))) (if (not ans) (setq ans TG:oans) (setq TG:oans ans)) (if (and (setq pTxt (getstring t "\nSpecify Prefix Text : ")) (not (initget 5)) (setq sNum (getint "\nSpecify Starting Number: ") sTxt (getstring t "\nSpecify Suffix Text : "))) (progn (setq cnt 0) (cond ((= ans "Bubble") (initget "Yes No") (setq lAns (getkword (strcat "\nGrid-Line? [Yes/No] : "))) (if (not lAns) (setq lAns TG:olans) (setq TG:olans lAns)) (cond ((= lAns "No") (while (setq iPt (getpoint "\nSelect Point for Symbol > ")) (setvar "clayer" "S-GRID-IDEN") (command "-insert" BubbleBlock 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)))) ((= lAns "Yes") (while (and (setq 1pt (getpoint "\nSpecify Grid-Line First Point > ")) (setq 2pt (getpoint 1pt "\nSpecify Second Grid-Line Point > "))) (setvar "clayer" "S-GRID") (command "_line" 1pt 2pt "") (setq grLin (entlast) lAng (angle 1pt 2pt) iPt (polar 2pt lAng 0.5)) (setvar "clayer" "S-GRID-IDEN") (command "-insert" BubbleBlock 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)))))) ((= ans "Door") (setq chrLst (vl-string->list sTxt)) (if chrLst (setq sChr (last chrLst)) (setq sChr 65)) (while (and (setq iPt (getpoint "\nSelect Point for Symbol > ")) (< (+ sChr cnt) 91)) (setvar "clayer" "A-DOOR-IDEN") (command "-insert" DoorBlock 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 2 0) (chr (+ sChr cnt)))) (assoc 1 drTagLst) drTagLst))) (setq drTag (entnext drTag))) (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 "")))
|