How to modify parameters of a Rhino and Grasshopper file from a Batch file

Hello guys!

I’d like to take control of my Rhino and Grasshopper file from a Batch file, like:

I have that one, from a Batch file after run, I’d like to change the Radium, Height and the number of Lattices in 3 directions Before start Rhino and Grass, could you help me please?

My Batch script calling Rhino and Grasshopper:

@ECHO OFF

cd C:\Users\Calcul-port\Documents\Stage_2019\Rhino\Automatisation_Rhino_Script\Results

“C:\Program Files\Rhinoceros 5.0 (64-bit)\System\rhino.exe” /nosplash /runscript=“-grasshopper editor load document open C:\Users\Calcul-port\Documents\Stage_2019\Rhino\AutomatisationRhino_Script\Results\essais.gh_save _enter” “C:\Users\Calcul-port\Documents\Stage_2019\Rhino\Automatisation_Rhino_Script\Results\essais.3dm”

exit

In this Batch file I would like to add too the values ​​I want to take control when I start the program

essais.gh (9.7 KB)

essais.3dm (17.9 KB)

Thanks

I do not have a direct solution, I didn’t even know it was possible to launch grasshopper from a batch file.

From the same batch script you could create a text file with all the values you need in a fixed location on your pc.
Then your gh solution, when opened, will automatically load that text file and read the values.

Should be not that much hard to do, tell if you need help in that.

1 Like

Hello Riccardo!

If you say from the same Batch scrip we could create a text file with all the values we need, that interest me and maybe could be a solution, so yes, I would like some help please!

Show me how to do it!

2019-04-03%2012_44_26-Window
test.zip (14.1 KB)
I’ve used Rhino 6 path to test it, you might need to change it again.
Cmd windows doesn’t exit until rhino is closed…

Result:
2019-04-03%2012_43_16-Window

batch code:

@echo off
:: Setting values to write in the text file
(
  echo Hello world!
  echo 10
  echo 18
  echo 7.8
  echo Bye!
) > test.txt
cd %localhost%
"C:\Program Files\Rhino 6\System\Rhino.exe" /nosplash /runscript="-grasshopper editor load document open C:\test\test.gh _save _enter" "C:\test\test.3dm"
exit
2 Likes

Ok thanks! it’s working now and Mr.Riccardo, if I want to take control of values from test.txt and not test.bat file it’s always possible??

How can I do it ? I just move the echo from Batch file in the test.txt file??

Thanks

I have creat a new text file like commande.txt with somme values, and in Batch file I’d like to cal this file.txt and run Rhino/Grassh after but the problem is when I run I see nothing on my cmd, maybe the syntax it’s not good! Can you help me please.

here are my file.

test.zip (22.4 KB)

Thanks

If you want to just pick values from a txt, then don’t make thing more complex…
Use Cmd to start rhino and gh as you did in the first post.
In the gh file always load your “commande.txt” file and pick the rows you need.

Ok thanks Riccardo,

I will try to do your solution and I’d like to know, if it’s possible from the Batch file after run to give a STL, STP model, I want to automate my Batch.

I already know that in my Batch file I have to create a storage folder where I could keep the models in these formats, then in grasshopper add some commands for the Bake function to run alone after the Batch and save it!

Can you see the problem!

Thanks!

If you are creating a series of 3D model files, just try to export them.

It is possible to automate the process I believe