I have the following batch script:
"C:\Program Files\Rhino 7\System\rhino.exe" /nosplash /runscript="-grasshopper editor load document open C:\BPP_pipeline\snowflake_definition\latest.gh" "C:\BPP_pipeline\snowflake_definition\blank_mm.3dm" >> log.txt
I need to translate this into powershell. I am having trouble with the runscript part. I am having trouble finding documentation as well. This is what I have so far:
& "C:\Program Files\Rhino 7\System\rhino.exe" --% -nosplash -runscript="-grasshopper editor load document open C:\BPP_pipeline\snowflake_definition\latest.gh" "C:\BPP_pipeline\snowflake_definition\blank_mm.3dm"
dale
(Dale Fugier)
November 17, 2021, 12:47am
2
Hi @stevescott517 ,
Rather than running a bunch of commands at once, via the command prompt, I tend to have startup scripts that run a Python script. For example:
"C:\Program Files\Rhino 7\System\Rhino.exe" /nosplash /runscript="_-RunPythonScript (C:\Users\Dale\Downloads\Test.py)"
The Python script, which just runs Rhino commands, could look like this:
# Test.py
import Rhino
Rhino.RhinoApp.RunScript('_-Open "C:\Users\Dale\Downloads\Test.3dm"', True)
Rhino.RhinoApp.RunScript('_-Grasshopper _Document _Open "C:\Users\Dale\Downloads\Test.gh" _Enter', True)
fwiw…
– Dale
nathanletwory
(Nathan 'jesterKing' Letwory)
November 17, 2021, 7:15am
3
@stevescott517 to do a useful /runscript
through powershell you need to use Start-Process
, use the -ArgumentList
option and escape the double-quotes with backticks.
This works:
Start-Process 'C:\Program Files\Rhino 7\System\Rhino.exe' -ArgumentList "/nosplash","/runscript=`"Grasshopper`""
See Start-Process
documentation for reference.
1 Like