-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowCase.cs
93 lines (82 loc) · 2.86 KB
/
ShowCase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Rhino.Geometry;
namespace Showcase
{
public class ShowCase : GH_Component
{
/// <summary>
/// Initializes a new instance of the ShowCase class.
/// </summary>
public ShowCase()
: base("ShowCase", "Nickname",
"Description",
"Category", "Subcategory")
{
}
/// <summary>
/// Registers all the input parameters for this component.
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
//pManager.AddCurveParameter("Curve", "Curve", "test curve", GH_ParamAccess.item);
}
/// <summary>
/// Registers all the output parameters for this component.
/// </summary>
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddPointParameter("Output", "Output", "test out put", GH_ParamAccess.tree);
}
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
// 在一个列表中建立Z坐标从1-10共19个点
List<Point3d> pts1 = new List<Point3d>();
for (int i = 0; i < 10; i++)
{
pts1.Add(new Point3d(0, 0, i));
}
List<Point3d> pts2 = new List<Point3d>();
for (int i = 0; i < 10; i++)
{
pts2.Add(new Point3d(i, 0, 0));
}
List<List<Point3d>> output = new List<List<Point3d>> { pts1, pts2 };
var dataTree = new DataTree<Point3d>();
for (int i = 0; i < output.Count; i++)
{
for (int j = 0; j < output[i].Count; j++)
{
dataTree.Add(output[i][j], new GH_Path(i));
}
}
DA.SetDataTree(0, dataTree);
}
/// <summary>
/// Provides an Icon for the component.
/// </summary>
protected override System.Drawing.Bitmap Icon
{
get
{
//You can add image files to your project resources and access them like this:
// return Resources.IconForThisComponent;
return null;
}
}
/// <summary>
/// Gets the unique ID for this component. Do not change this ID after release.
/// </summary>
public override Guid ComponentGuid
{
get { return new Guid("F6EE9E1F-806C-4574-8BB7-859021A3ECE2"); }
}
}
}