Jump to content

Changing entities and blocks to selected layer and keep the linetype


cadmando2

Recommended Posts

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?

Link to comment
Share on other sites

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 by ttray33y
add reference
Link to comment
Share on other sites

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

:)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...