How to run rhino commands in plugins

%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190409171600 %E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20190409171610
why it makes a mistake?

Hi @1351648725,

Look closely at this line:

RhinoApp().RunScript(L“_-Line 0,0,0 10,10,10”, 0);

Notice the typographic (e.g. curly, curved, book, or smart) quotation marks? These Unicode characters (0x201c, 0x201d) are not valid delimiters for string literals.

In C++ the enclosing delimiters for string literals are ASCII (0x22) double quotes. For example.

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

Hope this helps.

– Dale

image|554x18image|430x156 4

it didn’t work. and why there is no error in line76 ?

Rather than post a script shot of your code, which doesn’t help in any way, can you post your source code instead?

– Dale

after creating a plugin project,just three operations were performed.

  1. delete the line with “#error…”
  2. change the class of plugin12 into CRhinoScriptCommand which showen in the picture
  3. add a command in line 69(in picture2)

Without any more information than you’ve provided, I am guessing that you don’t have all of the necessary C++ components for Visual Studio installed.

You might consider re-running the Visual Studio installer and make sure you have all required C++ components installed.

– Dale

RhinoApp().RunScript(L"_-Line 0,0,0 10,10,10", 0)

CRhinoScriptContext s = CRhinoScriptContext();
s.SetScript(L"_-Line 0,0,0 10,10,10");

the problem has been solved with someone’s help.
thank you for help.

– Dale