How to map a set of different geometries to different values on a surface?

Hi all,

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!

2019-01-14 point mapping with (25.5 KB)

Hi and welcome to Grasshopper!

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.

2019-01-14 point mapping with (30.8 KB)

1 Like

Hi Riccardo,

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.

I hope the concept is not too confusing? :-/

Those are entirely different questions; best to search a bit, give it a go, then start a new thread particular to your issues.

Here is a plugin that is made for generating facade layouts – especially useful if its going to fabrication eventually.

1 Like

I don’t know if this is useful, i did it anyway… (haven’t read yet your replies) (11.3 KB)

(Sadly a path is not any data other than the string itself … otherwise i would have internalized the great Jim)

This transform any image file (.bmp .png .jpg) in a list of colours(0-255) starting from bottom row.
Used a mesh with -1 in sizes to correctly use the colours per-vertex (instead of per-face).

1 Like

I’m not sure if i got you right… (81.2 KB)

:point_down:There is a small pic here under
:roll_eyes: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.

Edit:internalized breps in .gh file

1 Like

Hi Riccardo,

Thank you for your reply!

I have yet to try out on your script as I have moved to some other tasks at the moment.

But I have appreciated your help and the humour ahahhaahah

Hi Riccardo,

Not sure if you are still up to solving this problem,
but basically I have almost achieved the image I wanted with your scripts!
(they are super useful, mega life saver)

And right now it looks like this :point_down:

2019-01-23 point mapping with composition_re (1).gh (28.5 KB)

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?

Thank you so much :raised_hands:

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.

Anyway, it is even simpler than before…

2019-01-23 point mapping with (30.5 KB)

If you want to add elements, add their geometry to the first merge and the corrispective color in the second merge.
(Avoid similar colors, obviously.)

1 Like

Super helpful, You are amazing!!

Thank you so much, appreciate it!