cadmando2 Posted December 3, 2014 Share Posted December 3, 2014 Trying to find a lisp routine to change existing equipment to phantom layer and color but want to keep the line type. Some of the equipment is in blocks with block and some are explode. Would like the option to select or window around area and change it to selected layer and color, but keep the line type. Can anyone suggest clean way to change blocks and entities? Quote Link to comment Share on other sites More sharing options...
ttray33y Posted December 3, 2014 Share Posted December 3, 2014 (edited) for non blocks, you may use below (defun C:chCL(/ whc sset ent sellist color layer) (defun FiltLayer(sset pst) (setq whc 0 newSet(ssadd)) (while(< whc (sslength sset)) (setq ent(ssname sset whc)) (setq sellist(entget ent)) (if(= pst (cdr(assoc 8 sellist))) (ssadd ent newSet) ) (setq whc(+ whc 1)) ) newSet ) (setvar "cmdecho" 0) (setq color(acad_colordlg 1 nil)) (setq layer(getstring "\n Layer: ")) (setq sset (ssget[color=purple] [color=black]"X"[/color] [/color] (list (cons -4 "<OR") (cons 0 "ARC") (cons 0 "CIRCLE") (cons 0 "ELLIPSE") (cons 0 "LINE") (cons 0 "LWPOLYLINE") (cons 0 "POLYLINE") (cons 0 "INSERT") (cons -4 "OR>") ) ) ) (if(and sset(> (sslength sset) 0))(setq sset(FiltLayer sset "[color=purple]LAYER NAME OF xploded BLOCKs[/color]"))) (if (and sset (> (sslength sset) 0)) (progn (command "change" sset "" "Properties" "Color" color "") (command "change" sset "" "Properties" "LAyer" layer "") (command "setbylayer" "P" "") ) ) (setvar "cmdecho" 1) (princ) ) for the blocks, edit everyone of them > save them > drag them in your tool palette > and use redefine command from the tool palette to update your blocks. or you can use VVA lisp for the blocks. here: http://www.cadtutor.net/forum/showthread.php?533-Lisp-colour-change-for-all-layers-and-blocks/page2 Edited December 3, 2014 by ttray33y add reference Quote Link to comment Share on other sites More sharing options...
cadmando2 Posted December 3, 2014 Author Share Posted December 3, 2014 I have been editing the blocks with refedit command but when you have a lot of blocks and 35% of the project is existing equipment that I need to have light layer but on Phantom layer. it is time consuming to change existing equipment to different layer and keep the line type and LTscale the same is a pain. Very time consuming. I never created lisp routine before, mostly scripts, but I give this a try editing to make it work. Thanks Quote Link to comment Share on other sites More sharing options...
ttray33y Posted December 3, 2014 Share Posted December 3, 2014 edited the routine above for you, try it out. Quote Link to comment Share on other sites More sharing options...
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.