skipsophrenic Posted September 14, 2009 Posted September 14, 2009 Hi, Been looking through past threads to see if there was a lisp out there that lets you select every block reference or block and then put all their components on to layer 0 and color to by layer? Sorry if this has been asked before but i can't find the thread if it has. Quote
lpseifert Posted September 14, 2009 Posted September 14, 2009 http://www.manusoft.com/software/Freebies/Lisp/fixblock.lsp Quote
tzframpton Posted September 14, 2009 Posted September 14, 2009 Hi, Been looking through past threads to see if there was a lisp out there that lets you select every block reference or block and then put all their components on to layer 0 and color to by layer? Sorry if this has been asked before but i can't find the thread if it has. search blast.lsp - that is what I use. Or you can use the SETBYLAYER command. I dunno if it's in 2008, but it is in 2009 and up. Quote
rkmcswain Posted September 14, 2009 Posted September 14, 2009 ...the SETBYLAYER command. I dunno if it's in 2008, but it is in 2009 and up. I can't keep up any more either... Lee says it was introduced in 2008 though... Quote
skipsophrenic Posted September 14, 2009 Author Posted September 14, 2009 Thanks for all the tips people, i'll try them out tomorrow and report back Quote
skipsophrenic Posted September 15, 2009 Author Posted September 15, 2009 AND WE HAVE A WINNER http://www.manusoft.com/software/Freebies/Lisp/fixblock.lsp Seriously though guys, thanks for takin the time to help me out here, this is gonna cut down my drafting 10 fold at the moment, Quote
skipsophrenic Posted September 15, 2009 Author Posted September 15, 2009 Then again, Is there something already done that takes the attributes over to the layer too? As am still having to go back and edit their properties manually, and with over 50 attributes per drawing it's rather time consuming. Quote
cedwards Posted September 15, 2009 Posted September 15, 2009 try this out - from cadcorner ;;; File Name: Layerfix.LSP ;;; Description: Changes the block definitions to BYLAYER . Will skip all ;;; XREF & XREF dependent blocks. ;;; ;;; Global Variables: None ;;; ;;; Local Variables: Self-explanatory ;;; ;;; Program Arguments: None ;;; Subroutines/Functions Defined or Called: None ;;; ;;;*************************************************************************** (defun LAYERFIX (/ BLKDATA NEWCOLOR NEWCOLOR NEWLAYER LAYER XREFFLAG XDEPFLAG BLKENTNAME COUNT ENTDATA ENTNAME ENTTYPE OLDCOLOR OLDLAYER SSCOUNT SS) (command ".undo" "group") (setq BLKDATA (tblnext "BLOCK" t)) (setq NEWCOLOR (cons 62 256)) ;this will set 62 (color) to bylayer ; (setq NEWLAYER (cons 8 "0")) ;this will set 8 (layer) to 0 ; While there is an entry in the block table to process, continue (while BLKDATA (prompt "\nRedefining colors for block: ") (princ (cdr (assoc 2 BLKDATA))) ; Check to see if block is an XREF or is XREF dependent (setq XREFFLAG (assoc 1 BLKDATA)) (setq XDEPFLAG (cdr (assoc 70 BLKDATA))) ; If block is not XREF or XREF dependent, i.e., regular block, then proceed. (if (and (not XREFFLAG) (/= (logand XDEPFLAG 32) 32)) (progn (setq BLKENTNAME (cdr (assoc -2 BLKDATA))) (setq COUNT 1) (terpri) ; As long as we haven't reached the end of the block's defintion, get the data ; for each entity and change its color assignment to BYLAYER. (while BLKENTNAME (princ COUNT) (princ "\r") (setq ENTDATA (entget BLKENTNAME)); get entities data (setq OLDCOLOR (assoc 62 ENTDATA)) ;get entities old color value (if OLDCOLOR ; if value exist (null = bylayer) (entmod (subst newcolor oldcolor ENTDATA)) ; substitute old color to byblock (entmod (cons newcolor ENTDATA)) ; modify ent data w/ byblock values ) (setq BLKENTNAME (entnext BLKENTNAME)) ;if attributes exist, then edit next one (setq COUNT (+ COUNT 1)); ) ;end while for attribute trap ) ;progn (progn (princ " XREF...skipping!") ) ;progn );end if not an Xref (setq BLKDATA (tblnext "BLOCK")) ;next block please ) ;end while loop of blk data available to edit (command ".undo" "end") (command ".regen") (PROMPT "\nDone... ") (princ) ) (LAYERFIX) Works on all blocks except xref dependent. Quote
skipsophrenic Posted September 15, 2009 Author Posted September 15, 2009 Thanks cedwards, i'll have a look at that tomorrow, just heading out of office now 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.