Part: adjust TopoShape::transformGShape() to reduce code duplication of TopoShape::makeGTransform

Revert changes of a96d356afb as otherwise there is no way to handle a failure in client code
This commit is contained in:
wmayer
2022-04-29 14:57:05 +02:00
parent cd65de7e44
commit cb7d7d27a2
3 changed files with 10 additions and 33 deletions

View File

@@ -1374,16 +1374,16 @@ PyObject* TopoShapePy::mirror(PyObject *args)
PyObject* TopoShapePy::transformGeometry(PyObject *args)
{
PyObject *obj;
if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type),&obj))
PyObject *cpy = Py_False;
if (!PyArg_ParseTuple(args, "O!|O!", &(Base::MatrixPy::Type), &obj, &PyBool_Type, &cpy))
return nullptr;
Base::Matrix4D mat = static_cast<Base::MatrixPy*>(obj)->value();
try {
TopoDS_Shape shape = this->getTopoShapePtr()->transformGShape(mat);
Base::Matrix4D mat = static_cast<Base::MatrixPy*>(obj)->value();
TopoDS_Shape shape = this->getTopoShapePtr()->transformGShape(mat, PyObject_IsTrue(cpy) ? true : false);
return new TopoShapePy(new TopoShape(shape));
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return nullptr;
}