Reported surface.domain doesn't seem accurate

I’m trying to get evenly-spaced isocurves along a pipe surface in one direction (V-direction) (via c# script).

My approach has been as follows: 1) find the biggest surface on the pipe (it has rounded ends, but I only want the body of the pipe), 2) get the span of the domain in the V direction, 3) divide it by some step value, and 4) extract an isocurve at each division point.

The c# is here, but also embedded in my attached gh file.

private void RunScript(Brep brep, ref object isoCurves, ref object vDomain, ref object pipe)

//first, we are just processing the pipe to find the biggest surface/face
//that's the face I want to get evenly-spaced isocurves from.
Surface[] faces = new Surface[brep.Faces.Count];
double[] areas = new double[brep.Faces.Count];

for (int i = 0; i < brep.Faces.Count; i++)
  Surface s = brep.Faces[i].DuplicateSurface();
  areas[i] = AreaMassProperties.Compute(s).Area;
  faces[i] = s;


Array.Sort(areas, faces);

Surface p = faces[0];

//now, the meat of the issue:
//reported domain for surface doesn't seem to extend over entire domain
//in GH you will see an output domain of 0 to 3 * pi
//my basic process is as follows:

//find entire domain in V direction
Interval vD = p.Domain(1);
//divide it by some number (20)
double divStep = vD.Length / 20;
//step through the v-domain, getting the isocurves.
List<Curve> isoCrvs = new List<Curve>();
for (double d = vD.Min; d < vD.Max; d += divStep)
  Curve iC = p.IsoCurve(1, d);
isoCurves = isoCrvs;
vDomain = vD;
pipe = p;


I’ve found that when I try to do this, specifically with a piped surface, I get a series of isocurves in the V-direction, but only over a portion of the surface. The reported domain via Surface.Domain is not the entire domain of the surface. The reported domain for my pipe surface in the V-direction is 0 to 3 * pi. When I extract an isocurve at 3 * pi either via c# script or via grasshopper components, I get an isocurve located midway through the surface, not at one of the ends. This curve also corresponds with the last curve in my series of isocurves. I can, however, sample the surface at a UV point outside of this 3 * pi bounds, and get an isocurve that is theoretically out of bounds but which indeed exists on the surface.

For an example, please see the attached rhino file and gh script (with embedded c# component). I also put some tests in there. My test c# is on the left and the other tests I did to verify things are on the right.

test_extract even isocurves.3dm (172.2 KB) test extract (18.0 KB)

Hi @gruedisueli,

Does this work any better?

  private void RunScript(Brep brep, int count, ref object A)
    if (null == brep)

    BrepFace pipe = null;
    foreach (var face in brep.Faces)
      if (face.IsClosed(0) || face.IsClosed(1))
        pipe = face;

    if (null == pipe)

    var dir = pipe.IsClosed(0) ? 0 : 1;
    var domain = pipe.Domain(dir == 1 ? 0 : 1);

    var curves = new List<Curve>(count);
    for (var i = 0; i < count; i++)
      var s = ((double) i / (count - 1));
      var t = domain.ParameterAt(s);
      curves.Add(pipe.IsoCurve(dir, t));

    A = curves.ToArray();

– Dale

@dale Yes, it works better! It appears that the critical difference between our code is that you are sampling along the domain of the BrepFace, whereas I was duplicating the Surface of the BrepFace, yes? Interesting that not duplicating the face yields more reliable results.