# 怎么在C++插件中运行一个rhino指令

**URL:** <https://cn.discourse.mcneel.com/t/topic/1480>\
**Category:** Rhino for Windows\
**Created:** [2019年四月12日 03:04 UTC](https://cn.discourse.mcneel.com/t/topic/1480 "2019-04-12T03:04:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![1351648725](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/1351648725/32/2015_2.png) [@1351648725](https://cn.discourse.mcneel.com/u/1351648725)\
**Post date:** [2019年四月12日 03:04 UTC](https://cn.discourse.mcneel.com/t/topic/1480/1 "2019-04-12T03:04:44Z")

</div>

我按照网上的教程编写了程序，但是出现了如下错误，为什么。Running Rhino Commands from Plugins with C/C++ [https://developer.rhino3d.com/guides/cpp/running-rhino-commands-from-plugins/](https://developer.rhino3d.com/guides/cpp/running-rhino-commands-from-plugins/)  
系统w7，Microsoft Visual Studio2017 ，rhino6  
 ![image](https://discourse-cdn-aws1.com/mcneel/uploads/mcneel_cn/original/2X/c/c42effbbfeadbeed44146903b53f796115ab3e92.png)

---

<div class="post-metadata">

**Author:** ![Jorin](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/jorin/32/3292_2.png) [@Jorin](https://cn.discourse.mcneel.com/u/Jorin)\
**Post date:** [2019年四月16日 13:18 UTC](https://cn.discourse.mcneel.com/t/topic/1480/2 "2019-04-16T13:18:25Z")

</div>

将：  
`RhinoApp().RunScript(L"_-Line 0,0,0 10,10,10", 0)`  
换成：

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

```

就可以了。

---

<div class="post-metadata">

**Author:** ![1351648725](https://sea3.discourse-cdn.com/mcneel/user_avatar/cn.discourse.mcneel.com/1351648725/32/2015_2.png) [@1351648725](https://cn.discourse.mcneel.com/u/1351648725)\
**Post date:** [2019年四月22日 08:15 UTC](https://cn.discourse.mcneel.com/t/topic/1480/3 "2019-04-22T08:15:17Z")

</div>

谢谢，按照你的方法可以成功运行了
