diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index d3b02b6c08..f07ce26f1d 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -1241,7 +1241,15 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key occmults.SetValue(occmults.Length(), degree+1); sum_of_mults = occmults.Length()+2*degree; } - else { sum_of_mults = occmults.Length()-1;} + else { + sum_of_mults = occmults.Length()-1; + } + } + // check multiplicity of inner knots + for (Standard_Integer i=2; i < occmults.Length(); i++) { + if (occmults(i) > degree) { + Standard_Failure::Raise("multiplicity of inner knot higher than degree"); + } } if (knots != Py_None) { //knots are given Py::Sequence knotssq(knots); diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index 44a96456c1..33ae6d96a7 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -1514,6 +1514,18 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k (PyObject_Not(vperiodic) && sum_of_vmults - vdegree -1 != lv)) { Standard_Failure::Raise("number of poles and sum of mults mismatch"); } + // check multiplicity of inner knots + for (Standard_Integer i=2; i < occumults.Length(); i++) { + if (occumults(i) > udegree) { + Standard_Failure::Raise("multiplicity of inner knot higher than degree"); + } + } + for (Standard_Integer i=2; i < occvmults.Length(); i++) { + if (occvmults(i) > vdegree) { + Standard_Failure::Raise("multiplicity of inner knot higher than degree"); + } + } + Handle(Geom_BSplineSurface) spline = new Geom_BSplineSurface(occpoles,occweights, occuknots,occvknots,occumults,occvmults,udegree,vdegree, PyObject_IsTrue(uperiodic) ? Standard_True : Standard_False,