Launching my plugin more than once in MacOS?

Hi Guys,

With my kite design plugin, (written in GH and compiled with the Rhino Script Compiler) I use a Python script as ‘pre-launcher’ to set up the Rhino environment before launching my plugin itself via a hidden command.

Part of what I do is check to see if the plugin is already running within the current Rhino - and then exit with a warning if it is.

I’ve just run into this issue:

On Rhino for windows the user can open a second copy of Rhino and open my Plugin in the second copy of Rhino with no issues.

On MacOS you don’t actually open a second copy of Rhino, just another window within the same Rhino. Trying to launch my Plugin in the second window Rhino reports that my plugin is already running (which it is in the first window) and will not open.

Is there a best practice to to handle this situation in Rhino on MacOS? How can I apply my plugin to one Rhino window only?

Cheers

DK

It looks like you’re trying to do something that is not supported by the plug-in system. What exactly is set in this “Rhino environment” and why is it needed?

Would it be an alternative to set up the environment on a document level, where the one loaded plug-in can handle multiple documents?

Hi @menno

I’ve sent you my launch script on a DM.

But the process it does is pretty simple:

  1. Checks the sticky dictionary to see if the ‘is running flag’ was set by this same script in this Rhino already - gives a warning to the user and exit if it has been set.

  2. Setup the current Rhino document to mm units and 0.1 tolerance

  3. Check which OS Rhino is running on

  4. Depending on the OS go to the install folder of the plugin and check an ini file

  5. Launch an ETO window with a please wait/loading message

  6. Launch Grasshopper

  7. Launch my plugin via a command

  8. Set the “is running” flag in the sticky dictionary


So on windows, no problem, the sticky dictionary is not shared between Rhino instances.

On MacOS, every Rhino ‘window’ can read the sticky dictionary and knows the plugin is already running.

How would it be best to tie launch of my plugin to a Rhino window in MacOS?

I do need to avoid my plugin launching twice in the SAME window.

Cheers

DK