protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddNumberParameter("Radius", "R", "Circle radius", GH_ParamAccess.item, 1.0); } protected override void SolveInstance(IGH_DataAccess DA) { double radius = 0.0; if (!DA.GetData(0, ref radius)) return; // Use the radius value to perform some calculation }
protected override void RegisterInputParams(GH_InputParamManager pManager) { pManager.AddNumberParameter("Width", "W", "Rectangle width", GH_ParamAccess.item, 1.0); pManager.AddNumberParameter("Height", "H", "Rectangle height", GH_ParamAccess.item, 1.0); } protected override void SolveInstance(IGH_DataAccess DA) { double width = 0.0; double height = 0.0; if (!DA.GetData(0, ref width)) return; if (!DA.GetData(1, ref height)) return; // Use the width and height values to perform some calculation }In this example, we are fetching two numeric values from the "Width" and "Height" input parameters using DA.GetData(0, ref width) and DA.GetData(1, ref height). Overall, the IGH_DataAccess Fetch method is an important tool for accessing data in Grasshopper components written in C#. It is part of the RhinoCommon library, which is built into Grasshopper.