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 
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)

2 Likes
That was the only way I could get all the pipes aligned. I’m sorry for the mess.
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!