Skip to content

Commit

Permalink
0000895: Part.BSplineCurve: allow to set degree and mutliplicites whe…
Browse files Browse the repository at this point in the history
…n calling constructor.
  • Loading branch information
wwmayer committed Oct 27, 2013
1 parent fd9fb94 commit 5678247
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 22 additions & 1 deletion src/Mod/Part/App/BSplineCurvePy.xml
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Part/App/BSplineCurvePyImp.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5678247

Please sign in to comment.