Optimization of code and a couple other issues/questions



Hi guys,

I’m pretty new to Grasshopper, on the bright side I’m an intermediate user of Rhino and I also know this and that about mathematics, so GH is pretty logical to me. However, I need your help for a couple of thingies.

My gh code:
pattern.gh (60.2 KB)


I defined parametrically a triangle which I then smoothed out

to become more like a blob shape. After that I created a pretty simple pattern
that I had in my mind (costed me a lot of time to make this in GH) and finally wanted to rotate each element as it goes higher . The dispatching part seems to be working pretty slow, so it might need an optimization, but I’m still happy with the result as it shows exactly what I wanted, so this is a minor issue in my case.

I then decided to try tessellating my extrusions. You’ll see the voronoi script which is a blob-group in the same Pattern.gh:

I had an idea of something and started the code from scratch, then decided to watch tutorials and implement the code shown there. I somehow coped to combine my code with this in the tutorials, but since my knowledge of Grasshopper is zero to basic my code seems to be very unoptimized and lagging… When dragging the sliders, it takes a lot of time to compute the changes, although, I’m working on a 24gigs 6th gen i7 machine. It might also need optimization.

Here comes the first tricky part that I couldn’t sort out in an elegant way neither in Grasshopper nor in Rhino. I want a smooth transition

between the wall and the ceiling, so that the voronoi tessellation doesn’t get interrupted. If I was to do it in Rhino I’d make a curve with a filleted edge which I’d then revolve/sweep along a rail.


Second thing is – I’ve defined a shape which I want to rotate at a certain degree as it goes higher, however, I don’t have the knowledge to make this happen automatically and just copy the script over and over again. Is there a chance to somehow “loop” the code and parametrically define the degree of rotation and amount of units in the loop?

Next thing is I want to somehow be able to rotate each “6-storey-building” dependently on its surrounding buildings, so that their “terraces” never overlap. I’m using quotes, since they’re still some silly shapes that have nothing to do with buildings and terraces. The principle has to be something like gear wheels or the so-called rack wheels

. There has to be some pace which I could set parametrically, but I’m still unsure how to do that in Grasshopper.

The pre-last thing is that I want to control the height of each “building” based on let’s say a topography. I presume this could be done somehow with height maps or some gradient mapper connected to curvature analysis. Not really sure how something like this would work, but I’ve seen such codes that control height depending on a variable.

The last one is more or less similar to the previous. I want to be able to “dissolve” the pattern that I initially created and make it irregular. I suppose this could be done with attractor curve, but again this is just a guess. Please note that this is a top view and the shapes on the upper-left corner have got more “wings” which means there is more floors in the according building. Let’s say the buildings in the upper-left corner are 6-7 floors high, in the middle are 4-5 and to the right they’re only 3 floors high.

Sorry for that many questions in a single thread. Please let me know if I have to split them in separate threads. All this information is needed for learning purposes. I’m now preparing myself for my bachelor thesis and try as much things as I could, so that I’ll be ready for the final stage of my bachelor’s degree.

Many thanks in advance! Cheers!