-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrimitiveCone.cs
67 lines (63 loc) · 2.46 KB
/
PrimitiveCone.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
using System;
using System.Collections.Generic;
using Mola;
using Grasshopper;
using Grasshopper.Kernel;
using Rhino.Geometry;
namespace HDMolaGH
{
public class PrimitiveCone : GH_Component
{
public PrimitiveCone()
: base("Mola Cone", "Cone",
"create a cone",
"Mola", "1-Primitives")
{
}
public override GH_Exposure Exposure => GH_Exposure.secondary;
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddNumberParameter("z1", "z1", "z coordinate of the lower center", GH_ParamAccess.item, 0.0);
pManager.AddNumberParameter("z2", "z2", "z coordinate of the top center", GH_ParamAccess.item, 1.0);
pManager.AddNumberParameter("r1", "r1", "radius of the lower center", GH_ParamAccess.item, 2.0);
pManager.AddNumberParameter("r2", "r2", "radius of the top center", GH_ParamAccess.item, 1.0);
pManager.AddIntegerParameter("segments", "N", "segments of cone", GH_ParamAccess.item, 6);
pManager.AddBooleanParameter("cap bottom", "c1", "z of the upper right coner", GH_ParamAccess.item, true);
pManager.AddBooleanParameter("cap top", "c2", "z of the upper right coner", GH_ParamAccess.item, true);
}
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddGenericParameter("Cone", "Cone", "a cone Mola mesh", GH_ParamAccess.item);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
double z1 = 0;
double z2 = 1;
double r1 = 2;
double r2 = 1;
int n = 6;
bool c1 = true;
bool c2 = true;
DA.GetData(0, ref z1);
DA.GetData(1, ref z2);
DA.GetData(2, ref r1);
DA.GetData(3, ref r2);
DA.GetData(4, ref n);
DA.GetData(5, ref c1);
DA.GetData(6, ref c2);
MolaMesh mMesh = MeshFactory.CreateCone((float)z1, (float)z2, (float)r1, (float)r2, n, c1, c2);
DA.SetData(0, mMesh);
}
protected override System.Drawing.Bitmap Icon
{
get
{
return Properties.Resources.cone;
}
}
public override Guid ComponentGuid
{
get { return new Guid("b316ba0e-0e66-4831-b935-19a059ed44c0"); }
}
}
}