Concatenate several B-spline curves into one

Quaoar

Administrator
Staff member
That is quite a rare issue, but once you face it, it's really hard to find a solution. Imagine you've got a series of B-spline curves all represented with the distinct Geom_BSplineCurve entities of OpenCascade. To simplify your downstream processing, you might want to merge them into just one curve.

A good example here would be a helical spline: while at contruction stage, it is easier to build each coil separately, later on it would be more handy to have the entire helix as one curve.

Here is how you can contatenate several spline curves stored in the curves collection of TColGeom_SequenceOfCurve type using GeomConvert_CompCurveToBSplineCurve:

C++:
// Build up a complex curve.
GeomConvert_CompCurveToBSplineCurve concat;
//
for ( TColGeom_SequenceOfCurve::Iterator cit(curves); cit.More(); cit.Next() )
{
  const Handle(Geom_BSplineCurve)&
    curve = Handle(Geom_BSplineCurve)::DownCast( cit.Value() );
  //
  concat.Add( curve, Precision::Confusion() );
}

Handle(Geom_BSplineCurve) result = concat.BSplineCurve();
 
Top