Improve GH script: How to better organize it

I am working on a script to make a drawing like this.

to do this I am only using GH components, no coding (C# or python).

I would like to share this work with you to understand how to solve and develop it with better logic. To make simple steps I used many components.
I have divided the design by steps, the ones I would do it by hand. This is the first step
assonometria (21.3 KB)

As I proceed, however, there are small problems and the definition becomes more and more complex to manage and order.

This is the script with the second step:
assonometria (44.8 KB)
It works, but only for certain inputs. I probably have to change the logic of some steps. In the image below you can see the result.

I wanted to ask a few things in particular:
-how can I better manage inputs and outputs that are repeated and used several times in the same definition.
-how could I create annotation points for each entity I am going to create (lines and points) so that they can be easily identified in Rhino?

Your script looks very organised!

Telepathy is a great plugin for this. It allows you to reference parameters across a script with a simple naming system, where parameters given the same name will receive the same inputs.

As you have already done, it’s best to organise your script into discreet groups of logic. This helps with bug finding and script-reusability. Then you can use telepathy to connect between these groups. I would also highly recommend the plugin Autograph for the shortcuts it gives you to add new parameters ‘upstream’ and ‘downstream’ of components.

Also, mastering Grasshopper DataTrees is very helpful for reducing complexity in scripts (however I can’t see it being as useful here).


Thank you @Patt ! I had heard of telegraph, but never of Telepathy. I’ll give a look to both plugins!
Do you know any tutorials about these? :smiley:

There is a good tutorial for Telepathy on the download page that I linked. It is by one of the plugin creators.

I’m not sure about Autograph, it’s very powerful but I don’t use many of it’s features. The main shortcut I use is: select a component in your script and press Alt + Left Arrow (Or right arrow) to insert a parameter downstream.

What sort of annotations did you want to create? Annotations within grasshopper, or within the Rhino Viewport. For printing, or for viewing in the model only?

Hi @Patt
I tried to use telepathy as you advised.
Do you mean like this? take a look.

assonometria (39.2 KB)

What I did was to collect all the elements I am interested in displaying on one side, so that I could collect them in groups and be able to activate/deactivate their display on rhino as you see here:

I’m not sure it is so straightforward. I had to pay a lot of attention because it’s easy to make mistakes (I used to double the output) Or anyway, it doesn’t change much from how it was before.
Perhaps you meant differently?

I want to create annotations within grasshopper i can see in Rhino viewport like these.

Here i baked the objects and created them manually in rhino.

If i change parameters i want they follow the objects in some way. Is it difficult to do?

Anyway i have 2 bugs in the script.

  1. (small bug) there is a group here that doesn’t really exists :sweat_smile: :face_with_raised_eyebrow:

  2. faulty script logic
    as long as the point is above the horizontal line, it works

when it crosses the intersection and is ‘below’, it should change the direction of the arc, and be like the red arrow, but instead remains the same. ideas on how to solve this?

I’ve had a better look at your script, that is a neat method to control visibility - a bit complex through. What I would normally do is just collect the outputs to a custom “Display” component and filter which parameters I want to pass through. Your solution is also fine though, and everyone solves some problems differently. I think there is no right or wrong way.

Having looked at your script, I think you have separated and labelled almost every step. This may help you stay organised, but for me, I would find it would slow my scripting process down and actually add to the complexity - but it all depends on the logic of your script and process.

I’m afraid I don’t understand the logic of the script too much because of the language barrier, but I have been able to make the change you requested by using a different ‘arc’ component.

This is seems to be the group with the main title.

I would use the Elefront plugin to create ‘text dots’, using this component;

Here are the quick changes I’ve made;

assonometria (47.8 KB)

1 Like

Hello @Patt
thanks for the solution, I followed your advice to visualize texts.

I still have to find the right workflow. I think you have to find a middle way between grouping the various steps together and dividing them up as much as possible and sorting everything.
In the first case you do it faster, but then you risk not understanding what the script is doing. (I have scripts that I had done like this and in fact I can no longer follow all the various parameters) In the second case everything is tidier, but it takes quite some time.

Here I put the result. I translated the steps into English so I hope you can follow better.
When I find some time I will try to develop the sequel.

parallel (60.6 KB)

in your solution for the display of elements there is a small problem, but I don’t know how to solve it.

This way it works, but you can’t quite manage the order of the connecting objects.
Here in particular I noticed that dot K and right m are reversed. I think because they do not match the order in entwine.
I don’t know why, but evidently the Connected-ListData block doesn’t maintain the order in which the objects are inserted.