C# loft of polylines outputting as untrimmed surface. Shouldn't it be Brep?

Recently using the Loft from Rhinocommon on some polylines. I noticed that it outputs an untrimmed surface (even tho it becomes a polysurface when baked). The GH native loft component outputs a Brep. As far as I see in Rhinocommon the result is an array of Brep. Wondering why that is. Anyway in the case I needed it was actually convenient to output as untrimmed surface because it allowed me to be able to use the surface components like divide surface and isocurve. But I can;t use it as a surface in the code it is still a Brep. So is something happening upon the c# script components output that translates to an untrimmed surface - and if so how can I make this translation to untrimmed surface within the code before output?

Loft.gh (7.8 KB)

Hi @Michael_Pryor,

If you need the underlying surface, can you can do something like this:

private void RunScript(List<Curve> x, ref object A)
  var breps = Brep.CreateFromLoft(x, Point3d.Unset, Point3d.Unset, LoftType.Normal, false);
  if (1 == breps.Length)
    A = breps[0].Surfaces[0];
    A = null;

– Dale

1 Like

Thanks Dale, That worked!

Any idea as to why/how it is an untrimmed surface even though the geometry is clearly what we know in rhino as a polysurface?

Hi @Michael_Pryor,

A Brep is not always a polysurface. For example, if you Rhino’s Plane command, it will create a Brep that contains a single surface.

– Dale

That I understand, Just curious about this specific case where lofting polylines creates what appears to be a Polysurface in preview but is output as an untrimmed surface. However, when baked it is a polysurface. The native Gh loft seems to result also in a Brep that is a polysurface.

A polyline can be represented by a degree=1 nurbs curve, and even higher degree nurbs curve with multiple interior knots. The lofter presumably treats the input curves as nurbs curves and creates a single nurbs surface, which contains creases. There are additional methods in Rhino which allow you to split a surface along these creases and instead turn it into a polysurface.

1 Like

The reason the lofter outputs an array of breps is because sometimes a loft actually results in a collection of disjoint shapes. Sometimes on purpose, sometimes because the loft didn’t go as planned but Rhino still wants to give you all the partial results. In my experience only the Developable loft type ever really fails, so it’s unlikely you’d get more than one brep as a result if you use Normal, Loose, Tight or even Straight.

I see, both of your descriptions make sense. So I assume you are doing something like brep.Faces.SplitKinkyFaces() before output on the native GH loft? Not the point of this topic but it makes me wonder if maybe it makes sense for the loft component to have an option to not split? (and extrude component as well) The nice thing about it not splitting in some cases is that you can pattern around the entire shape (like for instance using divide surface on it) and get full isocurves around it as well. It’s something I see quite often on the forum “How can I make this pattern around this Brep?”



just find exactly what I needed in this discussion. Very helpful and made my day. Thanks a lot.