Donald Varino
Usenet Archive
- Joined
- Jan 21, 2001
- Messages
- 26
- Reaction score
- 0
I'm new to LISP and I wrote this routine that will look and find the correct drawing to xref into my drawing, the only catch is that I also want it o look to see if that drawing is already loaded (xref'ed) or if there is a block occurance in the drawing that will cause this to be a circular reference. Any help would be greatly appreciated I use Autocad R14 and 2002
See code here......
(defun c:xrr (/ savecmd dir dwgname dwgnumb partname newname dirdwgname blk_def blk_lst) (setq savecmd (getvar "cmdecho")) (setq dir (getvar "dwgprefix")) (setq dwgname (getvar "dwgname")) (setq dwgnumb (substr dwgname 5 6)) (setq partname "O_FP") (setq newname (strcat partname dwgnumb)) (setq dirdwgname (strcat dir newname)) (setq blk_def (tblnext "block" T)) (setq blk_lst (cdr (assoc 1 blk_def))) (if (or (= newname blk_lst) (alert "XREF already attached. Try RELOADing instead")) (alert "There is already a block in the drawing with that name, please PURGE") (command) (command ".xref" "a" dirdwgname "0,0" "" "" "")) (command "zoom" "extents") (setvar "cmdecho" savecmd) (princ)
)
Donald
See code here......
(defun c:xrr (/ savecmd dir dwgname dwgnumb partname newname dirdwgname blk_def blk_lst) (setq savecmd (getvar "cmdecho")) (setq dir (getvar "dwgprefix")) (setq dwgname (getvar "dwgname")) (setq dwgnumb (substr dwgname 5 6)) (setq partname "O_FP") (setq newname (strcat partname dwgnumb)) (setq dirdwgname (strcat dir newname)) (setq blk_def (tblnext "block" T)) (setq blk_lst (cdr (assoc 1 blk_def))) (if (or (= newname blk_lst) (alert "XREF already attached. Try RELOADing instead")) (alert "There is already a block in the drawing with that name, please PURGE") (command) (command ".xref" "a" dirdwgname "0,0" "" "" "")) (command "zoom" "extents") (setvar "cmdecho" savecmd) (princ)
)
Donald