I am trying to create a random pattern of 4 colors. I managed to create a script in Grasshopper that does it for 2, but cannot replicate it for 4. Here is a screenshot of the way it looks now, but I need 4 different colors, and preferably I’d like for there to be an even number of each color pane. (There are 828 panes, so 207 panes per color.)
This is the script I created, please let me know how I can adjust it for my goal.
random selection A.gh (31.2 KB)
Here is the file with the panes.
isolated panes.3dm (9.1 MB)
random selection A Edited V0.gh (2.6 MB)
That is amazing pattern, How did you apply that pattern on the BREP?
if you don’t want contiguous cells with the same color you can use my nColor tool from Nautilus plugin
I had some difficulties has some panes are not joined so I joined them but I need a tolerance of 0.1. But it seems It joined other panes … Also as panes are not near the topology is calculated using curves and a tolerance equal to more than the gap. If not, there is a bug in my tool as there could be isolated object meaning they have no neighbor!
But if you want you surely have better access to the real topology, so you could generate a better FaceFace topology.
I also added a script to have more than 4 colors
color brep not joining.gh
If you open the definition and have some problem like here
If purple it means it was not possible to have just 4 colors.
The components also output cells with “bad” color.
This is due to the tolerance for joining the breps.
After changing tolerance from 0.001 to 0.1 in Rhino and recomputing I get that, no errors
Then you can count the colors using that
So the number of color is ranging from 199 to 209 for 809 elements. But this could change depending on the seed.
When I open the file and re-set the BREP, the colors do not appear. I ask it to bake again and it recreates the surfaces and also creates meshes. Any suggestions on how to fix whatever I’m doing wrong?
It is hard to say, I don’t know where you click. If you click on Custom Preview you have to click on the right spot, see that
If it is Brep in the Custom Preview it must output Brep !!
And some appreciations are always welcomed.