generative modeling for Rhino
I am trying to find where in Grasshopper I can Run or Record Macro? Can I use the Runscript in Rhino for running the macro in Grasshopper?
I would be appreciated if anybody give me some information.
p.s. My goal is linking the GH to another program, so I need to find the answer of my question.
what exactly do you mean by a Macro? A collection of steps like:
1. Create a new Circle component
2. Create a new Extrude component
3. Connect Circle component output with Extrude component input
4. etc. ?
Thanks for your reply.
I would need to be able control Grasshopper through an API using a script language like Visual Basic, or run Grasshopper from a Windows command prompt. If it is possible to control Grasshopper from an external source, then I can apply it for my other program.
Thanks for your help.
I can mention that I need to control some parameters in Grasshopper from an external tool and run in batch mode to update. The parameters could be dimensions or variables. If I can supply these parameter values to grasshopper, then run a command or script to update the geometry using these new values, that is all I need for my other program.
Some examples could be
- have the script or command read some values from a text file and execute grasshopper
- have grosshopper read values from excel and run as VB macro
- they write an API code that can read values from text file and execute grosshopper
It will be more like changing the radius of an existing circle rather than creating a new circle.
I do really appreciate any help.
In principle all of these things are possible, but I haven't coded up any wrappers that would allow such a granular access.
You will need to write something (a GHA project) that runs from inside Grasshopper and which is capable of receiving external commands. You could supply a class that implements the Grasshopper.Kernel.GH_AssemblyPriority interface. This class will then be constructed and called before anything else happens and it will allow you construct your 'listener'.
Once you're running inside Grasshopper, you are free to query documents, objects inside documents, the values of objects inside documents. And you can also change components, parameters and wires.
It sounds like a pretty big project though, and I won't be able to help much as my holiday starts tomorrow and I'll off the clock for a month.
Thanks a lot David,
Could you please give me a simple example that implements this. Or if you could point to one in the user manual I would be appreciated.