but when it comes to close it there are some problem:
I can’t use rhino.Exit() because i get a runtime binder exception(method does not exist), i can’t use rhino.RunScript(_Exit, fasle) because it waits for an user input to choose wheter to save or not the edited file.
It seems that the only reliable way is to enumerate the process before and after the call to Activator.CreateIntance and see which process is new. Then, you can selectively kill that process.
I’m thinking to do this by another way: since my c# application is a multithreaded rhino automator( and i will have more than one istance of rhino), i will create a “garbage collector” that kills all the rhino process older than X.
If you modify the document in anyway, you will be prompted to save. To suppress the “do you want to save” dialog, then get the RhinoScript object and call its DocumentModfied member. Here are some examples:
Do you have an updated sample file for Rhino 6?
If I am automating opening a new session of Rhino, doing some operations, save and Close the session from my Grasshopper plugin, is this the right approach?
It throws an exception while grasshopper is loading GHPython at startup and stops loading grasshopper:
An exception of type ‘System.Runtime.InteropServices.COMException’ occurred in System.Dynamic.dll but was not handled in user code
Additional information: The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
This probably isn’t enough information for me to help. Where is this code executiing? What the code, overall, do? Can you provide me a ‘simple’ example that I can run here that repeats this?
If I understand correctly, you are in Grasshopper, some custom C# component, and you want to launch another copy of Rhino and have it load Grasshopper? What is it you are trying to do an why?
Yes, I am in grasshopper. I would like to automate running multiple other grasshopper definitions in a particular order (each grasshopper file has its own paired rhino worksession file) from my grasshopper component.