I’m writing a console application in C# to automate Grasshopper scripts and Rhino Commands using Rhino.Inside. Automating GH scripts works like a charm, but I’m struggling to get the RhinoApp.RunScript(script, false) to work. Looking at some threads around seems to get it to work with the added class attribute [CommandStyle(Style.ScriptRunner)], but most of these threads are with plugins and not Rhino.Inside.
As you can see in the screenshot I’ve tried the same function in Rhino Python Editor and it works as expected.
How can I make this method work with Rhino.Inside?
As a sidenote I’ve also tried with Rhino.RhinoApp.ExecuteCommand(doc, script), but this method can’t execute a line of script as I understand.
RunScript requires the existence of a RhinoDoc which by default is not created with a “headless” console application. You may need to create a doc and set it as the active doc.
As you can see in the screenshot in post 1 I’ve created a headless rhinoDoc. Did also try to set it as the active doc, but that’s commented out. I can try again of course.
I’ll need to get everything set up in a debugger to be able to give any clear answer on what is happening. We probably just never tried to get RunScript working in a headless environment.