I’m writing a C# script that needs to run a grasshopper graph. It works when I manually open the grasshopper document before running the script, but I want to be able to open it automatically.
However, I’m getting weird error (“object not found”) when loading from C#. However it works from python script with the exact same code:
#Load Grasshopper Plugin as gh
gh = Rhino.RhinoApp.GetPlugInObject(“Grasshopper”)
C# code (after including Grasshopper.dll as reference):
Grasshopper.Plugin.GH_RhinoScriptInterface grasshopper = (Grasshopper.Plugin.GH_RhinoScriptInterface)RhinoApp.GetPlugInObject(“Grasshopper”);
I get this in C#, but it works in python:
This is the graph I’m trying to load:
ladybugtexture.ghx (68.9 KB)
What could be the reason for the difference? Does the working directory (or anything of that kind) change while running a plugin?