From 55f373eef7e1ac2f42e6f8cc321c27cb9e83e07f Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Thu, 16 Feb 2017 22:46:30 +0100 Subject: [PATCH] Sketcher: IncreaseBSplineDegree python implementation --- src/Mod/Sketcher/App/SketchObjectPy.xml | 5 +++++ src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml index 45b6db4c28..2f82a64031 100644 --- a/src/Mod/Sketcher/App/SketchObjectPy.xml +++ b/src/Mod/Sketcher/App/SketchObjectPy.xml @@ -162,6 +162,11 @@ Approximates the given geometry with a B-Spline + + + Increases the given BSpline Degree by a number of degrees + + diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 172387966b..40c201d8c3 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -1015,6 +1015,23 @@ PyObject* SketchObjectPy::ConvertToNURBS(PyObject *args) Py_Return; } +PyObject* SketchObjectPy::IncreaseBSplineDegree(PyObject *args) +{ + int GeoId; + int incr = 1; + + if (!PyArg_ParseTuple(args, "i|i", &GeoId, &incr)) + return 0; + + if (this->getSketchObjectPtr()->IncreaseBSplineDegree(GeoId, incr)==false) { + std::stringstream str; + str << "Degree increase failed for: " << GeoId; + PyErr_SetString(PyExc_ValueError, str.str().c_str()); + return 0; + } + + Py_Return; +} Py::Int SketchObjectPy::getConstraintCount(void) const {