I am very new to grasshopper, and at the moment I have a question which I hope people can hint me with solutions.
So basically, I have been trying to map a set of facade units to a surface which I would have some control over where each unit goes on a surface. That’s why I have created a colour RGB image, and transformed the colour values into a set of values on the surface, and I hope in a way I can then assign different facade units to different values individually (so for example, if the value is 1 then facade unit 1 will be assign to that location and so on).
I am not sure which approach is correct as I am very new to scripting, and I would really appreciate if some experts can help. Thanks!
Your solution was already somehow complex (in a good way) …
Your image sampler domains were set to “0 To 0.1” … you should want to use “0 To 1” instead.
So dividing that domain into double the subdivisions and picking only odd elements (see at start the dispatch block) make you have the “center” of the pixel during the image-sampling.
If you sample a point midway 2 pixels the result will be “blurred” because of image filtering (see also that i rounded results with “int” param because of that.
I managed it as if the cells are everytime red (0) unless green (1) or blue (2) occur, if you use a more complex color pattern you will need to change the logic.
Also, with a solution like this (using the image sampler) you need to manually set the picture X and Y size of the image…
With a script you could easily get that info in a faster and cleaner way.
Thank you so much for your reply, it is very helpful and it works very well on my model.
One of the things is, as for my facade units, there are around 6 of them, and they are all 3D modules- glazing compartments or solid walls, so they are not necessarily polygons, and they do not need to be in the specific colours i assigned to the colour map.
Also, is there a way where I can control the spacing between each of the unit? When putting it in architectural terms, I would like to control the joint dimensions when distributing these facade units?
I hope this does not sound too complicating, and I really really appreciate your help, as I really do not know who else to ask help from. Thanks again!
Also, the idea behind is that, i hope by recreating this script, I can have an easy control over the facade composition- I can basically change the colour map with other compositions and a facade distributed with the assorted facade units will be generated once the colour map is updated.
There is a small pic here above
You can use the same image if you manage to right-click and save it (but why you should?)
Use whatever pic you want, but not too much resolution…
Try move sliders and see if what happens make sense.
Anyway… i’m in a hurry…
Explanation is harder than the definition itself.
But one last thing is that, ultimately I would like to distribute facade of more than 3 types across a surface (so now it is not only RGB anymore); for examples if i am having 8 facade units to be distributed across a surface according to my image sampler, what would that work in this case?
Color detection is not that difficult.
You can always translate the RGB value in a point XYZ and pick the nearest point from a static list, but this is useful only if your colors are blurred or so. (avoid jpg, use png or other lossless format)
If your image is “pure” (not ruined by compressing or other stuff), you can just extract your cases directly from the c# script (my third post).
My guessing is how you will make the starting image if it begin to become more and more complex.