protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddNumberParameter("Result", "R", "Result of the calculation", GH_ParamAccess.item); } protected override void SolveInstance(IGH_DataAccess DA) { double number = 2.5; DA.SetData(0, number); }
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) { pManager.AddIntegerParameter("Count", "C", "Number of items", GH_ParamAccess.item); pManager.AddPointParameter("Points", "P", "List of points", GH_ParamAccess.list); } protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.AddPointParameter("Result", "R", "Resultant points", GH_ParamAccess.list); } protected override void SolveInstance(IGH_DataAccess DA) { int count = 5; ListIn this example, we define two input parameters and one output parameter. We set the input parameter "Count" to an integer value of 5 and create a list of points with a loop. We set the output using the SetDataList method to the list of points. The Grasshopper Compiler Libraries is the package library for the IGH_DataAccess SetData method.points = new List (); for (int i = 0; i < count; i++) { points.Add(new Point3d(i, i * 2, i * 3)); } DA.SetDataList(0, points); }