BSpline calculation - Reproducing the documentation -

Dear all,

I am investigating the use of the Geom_BSplineCurve class to create a BSpline Curve interpolating a set of points. I had a look at the documentation material (brep_wp document in the doc folder) and trying to reproduce the example number 7 at page 9. This examples should create a BSpline curve from a set of points, weights, knots and multiplicities. However, using the following code:

void buildSplineCurve(void)
gp_Pnt p1(0.0,1.0,0.0);
gp_Pnt p2(1.0,-2.0,0.0);
gp_Pnt p3(2.0,3.0,0.0);

TColgp_Array1OfPnt pnts(1,3);

TColStd_Array1OfReal weights(1,3);
weights.SetValue(1, 4);
weights.SetValue(2, 5);
weights.SetValue(3, 6);

TColStd_Array1OfReal knots(1,5);
knots.SetValue(1, 0.0);
knots.SetValue(2, 0.25);
knots.SetValue(3, 0.5);
knots.SetValue(4, 0.75);
knots.SetValue(5, 1.0);

TColStd_Array1OfInteger mult(1,5);
knots.SetValue(1, 1);
knots.SetValue(2, 1);
knots.SetValue(3, 1);
knots.SetValue(4, 1);
knots.SetValue(5, 1);

Handle(Geom_Curve) curveToNew = new Geom_BSplineCurve(pnts, weights, knots, mult, 1);
BRepBuilderAPI_MakeEdge edgeNew(curveToNew);
edgeNew.Build(); edgeNew.Check();

BRepTools::Write(edgeNew.Edge(), "edgeNew.brep");


I get ConstructionError raised when the BSpline curve is created. Has anyone tried the same? What am I missing?

Thanks in advance for your help,

Kind regards,


Paolo Tricerri's picture

Issue Solved. Sorry for spamming.