ged Posted August 27, 2008 Posted August 27, 2008 Hi, does anyone have a lisp file that will reset blocks within blocks to layer 0. Quote
chulse Posted August 27, 2008 Posted August 27, 2008 Try FIXBLOCK.lsp here: http://www.manusoft.com/Software/Freebies/Main.stm Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 Thanks Cary for the reply, I have used this lisp before but it only goes down 1 layer and not blocks within blocks. We receive a lot of different architects drawings from differing sources and would like to colour them all 252 in 1 swoop. The problem is that some of the blocks are not on layer 0 when they are made, therefore they retain their colour and layer name. We then xref this drawing into another drawing and simply draw over the top with our building service symbols. It sounds simple but we spend lots of time cleaning architects drawings up and revision after revision, its a complete waste of time and resources. Its driving me crazy!! Quote
chulse Posted August 27, 2008 Posted August 27, 2008 I understand. I have been troubled by those also. Here is another one - called GO-0.lsp: http://www.turvill.com/t2/free_stuff/index.htm Not sure if it will work on nested blocks though. Try it. edit: On second thought, I don't think this will do what you want either Quote
chulse Posted August 27, 2008 Posted August 27, 2008 Maybe a MOD can move this to the LISP area so we can get some GURU help on this? Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 Thanks again Cary, I've had a quick look at it but am struggling to make head nor tail of it, ged MOD? Quote
Strix Posted August 27, 2008 Posted August 27, 2008 thread moved - thanks for the PM PS - 'mod' is too short to come up on a forum search so we can't pick messages up on thread by that method Quote
chulse Posted August 27, 2008 Posted August 27, 2008 thread moved - thanks for the PM PS - 'mod' is too short to come up on a forum search so we can't pick messages up on thread by that method Gotcha! Thanks Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 What do we do now, hang around until someone picks it up? Quote
Strix Posted August 27, 2008 Posted August 27, 2008 yep - and if you set your CP to send you emails for subscribed threads you won't have to hang around, you can work on something else :wink: I've given you a more specific title too Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 Thanks for the help, its really appreciated. Quote
chulse Posted August 27, 2008 Posted August 27, 2008 Pretty much. There must be a way to add nested block functionality to the fixblock lisp. Hopefully someone here can help... Quote
David Bethel Posted August 27, 2008 Posted August 27, 2008 Totally untested and "AS IS", Even if it blows up your dwg. Change ALL nested INSERTs to LAyer 0 (defun c:nestb2lay0 (/ tdef fe fd) (while (setq tdef (tblnext "BLOCK" (not tdef))) (setq fe (cdr (assoc -2 tdef))) (while fe (setq fd (entget fe)) (and (= "INSERT" (cdr (assoc 0 fd))) (/= "0" (cdr (assoc 8 fd))) (entmod (subst '(8 . "0") (assoc 8 fd) fd))) (setq fe (entnext fe)))) (prin1)) -David Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 Thanks will I will give it a go on something unimportant, ged Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 I know this is going to sound really silly but how do I use it? Quote
David Bethel Posted August 27, 2008 Posted August 27, 2008 This should be a direct link to a FAQ about loading an using an Autolisp routine. http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F -David Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 Thanks David, I'm going home now to take the dog for a walk. had enough for today, thanks for all the help guys, ged Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 Hi again David, I gave the lisp a go but cant get it to function using any of the methods for loading lisp files, any ideas. I'm using cad 2006, does that make a difference? Quote
ged Posted August 27, 2008 Author Posted August 27, 2008 I've found something which may be of use to others, not tried it yet but it looks promising, the comand is "nuke" (defun To-0( BLCK / BNAME BLIST E EDATA SPIN TMP ) ;;; Prints a pinwheel on the command line (defun Spin ( ) (setq SYM (cond ((= SYM nil) "-") ((= SYM "-") "\\") ((= SYM "\\") "|") ((= SYM "|") "/") ((= SYM "/") "-") ) ) (princ (strcat "\rScanning... " SYM " ")) );end spin (if (=(type BLCK)(read "LIST"))(setq TMP(car BLCK) BLIST(cdr BLCK) BLCK TMP TMP nil)) (setq BLCK(tblsearch "BLOCK" BLCK)) (if (and (/=(logand(cdr(assoc 70 BLCK))1)1) ;skips annomyous blocks (/= (logand(cdr(assoc 70 BLCK))4)4) ;skips xrefs );and (progn (setq E (cdr (assoc -2 BLCK))) (while E (if (=(cdr(assoc 0 (entget E))) "INSERT") ;If the object is a block (progn (setq BNAME(cdr(assoc 2(entget E)))) ;save the name to a list (if (not (member BNAME BLIST)) (if (not BLIST)(setq BLIST (list BNAME)) ;create the list if it doesn't exist (setq BLIST(append BLIST(list BNAME))) );if );if );progn );if (setq EDATA (entget E)) (if(assoc 62 EDATA) ;Resets object color to BYLAYER if it isn't. (setq EDATA(subst(cons 62 256)(assoc 62 EDATA)EDATA)) );if (if(assoc 6 EDATA) ;Resets object linetype to BYLAYER if it isn't. (setq EDATA(subst(cons 6 "BYLAYER")(assoc 6 EDATA)EDATA)) );if (setq EDATA(subst (cons 8 "0")(assoc 8 EDATA)EDATA));changes layer to 0 (entmod EDATA);updates entity (setq E (entnext E));get next enitiy, nil if end of block (Spin) );end while E );progn );if BLIST; returns names of any nested blocks );defun (defun C:NUKE( / BLK_NM CHOICE E EDATA IDX PK_BLK SS) (command "._undo" "m") (setq CHOICE "S") (initget "G S") (setq CHOICE(getkword (strcat "\n<G>lobal or <S>elect block: <" CHOICE "> "))) (if(not CHOICE)(setq CHOICE "S")) (if (= (strcase CHOICE) "G") ;global nuke (while (setq BLK_NM(tblnext "BLOCK" (null BLK_NM))) (TO-0 (cdr(assoc 2 BLK_NM))) );while ;nuke selected block (progn (prompt "\nSelect Block(s) to Nuke: ") (setq SS(ssget '((0 . "INSERT")))) (setq IDX 0) (repeat (sslength SS) (setq BLK(cdr(assoc 2 (entget(ssname SS IDX))))) (cond (PK_BLK (setq PK_BLK(append PK_BLK (list BLK)))) (T (setq PK_BLK(list BLK))) );cond (setq IDX(1+ IDX)) );repeat (while PK_BLK (setq PK_BLK(To-0 PK_BLK)) );while );progn );if (command "._regen") (princ "\rFinished ") (princ) );defun (prompt"\nNUKE loaded.")(princ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.