Very Amateur C# in Rhino Grasshopper question

I have been learning C# by myself and would like to get a coutour of a Brep.
Here is the code:

BoundingBox bbox = x.GetBoundingBox(true);
double height = bbox.Max[2] - bbox.Min[2];
List<Curve> contourcrvs = new List<Curve>();

for (int i = 0;i < (height / y) ; i++)
{
  double contourplane_z = y * i + bbox.Min[2];
  Point3d origin = new Point3d(0, 0, contourplane_z);
  Vector3d zaxis = new Vector3d(0, 0, 10);

  Plane o_plane = new Plane(origin, zaxis);
  Curve[] contourcrv = Brep.CreateContourCurves(x, o_plane);
  contourcrvs.Add(contourcrv);
}
A = contourcrvs;

An Error message:

        {0;0}
  1. Error (CS1502): The best overloaded method match for ‘System.Collections.Generic.List<Rhino.Geometry.Curve>.Add(Rhino.Geometry.Curve)’ has some invalid arguments (line 69)
  2. Error (CS1503): Argument 1: cannot convert from ‘Rhino.Geometry.Curve’ to ‘Rhino.Geometry.Curve’ (line 69)

How to normally convert Array (Curve) to a normal Curve type so it can be added into a list of curves?

You could use addrange

1 Like