0000895: Part.BSplineCurve: allow to set degree and mutliplicites when calling constructor.

This commit is contained in:
wmayer 2013-10-27 12:56:05 +01:00
parent fd9fb9481e
commit 5678247628
2 changed files with 24 additions and 3 deletions

View File

@ -275,7 +275,28 @@ from the knots table of this B-Spline curve.</UserDocu>
<Documentation>
<UserDocu>
Builds a B-Spline by a lists of Poles, Mults, Knots.
arguments: poles (sequence of Base.Vector), [mults , knots, periodic, degree, weights (sequence of Base.Vector), CheckRational]
arguments: poles (sequence of Base.Vector), [mults , knots, periodic, degree, weights (sequence of float), CheckRational]
Examples:
from FreeCAD import Base
import Part
V=Base.Vector
poles=[V(-10,-10),V(10,-10),V(10,10),V(-10,10)]
# non-periodic spline
n=Part.BSplineCurve()
n.buildFromPolesMultsKnots(poles,(3,1,3),(0,0.5,1),False,2)
Part.show(n.toShape())
# periodic spline
p=Part.BSplineCurve()
p.buildFromPolesMultsKnots(poles,(1,1,1,1,1),(0,0.25,0.5,0.75,1),True,2)
Part.show(p.toShape())
# periodic and rational spline
r=Part.BSplineCurve()
r.buildFromPolesMultsKnots(poles,(1,1,1,1,1),(0,0.25,0.5,0.75,1),True,2,(1,0.8,0.7,0.2))
Part.show(r.toShape())
</UserDocu>
</Documentation>
</Methode>

View File

@ -904,7 +904,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
Base::Vector3d pnt = v.toVector();
occpoles(index++) = gp_Pnt(pnt.x,pnt.y,pnt.z);
}
//Calculate ne number of knots
//Calculate the number of knots
if (mults != Py_None && knots != Py_None) {
number_of_knots = PyObject_Length(mults);
if (PyObject_Length(knots) != number_of_knots) {
@ -1006,8 +1006,8 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
Standard_CString msg = e->GetMessageString();
PyErr_SetString(PyExc_Exception, msg ? msg : "");
return 0;
}
}
}
PyObject* BSplineCurvePy::toBezier(PyObject *args)