I’m trying to open a GrassHopper definition via a menu button, and via an Alias/PythonScript, and in all cases it does open GrassHopper, but but not the “hard coded” GrassHopper definition file. Why not?
import Rhino import scriptcontext import rhinoscriptsyntax as rs def RunGHDef(): Grasshopper = Rhino.RhinoApp.GetPlugInObject("Grasshopper") if not Grasshopper: return False Grasshopper.DisableSolver() filePath = "D:\gh\my_grasshopper_file.gh" Grasshopper.OpenDocument(chr(34) + filePath + chr(34)) Grasshopper.ShowEditor() if __name__=="__main__": RunGHDef()
From a Menu button I try the following, but same there, GrassHopper starts with an empty canvas, but the GH definition files does not open, although this time the file dialog opens, displaying the last opened folder. But, when I select the gh file file (using the open dialog) it still doesn’t open the file :
The following is displayed on the command line after selecting a file to open:
Unknown command: "D:\gh\my_grasshopper_file.gh"
What am I doing wrong?