How to load Rhino Script File using C# API (Rhino 5)

Hi @dale

There is any option to load Rhino Script file(.rvb) using C# API?
Rhino 5


Hi @Sarath_Kithiyon,

The only thing you can do is script the _-LoadScript and _-RunScript commands using RhinoApp.RunScript.

– Dale

Hi @dale,

I have tried _-LoadScript and _-RunScript commands, It shows cannot find script file,

Command: -LoadScript
Script file to load ( List ): <D:\Sample.rvb>
Cannot find script file <D:\Sample.rvb>

Hi @Sarath_Kithiyon,

This seems to work:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  var fname = "C:\\Dev\\Test.rvb";
  var script = $"_-LoadScript \"{fname}\"";
  RhinoApp.RunScript(script, false);
  return Result.Success;

Make sure your command has the Rhino.Commands.Style.ScriptRunner attribute.

– Dale