Can I make a component out of repetitive script?

Hi, for a particular project, I tend to keep using the same set of script with new variables. How can I simplify this to make it into a single component with the variables as inputs? (I’d rate the script 6/10 to give idea of length).

If that’s too complicated/not possible what could be possible alternative solutions?

Make a cluster

But won’t that limit my inputs to the component at one end of the cluster then? I have a couple of inputs in the later part of script as well!

Is there a work around to this or will I have to make multiple clusters?

I guess I don’t understand what you mean. Can you show an example?

Ok so I have made this script that totally takes 3 surface inputs from rhino. It’s made such that 2 surface inputs are connected to a component in the beginning and the 3rd one is connected to the script mid way (say 5th/6th component).

Now I want to condense this large script into something small so that I can easily keep changing the 3 surface inputs.

Will this be possible with a cluster? From my understanding I think i’ll have to make 2 clusters here instead of just one. (2nd one when there is the new surface input midway though the script).

You can make one, cluster inputs can be going anywhere in the script.

1 Like

Oh great! Thank you :slight_smile:

Hi -

In Rhino 7, you could adapt your Grasshopper definition to allow it to be run with the GrasshopperPlayer command from within Rhino. One step on from that, you can use the Rhino 7 script compiler to turn that Grasshopper definition into a Rhino plug-in.
-wim

Hi! Thanks for the reply.

Was just wondering, does the grasshopper player command take into account the initial geometry that was fed into it from rhino? Or will it work more like a bake command?

This one sounds like a serious advancement if it does indeed take into account of the initial geometry. The plug in also sounds quite good tbf.

Hi -

image

There are components that you can use to have the definition ask for user-input when it is run with GrasshopperPlayer.
-wim

1 Like

How can I make this cluster with the same inputs, which I used in the main grasshopper script?

Or can I do this with a python script?