diff --git a/src/Mod/Part/App/TopoShapePy.xml b/src/Mod/Part/App/TopoShapePy.xml index e99e2e6bc3..798a99f02d 100644 --- a/src/Mod/Part/App/TopoShapePy.xml +++ b/src/Mod/Part/App/TopoShapePy.xml @@ -539,7 +539,13 @@ into B-spline surfaces. - Create a copy of this shape + Create a copy of this shape +copy(copyGeom=True, copyMesh=False) -> Shape +If copyMesh is True, triangulation contained in original shape will be +copied along with geometry. +If copyGeom is False, only topological objects will be copied, while +geometry and triangulation will be shared with original shape. + diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 118b7862ee..07c28a10e1 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -143,7 +143,6 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*) } } catch (Standard_Failure& e) { - PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } @@ -156,7 +155,9 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*) PyObject* TopoShapePy::copy(PyObject *args) { - if (!PyArg_ParseTuple(args, "")) + PyObject* copyGeom = Py_True; + PyObject* copyMesh = Py_False; + if (!PyArg_ParseTuple(args, "|O!O!", &PyBool_Type, ©Geom, &PyBool_Type, ©Mesh)) return NULL; const TopoDS_Shape& shape = this->getTopoShapePtr()->getShape(); @@ -171,7 +172,9 @@ PyObject* TopoShapePy::copy(PyObject *args) } if (!shape.IsNull()) { - BRepBuilderAPI_Copy c(shape); + BRepBuilderAPI_Copy c(shape, + PyObject_IsTrue(copyGeom) ? Standard_True : Standard_False, + PyObject_IsTrue(copyMesh) ? Standard_True : Standard_False); static_cast(cpy)->getTopoShapePtr()->setShape(c.Shape()); } return cpy;