diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index c746985840..a80c06b244 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -363,7 +363,7 @@ public: "makeSweepSurface(edge(path),edge(profile),[float]) -- Create a profile along a path." ); add_varargs_method("makeLoft",&Module::makeLoft, - "makeLoft(list of wires,[solid=False,ruled=False,closed=False]) -- Create a loft shape." + "makeLoft(list of wires,[solid=False,ruled=False,closed=False,maxDegree=5]) -- Create a loft shape." ); add_varargs_method("makeWireString",&Module::makeWireString, "makeWireString(string,fontdir,fontfile,height,[track]) -- Make list of wires in the form of a string's characters." @@ -1517,10 +1517,12 @@ private: PyObject *psolid=Py_False; PyObject *pruled=Py_False; PyObject *pclosed=Py_False; - if (!PyArg_ParseTuple(args.ptr(), "O|O!O!O!", &pcObj, + int degMax = 5; + if (!PyArg_ParseTuple(args.ptr(), "O|O!O!O!i", &pcObj, &(PyBool_Type), &psolid, &(PyBool_Type), &pruled, - &(PyBool_Type), &pclosed)) { + &(PyBool_Type), &pclosed, + °Max)) { throw Py::Exception(); } @@ -1539,7 +1541,7 @@ private: Standard_Boolean anIsSolid = PyObject_IsTrue(psolid) ? Standard_True : Standard_False; Standard_Boolean anIsRuled = PyObject_IsTrue(pruled) ? Standard_True : Standard_False; Standard_Boolean anIsClosed = PyObject_IsTrue(pclosed) ? Standard_True : Standard_False; - TopoDS_Shape aResult = myShape.makeLoft(profiles, anIsSolid, anIsRuled,anIsClosed); + TopoDS_Shape aResult = myShape.makeLoft(profiles, anIsSolid, anIsRuled, anIsClosed, degMax); return Py::asObject(new TopoShapePy(new TopoShape(aResult))); #endif } diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index 5f1238473d..ba06aedf11 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -265,6 +265,7 @@ Loft::Loft() ADD_PROPERTY_TYPE(Solid,(false),"Loft",App::Prop_None,"Create solid"); ADD_PROPERTY_TYPE(Ruled,(false),"Loft",App::Prop_None,"Ruled surface"); ADD_PROPERTY_TYPE(Closed,(false),"Loft",App::Prop_None,"Close Last to First Profile"); + ADD_PROPERTY_TYPE(MaxDegree,(5),"Loft",App::Prop_None,"Maximum Degree"); } short Loft::mustExecute() const @@ -277,6 +278,8 @@ short Loft::mustExecute() const return 1; if (Closed.isTouched()) return 1; + if (MaxDegree.isTouched()) + return 1; return 0; } @@ -334,9 +337,10 @@ App::DocumentObjectExecReturn *Loft::execute(void) Standard_Boolean isSolid = Solid.getValue() ? Standard_True : Standard_False; Standard_Boolean isRuled = Ruled.getValue() ? Standard_True : Standard_False; Standard_Boolean isClosed = Closed.getValue() ? Standard_True : Standard_False; + int degMax = MaxDegree.getValue(); TopoShape myShape; - this->Shape.setValue(myShape.makeLoft(profiles, isSolid, isRuled,isClosed)); + this->Shape.setValue(myShape.makeLoft(profiles, isSolid, isRuled, isClosed, degMax)); return App::DocumentObject::StdReturn; } catch (Standard_Failure& e) { diff --git a/src/Mod/Part/App/PartFeatures.h b/src/Mod/Part/App/PartFeatures.h index f1f5fe8782..d93b591ef1 100644 --- a/src/Mod/Part/App/PartFeatures.h +++ b/src/Mod/Part/App/PartFeatures.h @@ -73,6 +73,7 @@ public: App::PropertyBool Solid; App::PropertyBool Ruled; App::PropertyBool Closed; + App::PropertyInteger MaxDegree; /** @name methods override feature */ //@{ diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 776cbcef84..22df23a20e 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -2089,10 +2089,12 @@ TopoDS_Shape TopoShape::makeThread(Standard_Real pitch, TopoDS_Shape TopoShape::makeLoft(const TopTools_ListOfShape& profiles, Standard_Boolean isSolid, Standard_Boolean isRuled, - Standard_Boolean isClosed) const + Standard_Boolean isClosed, + Standard_Integer MaxDegree) const { // http://opencascade.blogspot.com/2010/01/surface-modeling-part5.html BRepOffsetAPI_ThruSections aGenerator (isSolid,isRuled); + aGenerator.SetMaxDegree(MaxDegree); TopTools_ListIteratorOfListOfShape it; int countShapes = 0; diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h index eb6102db01..b657ec8715 100644 --- a/src/Mod/Part/App/TopoShape.h +++ b/src/Mod/Part/App/TopoShape.h @@ -208,7 +208,7 @@ public: TopoDS_Shape makeThread(Standard_Real pitch, Standard_Real depth, Standard_Real height, Standard_Real radius) const; TopoDS_Shape makeLoft(const TopTools_ListOfShape& profiles, Standard_Boolean isSolid, - Standard_Boolean isRuled, Standard_Boolean isClosed = Standard_False) const; + Standard_Boolean isRuled, Standard_Boolean isClosed = Standard_False, Standard_Integer MaxDegree = 5) const; TopoDS_Shape makeOffsetShape(double offset, double tol, bool intersection = false, bool selfInter = false, short offsetMode = 0, short join = 0, bool fill = false) const;