Block Replace not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have a lisp that use to work but it's now not doing anything. It use to replace our old border with the new one then run 'ATTSYNC' to update the attributes. Since then our borders have changed and the location. I thought I had update them all correctly but now I get the following issue:
Specify sheet to redefine [A0/A1/A2/A3/A3P/A4/A4P] <all>:
_.-INSERT Enter block name or [?]: A3 Drawing Sheet=C:\CAD\A3 Drawing Sheet.dwg Block A3 Drawing Sheet references itself
Regenerating layout.
Regenerating model.
*Invalid*
; error: Function cancelled
The old and new borders have the same block name and the new border is saved as a WBLOCK. No idea what is causing the issue myself. The only difference is that we use to be on Windows 7 and now Windows 10 but I doubt that would be causing this issue. Does anyone have an idea?
Thanks,
Joe
(defun c:TitleBlockRedefine ( / path blks key name)
(setq path "C:\\CAD\\" ;; see double backslash
blks '(("A4" . "A4 Drawing Sheet") ;; file name == block name !!!
("A4P" . "A4P Drawing Sheet")
("A3P" . "A3P Drawing Sheet")
("A3" . "A3 Drawing Sheet")
("A2" . "A2 Drawing Sheet")
("A1" . "A1 Drawing Sheet")
("A0" . "A0 Drawing Sheet")
))
(initget "A0 A1 A2 A3 A3P A4 A4P") ;; list off all numbers to be selected
(if (setq key (getkword "\nSpecify sheet to redefine [A0/A1/A2/A3/A3P/A4/A4P] <all>: ")) ; selection by numbers
(setq blks (list (assoc key blks))))
(foreach e blks
(setq name (cdr e))
(if (setq ss (ssget "_X" (list '(0 . "INSERT"))))
(repeat (setq i (sslength ss))
(if (/= (strcase (vla-get-effectivename (vlax-ename->vla-object (setq ent (ssname ss (setq i (1- i)))))))
(strcase name))
(ssdel ent ss))))
(if (and ss
(> (sslength ss) 0))
(progn
(command "_.-INSERT" (strcat name "=" path name ".dwg"))
(command)
(command "_.ATTSYNC" "_Name" name))))
(princ)
)