From dd49ee27fd3916b2d08b5443869060a988960aaf Mon Sep 17 00:00:00 2001 From: tomate44 Date: Mon, 26 Feb 2018 16:24:34 +0100 Subject: [PATCH] add simulate function to MakePipeShell --- .../App/BRepOffsetAPI_MakePipeShellPy.xml | 8 ++++++ .../App/BRepOffsetAPI_MakePipeShellPyImp.cpp | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPy.xml b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPy.xml index 1a5161a20b..6a2b39aadd 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPy.xml +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPy.xml @@ -201,5 +201,13 @@ + + + + simulate(int nbsec) + Simulates the resulting shape by calculating the given number of cross-sections. + + + diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp index 618e6f20a1..c42ffa6b76 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp @@ -499,6 +499,31 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args) } +PyObject* BRepOffsetAPI_MakePipeShellPy::simulate(PyObject *args) +{ + int nbsec; + if (!PyArg_ParseTuple(args, "i",&nbsec)) + return 0; + + try { + TopTools_ListOfShape list; + this->getBRepOffsetAPI_MakePipeShellPtr()->Simulate(nbsec, list); + + Py::List shapes; + TopTools_ListIteratorOfListOfShape it; + for (it.Initialize(list); it.More(); it.Next()) { + const TopoDS_Shape& s = it.Value(); + shapes.append(Py::asObject(new TopoShapePy(new TopoShape(s)))); + } + return Py::new_reference_to(shapes); + } + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); + return 0; + } +} + + PyObject *BRepOffsetAPI_MakePipeShellPy::getCustomAttributes(const char* ) const { return 0;