Hello, I’m back with a performance-related question.
I’m currently working on optimizing a workflow that goes from a filleted curve to a filleted solid Brep.
My initial approach was to create a single surface and then offset it using Brep.CreateFromOffsetFace. This was the fastest method for generating the solid. However, I ran into an issue: I need all individual faces, including the filleted ones. When I use Brep.Faces.SplitFacesAtTangents(), I do get the desired face separation, but this operation takes just as long as offsetting the entire Brep.
So my question is: Is there a more performant way to split a filleted surface into individual faces?
public static Brep CreateExtrudedProfileFromCurve(Curve curve, double thickness, Plane referencePlane, double length)
{
var toll = RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
var secondFilledCurves = curve.Offset(referencePlane, thickness, toll,
CurveOffsetCornerStyle.None)[0];
if (secondFilledCurves == null || !secondFilledCurves.IsValid)
throw new InvalidOperationException("Failed to create second filled curves.");
var fistStartPoint = curve.PointAtStart;
var seconStartPoint = secondFilledCurves.PointAtStart;
var startLine = new Line(fistStartPoint, seconStartPoint).ToNurbsCurve();
var fistEndPoint = curve.PointAtEnd;
var secondEndPoint = secondFilledCurves.PointAtEnd;
var endLine = new Line(fistEndPoint, secondEndPoint).ToNurbsCurve();
var allCurves = new List<Curve> { curve, secondFilledCurves, startLine, endLine };
var joinedCurves = Curve.JoinCurves(allCurves,toll)[0];
if (joinedCurves == null || joinedCurves.IsClosed == false)
throw new InvalidOperationException("Failed to join filleted curves.");
var extrusion = Extrusion.Create(joinedCurves, length, true).ToBrep();
return extrusion ?? throw new InvalidOperationException("Failed to create extrusion from joined curves.");
}