Generating Geometry of a GH file from within a python script

Hey there Rhino & Python experts!

Im pretty new to rhino and grasshopper, but hopefully you can help me with a pointer into the right direction. If this question has already been answered here in a discussion and I have overlooked it, I would love a link to that as well.

My question is the following:
I have an existing GH file that has some parameters/inputs (mostly int-numbers) and generates a geometry based on them. That works fine and I am super happy with it.
Because its really important that everything goes smoothly, I want to automate the generation of a lot of combinations of those inputs and get the corresponding STL file to it, in order to perform some quality checks and then use it as part of another production pipeline.
So in short I want to provide input parameters and generate the STL file from within a python script, in order to use the STL in my pipeline afterwards.

I guessed that this is possible, but im a bit lost when it comes to where to start really.

Can you give me some context on if this is possible and where I might start looking?
Do I need a compute server for this? - Is there a python package that I can use to load and execute a GH file? Can I use Rhino/Grasshopper from the command line to produce the STL?

Best,
Lukas

Hallo,

I think it’s a bit generic to answer, but first of all:

In V7, you can automatically run Rhino and Grasshopper scripts from command line, and of course you can export to STL. But you need both. You can also setup a rhinocompute server or you can use a web service like Shapediver. There are costs involved.

Depending on your knowledge, I would find out if this automation is really required, and if so, is it necessary to use the Rhino/GH pipeline for this. As a developer, creating or modifying meshes and writing STL or OBJ files is easier than you would expect.

Maybe you provide an minimal example here?!

Thanks so much for the reply and I will for sure check out the links provided!
The use case is generating simple medical aids (for example after a broken arm or a simple prosthesis) based on a few measurements that customise a model that is programmed in Grasshopper. The task of generating a lot of models is needed to assure quality and provide security that all input configurations are leading to a valid output / mesh / STL.

Im a somewhat experienced developer coming from mobile development and data engineering, but am eager to support a friend who is doing the heavy lifting in Grasshopper.
So my task would be to take the GH File and generate a lot of STL files based on different inputs within a python script. Those can then be checked for validity and quality with some other automations I already partly built :slight_smile: - So in short, the GH model/file is already done and a fixed part of the plan.

I will look into your first point, of running scripts from the command line, but it sounds like its not out of the box what I hoped for. My hope was that there would be a way to access/open and execute a given GH file, either via the command-line or via a python package (other programming language would also be fine tbh) so that I can integrate this into the pipeline.
Costs, as long as they are moderate, are not the big problem as we are exploring what is possible for now.

Is Shapediver useful for automating this task? - Optimally I aim for loading the GH file dynamically and exporting different models as part of a production & quality pipeline.

I hope this makes sense, Im super thankful for pointers and will now go and read all the links carefully :)!

Lukas