using Grasshopper.Kernel; using Rhino.Geometry; public class MyComponent : GH_Component { public MyComponent() : base("My Component", "MC", "Description", "Category", "Subcategory") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddBrepParameter("Brep", "B", "Description", GH_ParamAccess.item); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddPointParameter("Points", "P", "Description", GH_ParamAccess.list); } protected override void SolveInstance(IGH_DataAccess DA) { Brep brep = null; DA.GetData(0, ref brep); Listpoints = new List (); foreach(var vertex in brep.Vertices) { points.Add(vertex.Location); } DA.SetDataList(0, points); } }
using Grasshopper.Kernel; public class MyComponent : GH_Component { public MyComponent() : base("My Component", "MC", "Description", "Category", "Subcategory") { } protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddTextParameter("Text", "T", "Description", GH_ParamAccess.item); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddTextParameter("Output", "O", "Description", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { string inputText = ""; DA.GetData(0, ref inputText); string outputText = inputText.ToUpper(); DA.SetData(0, outputText); } }This example demonstrates how to use IGH_DataAccess to retrieve a Text parameter from Grasshopper and modify its value by converting it to uppercase. The modified value is returned as output.