Sketcher: Use PyObject_IsTrue in combination with conditional ternary operator

This commit is contained in:
marioalexis
2022-05-17 12:44:11 -03:00
committed by Chris Hennes
parent f78412c75b
commit 51f3727d3c

View File

@@ -1080,7 +1080,7 @@ PyObject* SketchObjectPy::fillet(PyObject *args)
Base::Vector3d v1 = static_cast<Base::VectorPy*>(pcObj1)->value();
Base::Vector3d v2 = static_cast<Base::VectorPy*>(pcObj2)->value();
if (this->getSketchObjectPtr()->fillet(geoId1, geoId2, v1, v2, radius, trim, PyObject_IsTrue(createCorner))) {
if (this->getSketchObjectPtr()->fillet(geoId1, geoId2, v1, v2, radius, trim, PyObject_IsTrue(createCorner) ? true : false)) {
std::stringstream str;
str << "Not able to fillet curves with ids : (" << geoId1 << ", " << geoId2 << ") and points (" << v1.x << ", " << v1.y << ", " << v1.z << ") & "
<< "(" << v2.x << ", " << v2.y << ", " << v2.z << ")";
@@ -1094,7 +1094,7 @@ PyObject* SketchObjectPy::fillet(PyObject *args)
// Point, radius
if (PyArg_ParseTuple(args, "iid|iO!", &geoId1, &posId1, &radius, &trim, &PyBool_Type, &createCorner)) {
if (this->getSketchObjectPtr()->fillet(geoId1, (Sketcher::PointPos) posId1, radius, trim,
PyObject_IsTrue(createCorner))) {
PyObject_IsTrue(createCorner) ? true : false)) {
std::stringstream str;
str << "Not able to fillet point with ( geoId: " << geoId1 << ", PointPos: " << posId1 << " )";
PyErr_SetString(PyExc_ValueError, str.str().c_str());