I can’t get Rhino to runscript
via subprocess.Popen. It opens the file correctly, but doesn’t run any commands. It works fine when run from cmd prompt. Also doesn’t work when run from Cpython. Why does Rhino behave differently when opened via this script than if the same command is run from windows command line?
I’m trying to automate rhino to run scripts on multiple files. I’d rather spawn multiple processes than iterate one by one through each file with a single process.
I vaguely remember a similar problem when trying to automate AutoCAD - starting a batch file worked instead. Is this a MS-Windows specific issue?
import rhinoscriptsyntax as rs
import subprocess
import System
dlg = System.Windows.Forms.OpenFileDialog()
dlg.Multiselect = True
if dlg.ShowDialog()==System.Windows.Forms.DialogResult.OK:
selected_files = dlg.FileNames
#attempt 1
for selected_file in selected_files:
subprocess.Popen(["C:\\Program Files\\Rhino 8 WIP\\System\\Rhino.exe", "/nosplash",
'/runscript="-RunPythonScript (C:\\folders\\script.py) save exit"',
selected_file], shell=True)
#attempt 99 https://tenor.com/view/possum-opossum-mad-angry-gif-13439507
for selected_file in selected_files:
subprocess.Popen(["C:\\Program Files\\Rhino 8 WIP\\System\\Rhino.exe", '/runscript="save exit"', "/nosplash", selected_file], shell=True)