;Redefines ALL objects in any block in the drawing on layer 0. ;NUKE.LSP redefines all objects in a block on layer 0, with color and linetype ;set to BYLAYER. NUKED blocks will then take on the properties of the layer ;that they are inserted on. The routine works by modifing objects in the block table, ;so the blocks never have to be exploded. ; ;The global method redefines ALL objects in every block in the current drawing, ;except dimensions, hatching or xrefs, even if they are on a layer that is ;frozen or turned off. ; ;The select method redefines blocks selected with any standard selection method, ;as well as any blocks nested in the selected block(s). (defun To-1( 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 (or (= (cdr (assoc 8 EDATA)) "AM_3") (= (cdr (assoc 8 EDATA)) "AM_4") (= (cdr (assoc 8 EDATA)) "AM_8") ) ;or (progn (setq EDATA (subst (cons 8 "AM_99") (assoc 8 EDATA) EDATA)) (entmod EDATA) ) ;progn ) ;if ;----------------------------------------------------------------- ; (if (/= (cdr (assoc 8 EDATA)) "AM_7") ; (progn ; (setq EDATA (subst (cons 8 "AM_11") (assoc 8 EDATA) EDATA)) ; (entmod EDATA) ; ) ;progn ; ) ;if ;----------------------------------------------------------------- (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:BAS( / BLK_NM CHOICE E A EDATA IDX PK_BLK SS) (princ "\rBLOCKINHALTSAUBER wird gestartet!")(princ) (command "._undo" "m") (setq CHOICE "Enter") (initget "A E") ;; (setq CHOICE(getkword (strcat "\n Einzelne Blöcke wählen: <" CHOICE "> "))) (if(not CHOICE)(setq CHOICE "E")) (if (= (strcase CHOICE) "A") ;global nuke (while (setq BLK_NM(tblnext "BLOCK" (null BLK_NM))) (To-1 (cdr(assoc 2 BLK_NM))) );while ;nuke selected block (progn (prompt "\nBlöcke auswählen: ") (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-1 PK_BLK)) );while );progn );if (command "._regen") (princ "\rFertig! Jetzt kann gespeichert werden ") (princ) );defun (prompt"\nBLOCKINHALTSAUBER.LSP --->Start mit BAS")(princ)