ʕ ·ᴥʔ ʕᴥ· ʔ

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

VS中编写GH脚本

0.测试版本:Rhino-7.27,ScriptParasite-1.1.1。

1.下载GH插件ScriptParasite,放入GH插件目录..\Libraries,重启Rhino和GH后,ScriptParasite会存在于Math类中。

2.在GH画布中设置ScriptParasite输入端:csproj文件路径和监听开关,与对应C#脚本组件成组;

   开启Toggle后会自动在路径中新建所需的工程文档;

   在VS中打开路径下的该项目,即可实时双向监听。

 

3.注意事项:VS解决方案的依赖项可能因为.NET环境出现警告,需要安装.NET Framework 4.5.2的开发者工具包。

   下载链接:https://dotnet.microsoft.com/zh-cn/download/visual-studio-sdks?cid=getdotnetsdk

   Rhino4food插件评论区问答:

   问:The primary reference "RhinoCommon","Grasshopper","GH_IO" could not be resolved because it was generated for the ".NET Framework,Version=v4.8 "framework.

   This framework Version is higher than the target framework.NET Framework,Version=v4.5.2.

   答:In the GrasshopperScripts.csproj file, change Line 3 target framework to the one your system is working on.
   For me I am using the latest framework .NET 7.0, so I just simply changed the number 452 to 7 shown below:
   <TargetFramework>net7</TargetFramework>

4.自动生成的cs文件重命名后会丢失与GH的链接,那如何得知与GH中特定C#脚本的对应关系呢?

解决方法:

You can try to name your c# component in GH and run this plugin again. By doing so it will automatically add the customized name you give to the beginning of the C# file's name.

5.VS中设置中文,同步到GH脚本中会出现乱码,解决办法如下:

   VS菜单-文件-高级保存选项-将GB2312改为UTF-8即可。

 

高级保存选项默认不在文件下拉列表中,可在工具-自定义-命令中设置。

另抛出问题:如何一劳永逸,不用每次都设置。

 

posted on 2023-02-26 10:50  Alexie  阅读(369)  评论(0)    收藏  举报