Extrude different elements to random heights with grasshopper

Hi there,

I made a pattern where I have different voronoi cells that i want to extrude to heights between 0.8 and 4 mm. I want to assign the extrusion-heights randomly. While this should be super easy, I cannot figure it out.

Sometimes I get a result where I see different extrusion heights, but I don’t seem to have enough random values for all my elements so that most of them eventually extrude to 4mm.
Then i get results where all elements are extruded to all the heights resulting in many many surplus elements. I want each element only extruded once. and the different extrusion-heights assigned randomly and to all the elements. multiple times if there are more elements than extrusion-heights.

I chose 16 steps becuause I want to 3d-print this pattern and the height of a layer is 0.2mm.

2023_03_15_voronoi_pattern_random_extrusion_heights.gh (15.7 KB)

Hi,

Here it is.

Since you want random values with a fixed step, the easiest thing to do is to have random integer values, and then map those integers to the actual domain.
0.8 to 4mm with step = 0.2 maps back to integers 0 to 16.
The Number is the amount of random values required.

2023_03_15_voronoi_pattern_random_extrusion_heights.gh (23.7 KB)

Thank you @magicteddy this is exactly what I was looking for. I am already printing the design. thank you so much for your help.
I had one more question as I prepaired this sample for the print: is there a way to extrude and then also chamfer the edges of the extruded pieces in grasshopper? i know how to do it manually in Rhino, but it is many edges and takes a long time to do it manually. If i could do this in Grasshopper that would be perfect.

Yep, you can use Fillet Edge component, it has a Chamfer option. It also requires the list of edge indices on which to apply chamfers.

There are however some pieces that have very small edges and that leads to errors. I used Polyline Reduce to remove those, but it changes some shapes a bit.

2023_03_15_voronoi_pattern_random_extrusion_heights_chamfers.gh (18.4 KB)

Perfekt. Thank you