Optimization in grasshopper

Hello everyone,

I was wondering if someone could help me with two files where my professor has told me I need to optimize my code, as I have patterns that are repeated several times. He told me something about cluster.
I would ask that no sliders be touched and no data be internalized either.

Thanks.

Optimization_1.gh (75.4 KB)

Optimization_2.gh (103.2 KB)

Your professor told you to use clusters because you re-use the same piece of code multiple times.

There are three parts which can be put in clusters:

A cleaned up version with data trees could look like this:

As you can see, there’s no need to duplicate the clusters :slight_smile:

Optimization_1_mrtn.gh (48.6 KB)

4 Likes

Nice one. This is what I was going to say - understanding how data trees work makes most clusters and spaghetti code unnecessary.

And an alternative solution using blocks instead of duplicated geometry…

Optimization_11_mrtn.gh (25.7 KB)

image

2 Likes

Optimization 2:

  1. Pipes don’t need to be capped. Use the Caps End option in the component.
  2. You manually orient each ring separately (red groups). Each of the transformations seems identical, so you don’t want to define the same transformation separately.
  3. In Rhino 8 and beyond, you can use the custom curve display component to display thick lines instead of pipes. It is much faster. Enable the pipe component after you found the right setup.

Shift offset 898?

That was the only way I could get all the pipes aligned. I’m sorry for the mess.:sweat_smile:

This definition is using clusters. But somehow I think this is a bit of a complicated approach. As you can see below, I didn’t fix any of the trimming errors.

Optimization_22.gh (53.3 KB)

If I had to do this, I’d use the relative item component. In the 222 file I added my approach for the inner most segment.

Optimization_222.gh (72.4 KB)

Thanks again Martin! this is awesome!