Hatch Control - Extract all hatches within Model

Hatch Control - Extract all hatches within Model

kieran.leadbetter
Advocate Advocate
1,950 Views
19 Replies
Message 1 of 20

Hatch Control - Extract all hatches within Model

kieran.leadbetter
Advocate
Advocate

Hello, I'm aware this might not be possible but unless I ask I'll never know. 

So currently across my library of autocad blocks, there's a bunch of hatches within the blocks indicating a few main fabric colours, purple, yellow and red etc... Now across all these blocks these hatches vary slightly. i.e. 

Red Hatch: RGB: 180, 60, 40 (But across the blocks it may be off, (180, 55, 35) (178, 62, 40) etc...), its only visible really when the blocks are next to each other which in recent projects has been occurring more and more

So my goal is to somehow extract all the hatches used within a model, and show them, to then be able to select all the occurrences of the now extracted hatches and change them to the correct colour that I need. 

The reason for this is I have hundreds of blocks and doing this manually would take weeks of work. This started off as bad block management I'm aware.

Any help would be appreciated,
Kind Regards

0 Likes
1,951 Views
19 Replies
Replies (19)
Message 2 of 20

komondormrex
Mentor
Mentor

hey,

you mean solid hatches?

0 Likes
Message 3 of 20

kieran.leadbetter
Advocate
Advocate
Yes it would be
0 Likes
Message 4 of 20

paullimapa
Mentor
Mentor

Try the lisp solutions here


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 20

kieran.leadbetter
Advocate
Advocate
This helps a little, but I need one that replaces specific hatches by selection, almost all my blocks contain multiple hatches, white, blacks, colours. Doing that may cause more work for me otherwise.
0 Likes
Message 6 of 20

paullimapa
Mentor
Mentor

Could be combining with code found here which lets you select and delete but use code from previous link to change color

But here’s the potential problem. Since a block can only have one given look unless it’s a dynamic block then after it’s selected and changed to one color when it’s selected again because the block is also placed in another location as part of the selection set then the hatch color will change again in the previous location as well. Is this what you want?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 20

Moshe-A
Mentor
Mentor

@kieran.leadbetter hi,

 

from one side you say i want to save time, i need automation. from the other side you want selectively to pick hatch objects that need to be change but to do that you need to open each block in block editor so how automation will help here?

 

Moshe

 

 

 

0 Likes
Message 8 of 20

kieran.leadbetter
Advocate
Advocate
I have no idea if its possible or not, I'm comparing the concept to sketchup which I know is a different program, but some people are wizards with lisps.

With sketchup I was able to use a plugin to extract all the materials and bring them together creating a large grid of 500mmx500mm squares showing me to see all the materials which were used within the model. I was hoping someone might be able to do the same thing with hatches within the model. And if so maybe a 2nd lisp after this to override all hatches of the selected hatch to another colour, i.e. all hatches of 255,255,255 are changed to 0,0,0.

This was a total chancer, I wouldn't be surprised if its not possible but theres some really impressive lisps out there so thought I would see.
0 Likes
Message 9 of 20

komondormrex
Mentor
Mentor

could it be possible if you'd post a sample with such blocks with such hatches in variations?

0 Likes
Message 10 of 20

Kent1Cooper
Consultant
Consultant

Are the Solid Hatch patterns' colors all by way of color property overrides, and never ByLayer?

Kent Cooper, AIA
0 Likes
Message 11 of 20

john.uhden
Mentor
Mentor

@paullimapa ,

If I am understanding this correctly, the hatches are within blocks.  So I think what you are saying is that if we change the block definition, which may be inserted more than once, then all the insertions are changed, which may not be wanted.

How about if just the hatching inside the block definition is changed to color ByBlock?  That way he could change the color of the insertion and only the hatch will change.  Oops, unless of course he has multiple hatches within one block and they all need to be different colors

It woulda been better if the differing hatches were on different layers.  But we could automate that for him.  He would have to provide a layer name for each color. Plus, in that way it would be easy to control the hatch colors simply by changing the color of the particular hatch layer.

* Required list:

Existing Color   Proposed Color  Layer Name

or maybe just

Existing Color   Layer Name (he can change the layer color later)

John F. Uhden

0 Likes
Message 12 of 20

paullimapa
Mentor
Mentor

Could be a good solution. Just run the lisp one time to find all hatches within blocks and make a layer with a certain standard name that can all be retrieved later and have each layer be the clolor changing the hatch color to bylayer. Then run a second lisp for whenever you want to change those colors that would present the layers as a grid or swatches of colors for selection to a different color as the OP @kieran.leadbetter is described in msg 8. Changing the Layer Color would definitely be easier than going back to locate each hatch object within the block. Also moving forward any hatches created would have to then follow this standard layer naming format inorder for it to be included in the color change process 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 20

john.uhden
Mentor
Mentor

@paullimapa ,

Exactly.

I'm glad you thought of it.  😁

John F. Uhden

0 Likes
Message 14 of 20

paullimapa
Mentor
Mentor

But then there could be the added complexity that when a different color is chosen the layer would have to be renamed to match and if there’s already an existing layer with the same color name do you try merging the layers or append a sequential number? FYI I typically prefer to make color changes based on the object location and in relation to the space rather than looking at the color swatches used and making a broad stroke change that would impact all other objects matching that color. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 15 of 20

Kent1Cooper
Consultant
Consultant

I can imagine a process for this [subject to an answer to my question in Message 10]:

 

1.  Step through all Block definitions, find any Hatches, get their colors, put them in a list.
2.  Make small SOLID Hatch patterns with each color found.
3.  User arrange those into groups of multiple similar colors to be made the same color.

4.  Make lists starting with the preferred color of each group, and including other colors in the group that should be replaced by it.
5.. Step through all Block definitions again, and for each Hatch found, get its color, check for membership in a list, replace it with the first color in that list.

 

I think that could be automated, maybe as one command for steps 1 & 2, let the User do step 3, then another command for steps 4 & 5.

 

The (getpropertyvalue) and (setpropertyvalue) approach to an object's color can deal with RGB colors, whereas the (entget) and (subst)/(entmod) approach cannot, but "rounds those off" to the closest index color.

Kent Cooper, AIA
0 Likes
Message 16 of 20

john.uhden
Mentor
Mentor

@paullimapa ,

The layer does not necessarily need to be renamed because of a color change.  He could be naming the layers after US Presidents or favorite performers or sports teams.  Plus, he could just add another color and layer ("McKinley" . 210) or ("Redskins" 230).

John F. Uhden

0 Likes
Message 17 of 20

paullimapa
Mentor
Mentor

I once knew a company that named their printers after famous rock stars...let's print to Madonna today and tomorrow we'll do Elvis.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 18 of 20

john.uhden
Mentor
Mentor

@paullimapa ,

Looks like no amount of dyslexia would confuse the names.  Nice.

John F. Uhden

0 Likes
Message 19 of 20

Sea-Haven
Mentor
Mentor

My goto layout has an extra command call "GOOT", as I have 12 fingers some times, maybe it's  dyslexia.

0 Likes
Message 20 of 20

komondormrex
Mentor
Mentor

@kieran.leadbetter wrote:

So my goal is to somehow extract all the hatches used... 


like this?

komondormrex_0-1724999919679.gif

 

0 Likes