I’ve been searching online and couldn’t find any information on this.
Is there a way to launch a GH script and manipulate it from outside GH environment?
Objective would be to write a matrix of values as s CSV or excel and loop through the matrix, update GH variables and press the buttons that exports geometries.
if it could be done from outside rhino it would be even better, hopefully faster as well.
I have asked this question before. There is no easy way to control grasshopper from other clients. You can use macro. But the better way would be rewrite your script so that each script generates a csv, which is than read by another script.
But the buttons have to be pushed by humans
I can’t fully answer this, but I have an idea that may help?
You can save Grasshopper files as
.ghx rather than
You could then parse and update these xml files. Given that each component has a GUID it could be quite safe to find and update.
I’m not sure I fully understand what you’re trying to do. Are you wanting to modify the grasshopper file itself outside of the rhino client? Or do you just want to be able to send different parameters to a grasshopper file and get some information back without using the Rhino/Grasshopper client? If it’s the latter, you should be able to use rhino.compute for most of that. Have you looked at the AppServer?
I was thinking of an external Python script that launches Rhino on the background, reads a csv or a json, updates sliders/panels/buttons etc and gets outputs from the grasshopper script.
this way I could do batch export of geometries, from an external python script, without ever opening Rhino or the GH environment.
Ah. ok. Yes, I think your proposition seems possible. It may even be easier than you think If you have a Hops component that has a referenced grasshopper file, you can right-click on the component and go down to the bottom of the menu and select
Export Python Sample. This will basically create a python script which (when run) will automatically load up the referenced grasshopper file and send it to the rhino.compute server. From there, you can edit the code further to modify the input parameters or add other methods for importing data to update the parameters. But, I think this might get you most of the way to what you’re trying to do. Let me know if that works or if you still run into any other troubles.