Change lineweight to ByLayer in multiple blocks at once

Change lineweight to ByLayer in multiple blocks at once

ilporte
Participant Participant
1,350 Views
9 Replies
Message 1 of 10

Change lineweight to ByLayer in multiple blocks at once

ilporte
Participant
Participant

I'm working in a document that I didn't make and each door is its own block (for scale, this is a building with 8 floors - it's a lot of doors). I need to go through and change the lineweight and color on every door to "ByLayer" so that I can control them from the layer list. Is there a way to do this without opening every single block individually or going through and replacing all of my doors?

 

Thanks for any thoughts and solutions!

0 Likes
1,351 Views
9 Replies
Replies (9)
Message 2 of 10

pendean
Community Legend
Community Legend
Not sure how the program is going to guess which blocks in your files are just doors, and not windows or anything else.

Would you want this ability to work on all blocks in your file?

0 Likes
Message 3 of 10

cadffm
Consultant
Consultant

It would be helpful to know what program you are using..

Search and read about SetByLayer / SetByLayerMode

Sebastian

0 Likes
Message 4 of 10

ilporte
Participant
Participant

I'm using AutoCAD Mac 2018

0 Likes
Message 5 of 10

ilporte
Participant
Participant

Yes! I'd be happy to have this affect either all of the blocks in my document or any blocks that I select. 

 

0 Likes
Message 6 of 10

cadffm
Consultant
Consultant

And if you need this file only as XRef, search and read about Xrefoverride.

Sebastian

0 Likes
Message 7 of 10

ilporte
Participant
Participant

It's not an XRef - I need the drawing organized differently than whomever created it.

0 Likes
Message 8 of 10

cadffm
Consultant
Consultant

For mac, ok - not my Version but i like to help.

SetByLayer is not available in the mac versions, but you can run a 3.part extension or you can reach the goal by clever worksteps an laymrg.

 

READTHIS<click>

Sebastian

0 Likes
Message 9 of 10

Sea-Haven
Mentor
Mentor

Something like this

 

(setq  doc (vla-get-activedocument (vlax-get-acad-object))) ; open database
(setq allblocks (vla-get-blocks doc))

; converts  blocks to bylayer proerties 
  (vlax-for block allblocks 
   (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
   (vlax-for   ent block 
   (vla-put-color ent 0) 
   (vla-put-linetype ent "Bylayer") 
   (vla-put-lineweight ent aclnwtbyblock) 
   ) ;_ end of vlax-for 
      ) ;_ end of if 
    ) ;_ end of vlax-for 
  (vla-regen doc acactiveviewport) 
0 Likes
Message 10 of 10

ilporte
Participant
Participant

Thank you all! I'm trying to get these to work and I got a setbylayer lisp working, but it doesn't go into the block. 

 

Alan - I haven't worked a ton with custom commands, but I don't recognize the structure of the code you posted. Where can I use that to help me? 

0 Likes