NURBS Surface Wires....

Hello,

I am using the data exchange library to read a STEP file and convert the surface data to trimmed NURBS surfaces. I'm looking for the most accurate and robust method to accomplish this. For some STEP files, my present implementation suffers from a number of issues ranging from failed curve extraction from an edge in a wire (resulting in a non-closed wire) to cases where all the wires are read successfully but the resulting trimmed surface does not match the curves in the model.

Is there a recommended set of steps to accurately extract trimmed NURBS surface data from a TopoDS_Face? I need the trim curves to be 2D in (u,v) space and to adhere to the NURBS convention (must have an outer loop, all loops are closed, curves within a loop are sorted head to tail, and the surface is always on the left of a curve).

I'm currently using the following for surfaces (main calls shown):


BRepBuilderAPI_NurbsConvert nurbs(face); opencascade::handle<Geom_Surface> brepSrf = BRepLib_FindSurface(nurbs).Surface(); opencascade::handle<Geom_BSplineSurface> bsplineSrf = GeomConvert::SurfaceToBSplineSurface(brepSrf);

And this to extract the parametric curves:


BRepTools_WireExplorer edgeExp; for (edgeExp.Init(wire, face); edgeExp.More(); edgeExp.Next()) { Standard_Real start, stop; ShapeAnalysis_Edge edgeAnalyzer; opencascade::handle<Geom2d_Curve> pcurve2D; Standard_Boolean hasPcurve = edgeAnalyzer.PCurve(edgeExp.Current(), face, pcurve2D, start, stop); opencascade::handle<Geom2d_TrimmedCurve> trimmedCrv = new Geom2d_TrimmedCurve(pcurve2D, start, stop); opencascade::handle<Geom2d_BSplineCurve> bsplineCrv = Geom2dConvert::CurveToBSplineCurve(trimmedCrv);

Is edgeAnalyzer the best method to get the geom2d_curve or is there a better way? I'm also using ShapeFix_Wire on each wire but I don't really know why.


ShapeFix_Wire wireFixer(wire, face, Precision::Confusion()); if (wireFixer.Perform()) { // perform all available fixes wire = wireFixer.Wire(); }

Any guidance is appreciated.

Thanks, Travis