Unable to use RhinoApp.RunScript() in c#?

Hi everyone! I am very new to writing c# for rhino. I intend to open some dwg files in rhino and make similar changes to each one of them. But when I tried the first step using RunScript(), nothing happened.

And I noticed that if i copy and paste the example for this method --In this case is //Rhino.RhinoApp.RunScript("_-Line 0,0,0 10,10,10", false)-- and run, still nothing happened.

The only thing this method do is when i set the echo to be true, the first param of RunScript() shows on the command line.

Is there anything wrong with my rhino? Or am I using this method in a wrong way?

It would be a great help if anyone can give me some clues.Thanks!


Rhino.RhinoApp.RunScript("_-Line 0,0,0 10,10,10", false);

does work in grasshopper.

The problem is probably elsewhere. Either your string (path) is not acceptable by the command or there’s something wrong with your project.

:wink: I’m not a fan of csharp so this is as much as I am able to help.

Why don’t you try r"C:\Users\zvmj\Desktop\test_dwg_file\Dim_F1.dwg" instead?

Now I saw in csharp it is with @ not r

another option is instead of setting the string like that invoke a file open window.

Hi @1912351430,

Please review:

– dale


Could you add a complete working example to that article. For beginners (like me) this article is unclear.

Here you go:


– Dale


@dale Thanks! That example really helps!:heart:

@ivelin.peychev Thank you for your reply! It turns out that I should set the scriptrunner mode in the first place.