GeomFill::Surface & GeomFill_BSplineCurves

I am using GeomFill::Surface and GeomFill_BSplineCurves to fill a surface between curves. The curves are selected with the mouse and can be free curves (lines, circles, arcs, splines, etc.) or edges of an existing solid. Both the functions work well for Geom_BSpline curves, but fail for Geom_Line curves. Any ideas why?

Francois Lauzon's picture

GeomFill_BSplineCurves works only with NURBS curves and GeomFill::Surface seems to work with any finite curves. But Geom_Line are infinite curve so you should build a Geom_TrimmedCurve with your line and pass it to GeomFill::Surface. You can also convert your trimmed line to a nurbs curve and use GeomFill_BSplineCurves (using GeomConvert::CurveToBSplineCurve)

Good Luck,
Francois

Deelip's picture

Thanks for your prompt response. I think I should have been more precise in describing my problem.

I get the selected object (in this case a finite line) with the following code:

pContext->InitSelected();
Handle(Geom_Curve) pCurve = BRep_Tool::Curve(TopoDS::Edge(pContext->SelectedShape()), First, Last);

When I pass this pCurve to GeomFill::Surface() the program crashes. I have already tried using GeomConvert::CurveToBSplineCurve() to convert the Geom_Curve to a BSpline Curve. It still crashes.

If I select a spline everything works perfectly.

Francois Lauzon's picture

You have to create a Geom_TrimmedCurve with your First and Last parameters.

Deelip's picture

Perfect. That was exactly what I needed to do. Thanks a million.