Part: add method to return a reversed shape

This commit is contained in:
wmayer
2020-09-25 15:59:08 +02:00
parent 92fe662d65
commit da6cdb94a1
2 changed files with 30 additions and 0 deletions

View File

@@ -489,6 +489,11 @@ op: an optional string to be appended when auto generates element mapping.
<UserDocu>Reverses the orientation of this shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="reversed">
<Documentation>
<UserDocu>Reverses the orientation of a copy of this shape.</UserDocu>
</Documentation>
</Methode>
<Methode Name="complement">
<Documentation>
<UserDocu>Computes the complement of the orientation of this shape,

View File

@@ -1769,6 +1769,31 @@ PyObject* TopoShapePy::reverse(PyObject *args)
Py_Return;
}
PyObject* TopoShapePy::reversed(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
TopoDS_Shape shape = getTopoShapePtr()->getShape();
shape = shape.Reversed();
PyTypeObject* type = this->GetType();
PyObject* cpy = nullptr;
// let the type object decide
if (type->tp_new)
cpy = type->tp_new(type, this, 0);
if (!cpy) {
PyErr_SetString(PyExc_TypeError, "failed to create copy of shape");
return nullptr;
}
if (!shape.IsNull()) {
static_cast<TopoShapePy*>(cpy)->getTopoShapePtr()->setShape(shape);
}
return cpy;
}
PyObject* TopoShapePy::complement(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))