I’m trying to run some Rhino command scripts from a DOS prompt, where I exit Rhino after each script. I’ve tried putting the Exit command in either the script I run or the command prompt but neither work. They show up in the command history, but don’t actually do anything. If I manually type exit it works fine.
I’m using the latest version of Rhino 6, at least as of writing.
The reason for exiting and starting Rhino again is that each script maxes out the RAM on my system and Rhino doesn’t seem to clear it any other way (such as create new file etc).
Agreed it would be nicer, but _ClearUndo is making no difference. I only tried 2 scripts but the memory usage continued to build up on each. I tried the command manually after it ran the scripts, but that made no difference either. When I closed Rhino afterwards the memory usage went back down to its starting position.
Might be worth saying that the scripts read in a point cloud, move it and save the Rhino file. The memory usage goes up during the move and also when starting a new file and importing the next point cloud.
I am having the same issue, calling Rhino from a python script. The main Rhino command is ReadCommandFile, which works fine, but at the end of my command file I added an _-Exit which does not work.
The Rhino prompt asks if I want to save changes, but whatever I do at this point, either manually or from the command file does not change anything. In other words, if my command files ends with “_-Exit\n”, even clicking Yes or No in the prompt (cf picture) won’t have any effect.
Although I know there are workarounds (and I don’t have to programatically close Rhino), I am curious as to this behavior.
Let me specify the problem a liitle better.
I use a python subprocess to:
Run Rhino
RunPythonScript to:
a) Run a grasshopper file that changes and bake the new geometry.
b) Save the new rhino object as a 3dm file. (File successfully saved)
c) Exit Rhino (as you see in the commands, the command Exit (or _-Exit) is written
but never executed). SO RHINO REMAINS OPEN.
I Have tried —> rs.Exit(), rs.Command(“Exit”),rs.Command("_-Exit") inside RunPythonScript and even -Exit command but NOTHING works.
When running the PythonScript inside Rhino, everything works perfectly.
But when using an external python and a python subprocess to open Rhino, the problem appears. I have attached some py files above. If you have time, you could try ro run subprocess.py to see what is happening. (only change the paths)
Dear David Andres Leon,
Unfortunately, I did not manage to “exit” Rhino using an external python(opens Rhino and runs a rhno python script) . Even if the command is written in the command line of Rhino, it is not executed. If you have time, could you please make a try with the files that i attached below. ? Thanks in advance! The files are some comments above…
I am also very (to say the least) interested in seeing that working.
I am not currently able to fully automate the use of Rhino from Python since Rhino will not close.
Here is a simple text file that I drag & dropped into my open Rhino application, with the results.
I had various attempts at this, none working when there is a file involved (the Exit command will work when typed directly in the Rhino command line).
Notice that when typed directly in the command line, ‘_-Exit’ directly closes the application.
However, when scripted (through the text file), the “Save changes […]” appears.