Creating contour from loft

hi,
I used Brep.CreateContourCurves() but there are more contours created than the number of section planes. The input planes are 78 and output curves are 91.



extra curves between plane
3

Hi @neerajsmurali
I’m assuming you are using grasshopper or code for that?
Are you able to provide a model and script?

I am using the C# component in grasshopper but the grasshopper component Brep|plane is also giving the same result…

00.3dm (893.2 KB) 00.gh (22.7 KB) GrpcLatLon.gha (10 KB) gpx.rar (20.7 KB)

Planes are infinite:


So you need to either use BrepSurface intersection, or check if the result of CreateContourCurves is close enough to your plane origin:

foreach(var plane in planes)
{
    var contCurve = Brep.CreateContourCurves(loftedSurface[0], plane);
    foreach(var c in contCurve)
    {
      var t = 0.0;
      if (c.ClosestPoint(plane.Origin, out t, 10.0))
        contourCurves.Add(c);
    }
}


Contour.gh (18.9 KB)

alternatively, if you don’t have the scale in the outer foreach loop (also null checks might save you time debugging)

IEnumerable<Curve> fromBrep = Brep.CreateContourCurves(loftedSurface[0], plane);
Curve result;
if(fromBrep!=null){
    IEnumerable<Curve> filtered = fromBrep.OrderBy(x=>plane.Origin.DistanceTo(x.PointAtNormalizedLength(0.5)))
    if(filtered!=null){
        result=filtered.First();
    }
};

Thank You @Mahdiyar

Thank You @Thierry_BOCK