Script to open specific Rhino file

Hi,

I am trying to build a script that will automatically open a specified Rhino file.

Since you can now launch a grasshopper file, I’m looking for a way to embed a path to the corresponding Rhino.

In Python I have tried using Rhino.RhinoDoc.Open() and this works. However, once the new file is open the canvas is locked in a strange way. I cannot move around except via zoom and i can’t interact with components.

I haven’t found any resources so any help would be appreciated.

I attempted to use rhinoscriptsyntax.Command(“Open {0}”.format(filepath)) and it does the same thing.

I also get a python expired during a solution error.

Is this a result of the of the canvas solution and i need to expire the component in someway?

I think that it may be a similer issue to the one described here

I am not able to activate anything on the Grasshopper Canvas. I can zoom, save the file, etc, but I cannot actually pan or do anything with the mouse clicks on the canvas

This also seems to have the same problem using a C# component with Rhino.RhinoDoc.Open()

Hi Nathan, if you upload your implementation, that helps tremendously with troubleshooting.

ok, I do seem to get this to work if i add a dataDam in between the bool and the script.

it works for both python and C#. any ideas what causes this? I suspect that it has to do with how the canvas works and the solution state vs being expired works. Any insight into this would be good.

Hey @AndersDeleuran

Thanks for responding. here is the two version I’m playing around with. Open File.gh (6.1 KB)

Even using the Data Dam I get some strange results with the canvas solutions. Any help is greatly appreciated.