-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNTNU_FirstComponent.cs
More file actions
86 lines (70 loc) · 2.94 KB
/
NTNU_FirstComponent.cs
File metadata and controls
86 lines (70 loc) · 2.94 KB
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
using Grasshopper;
using Grasshopper.Kernel;
using Rhino.Geometry;
using System;
using System.Collections.Generic;
using NTNU_FirstPlugin;
namespace NTNU_FirstPlugin
{
public class NTNU_FirstComponent : GH_Component
{
/// <summary>
/// Each implementation of GH_Component must provide a public
/// constructor without any arguments.
/// Category represents the Tab in which the component will appear,
/// Subcategory the panel. If you use non-existing tab or panel names,
/// new tabs/panels will automatically be created.
/// </summary>
public NTNU_FirstComponent()
: base("NTNU_FirstComponent", "Nickname",
"Description",
"NTNU", "Test")
{
}
/// <summary>
/// Registers all the input parameters for this component.
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{
pManager.AddTextParameter("itext","it","input text",GH_ParamAccess.item); //0
}
/// <summary>
/// Registers all the output parameters for this component.
/// </summary>
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
pManager.AddTextParameter("otext", "ot", "output text", GH_ParamAccess.item); //0
pManager.AddGenericParameter("something","s", "class something object", GH_ParamAccess.item); //1
}
/// <summary>
/// This is the method that actually does the work.
/// </summary>
/// <param name="DA">The DA object can be used to retrieve data from input parameters and
/// to store data in output parameters.</param>
protected override void SolveInstance(IGH_DataAccess DA)
{
string text = "";
DA.GetData(0, ref text);
string newText = NTNU_methods.giveMeText(text);
ClassSomething something = new ClassSomething();
something.name = newText;
something.id = 0;
something.material = "plastic";
DA.SetData(0, newText);
DA.SetData(1, something);
}
/// <summary>
/// Provides an Icon for every component that will be visible in the User Interface.
/// Icons need to be 24x24 pixels.
/// You can add image files to your project resources and access them like this:
/// return Resources.IconForThisComponent;
/// </summary>
// protected override System.Drawing.Bitmap Icon => null;
/// <summary>
/// Each component must have a unique Guid to identify it.
/// It is vital this Guid doesn't change otherwise old ghx files
/// that use the old ID will partially fail during loading.
/// </summary>
public override Guid ComponentGuid => new Guid("3b7609b8-2261-475e-9e6c-7652b7687a2f");
}
}