Jump to content

Changing color of lines within multiple blocks


Elizanoloo

Recommended Posts

Hey,

 

So I have received a few (15) drawings from an architect and I am compiling them in an overall xref so we can then work around it. Each drawing has several blocks all with color set bylayer, but within the blocks a lot of the lines are set by different colors.

 

What I am trying to do is change all the magenta colored lines to number 8, without changing the rest. So far I had to go into each block, select all the magenta lines using filter, and then changing them to number 8.

 

I am aware of commands such as setbylayer, but in this case they would not work as the layer color is green and the rest of the linework is fine.

 

Changing plot settings, although very quick, is not an option. We have global setting that we use throughout the office and would create a bunch of other problems.

 

I know I am kind of reaching here a bit, but does anyone have any thoughts or knows of any lisps that might make this tedious job a little bit faster.

 

Cheers

Link to comment
Share on other sites

If the assigned layer color cannot be changed, then you have to edit each block. If you are finding yourself editing the same blocks multiple times across multiple files, there might be a better solution.

Link to comment
Share on other sites

Heres a start for you, you would need to change the put-color to get-color then a IF = 6 vla-put-color 8

 

(vl-load-com) 
 (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
 (vla-startundomark adoc) 
 (vlax-for block (vla-get-blocks adoc) 
   (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 adoc acactiveviewport) 
 (vla-endundomark adoc) 
 (princ) 

Link to comment
Share on other sites

Hey,

 

Thanks to both of you.

 

RobDraw, that is exactly what I ended up doing, and unfortunately the blocks were not even the same on the different drawings. I just spend a whole day just preparing an xref...

 

BIGAL, I am a little familiar with lisps but not so much as to take your start and further it as a viable solution. If you have time to finish it I would be grateful. I did end up having to go through all the blocks, but it would be great for future use to have something.

 

Have a lovely weekend

Link to comment
Share on other sites

check color if so change

 

(vl-load-com) 
 (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
 (vla-startundomark adoc) 
 (vlax-for block (vla-get-blocks adoc) 
  (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
  (vlax-for ent block 
  (if (= (vla-get-color ent ) 6)
  (vla-put-clor ent 
  )
  (vla-put-linetype ent "Bylayer") 
  (vla-put-lineweight ent aclnwtbyblock) 
  ) ;_ end of vlax-for 
     ) ;_ end of if 
   ) ;_ end of vlax-for 
 (vla-regen adoc acactiveviewport) 
 (vla-endundomark adoc) 
 (princ)

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...