Can Rhino.Interface (COM) filter when running multiple Rhino processes?

I am trying to use COM to open a selected 3dm file in an existing Rhino instance. Is there any way to filter the list of existing Rhino processes? I’m trying to get a Rhino process without any file opened (e.g. titled “Untitled”).

I realize that this is Cpython, but I didn’t look yet for a way (or if it’s possible at all) to create COM objects from ironpython.

import win32com.client as win32

a = win32.Dispatch("Rhino.Interface")
a.RunScript("Open" + chr(34) + "file-path.3dm" + chr(34))

EDIT: documentation says no:

this documentation ?
rhinoscript, external access:

this would happen if you start a new rhino-process with the Rhino.Application (Object).

Why do you want to use an existing Rhino process and than open a file / template inside this process ? instead of starting a new Rhino Application, and open the there ?

what s the overall workflow / task ?
Are you sure the (maybe a bit outdated ?) COM interface to rhinoscript is the right choice for your workflow ?

1 Like

Thanks, starting a new rhino process takes about 10 seconds while “pooling” processes makes it instantaneous. It makes a huge difference in a workflow where you have a lot of small external (li ked) blocks and you switch between them frequently.

COM seemed like an easy solution, but perhaps instead starting an http python server in each of the rhino processes in that “pool” that would listen for “open” request could work?

I’m also wondering if it was possible (and allowed by Rhino’s licence) to inject a .net dll into rhino process to add an extra interface?

did you have a look at rhinocommon ?

you can code a plug-in that runs inside rhino and extend / modify the functionality, interface, …

Thanks, I’m aware of the rich functionality Rhino provides inside its process, but I’m not so sure of how to interact with Rhino processes outside. I was hoping that COM might be a way to do that correctly, but otherwise setting up a listening “server” inside them (when they are ready to become “daemonized”) and calling one of them from another rhino process when it needs to open an external block doesn’t sound like a bad strategy?

In general, Im wondering if this could be used in other heavy GUI applications, as well? I think that some other programs get around it by opening new “tabs” instead of windows, but given that my Rhino 8 WIP crashes now on average every 30 minutes that’s not a bad way to go about it unless I am not aware of some way Rhino might prevent python script/rhinocommon plugin from blocking the process for that long?)

How about Rhino.Inside CPython?

— Dale

Great, thank you. I haven’t thought about that. This should work fine I think (I’ll update the script here soon)