我正在跟随 https://developer.rhino3d.com/guides/scripting/scripting-gh-csharp/ 教程学习如何编写 GH C# 脚本,但没有顺利地将矩形绘制出来,请教问题出在哪里?
// Grasshopper Script Instance
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using Rhino;
using Rhino.Geometry;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
public class Script_Instance : GH_ScriptInstance
{
private void RunScript(object x, object y, out object a)
{
// Write your logic here
a = null;
}
public override BoundingBox ClippingBox => new BoundingBox(new Point3d(0, 0, 0), new Point3d(500, 500, 500));
public override void DrawViewportMeshes(IGH_PreviewArgs args)
{
}
public override void DrawViewportWires(IGH_PreviewArgs args)
{
args.Display.Draw2dRectangle(
new System.Drawing.Rectangle(100,100,150,150)
System.Drawing.Color.Red,
20,
System.Drawing.Color.Yellow
);
}
}
我的操作步骤:1)新建 Document, 2) 拖入 script 电池,3)编辑脚本,4)运行脚本