diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 1a2ad912e7..5c5bffd538 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -331,7 +331,7 @@ private: throw Py::Exception(); TopoDS_Shape sh = static_cast(shape)->getTopoShapePtr()->getShape(); - bool ok = ShapeFix::SameParameter(sh, PyObject_IsTrue(enforce) ? Standard_True : Standard_False, prec); + bool ok = ShapeFix::SameParameter(sh, Base::asBoolean(enforce), prec); return Py::Boolean(ok); } Py::Object encodeRegularity(const Py::Tuple& args) @@ -1346,7 +1346,7 @@ private: Standard_Failure::Raise("Cannot create polygon because less than two vertices are given"); // if the polygon should be closed - if (PyObject_IsTrue(pclosed) ? true : false) { + if (Base::asBoolean(pclosed)) { if (!mkPoly.FirstVertex().IsSame(mkPoly.LastVertex())) { mkPoly.Add(mkPoly.FirstVertex()); } @@ -1527,8 +1527,8 @@ private: try { TopoShape helix; - Standard_Boolean anIsLeft = PyObject_IsTrue(pleft) ? Standard_True : Standard_False; - Standard_Boolean anIsVertHeight = PyObject_IsTrue(pvertHeight) ? Standard_True : Standard_False; + Standard_Boolean anIsLeft = Base::asBoolean(pleft); + Standard_Boolean anIsVertHeight = Base::asBoolean(pvertHeight); TopoDS_Shape wire = helix.makeHelix(pitch, height, radius, angle, anIsLeft, anIsVertHeight); return Py::asObject(new TopoShapeWirePy(new TopoShape(wire))); @@ -1548,7 +1548,7 @@ private: try { TopoShape helix; - Standard_Boolean anIsLeft = PyObject_IsTrue(pleft) ? Standard_True : Standard_False; + Standard_Boolean anIsLeft = Base::asBoolean(pleft); TopoDS_Shape wire = helix.makeLongHelix(pitch, height, radius, angle, anIsLeft); return Py::asObject(new TopoShapeWirePy(new TopoShape(wire))); } @@ -1865,9 +1865,9 @@ private: } TopoShape myShape; - Standard_Boolean anIsSolid = PyObject_IsTrue(psolid) ? Standard_True : Standard_False; - Standard_Boolean anIsRuled = PyObject_IsTrue(pruled) ? Standard_True : Standard_False; - Standard_Boolean anIsClosed = PyObject_IsTrue(pclosed) ? Standard_True : Standard_False; + Standard_Boolean anIsSolid = Base::asBoolean(psolid); + Standard_Boolean anIsRuled = Base::asBoolean(pruled); + Standard_Boolean anIsClosed = Base::asBoolean(pclosed); TopoDS_Shape aResult = myShape.makeLoft(profiles, anIsSolid, anIsRuled, anIsClosed, degMax); return Py::asObject(new TopoShapePy(new TopoShape(aResult))); #endif @@ -1885,7 +1885,7 @@ private: TopoDS_Shape initShape = static_cast (shape)->getTopoShapePtr()->getShape(); BRepFeat_SplitShape splitShape(initShape); - splitShape.SetCheckInterior(PyObject_IsTrue(checkInterior) ? Standard_True : Standard_False); + splitShape.SetCheckInterior(Base::asBoolean(checkInterior)); Py::Sequence seq(list); for (Py::Sequence::iterator it = seq.begin(); it != seq.end(); ++it) { @@ -2283,10 +2283,10 @@ private: Base::Matrix4D mat; if(pyMat) mat = *static_cast(pyMat)->getMatrixPtr(); - auto shape = Feature::getTopoShape(obj,subname,PyObject_IsTrue(needSubElement) ? true : false, - &mat,&subObj,retType==2,PyObject_IsTrue(transform) ? true : false, - PyObject_IsTrue(noElementMap) ? true : false); - if (PyObject_IsTrue(refine) ? true : false) { + auto shape = Feature::getTopoShape(obj,subname,Base::asBoolean(needSubElement), + &mat,&subObj,retType==2,Base::asBoolean(transform), + Base::asBoolean(noElementMap)); + if (Base::asBoolean(refine)) { // shape = TopoShape(0,shape.Hasher).makERefine(shape); BRepBuilderAPI_RefineModel mkRefine(shape.getShape()); shape.setShape(mkRefine.Shape()); diff --git a/src/Mod/Part/App/ArcOfCirclePyImp.cpp b/src/Mod/Part/App/ArcOfCirclePyImp.cpp index 7057f49b18..05c17f0a18 100644 --- a/src/Mod/Part/App/ArcOfCirclePyImp.cpp +++ b/src/Mod/Part/App/ArcOfCirclePyImp.cpp @@ -80,7 +80,7 @@ int ArcOfCirclePy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast (static_cast(o)->getGeomCirclePtr()->handle()); - GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/ArcOfEllipsePyImp.cpp b/src/Mod/Part/App/ArcOfEllipsePyImp.cpp index e9f7d7b8e8..cf592b4463 100644 --- a/src/Mod/Part/App/ArcOfEllipsePyImp.cpp +++ b/src/Mod/Part/App/ArcOfEllipsePyImp.cpp @@ -89,7 +89,7 @@ int ArcOfEllipsePy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast (static_cast(o)->getGeomEllipsePtr()->handle()); - GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp b/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp index efff7240cd..437557339a 100644 --- a/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp +++ b/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp @@ -89,7 +89,7 @@ int ArcOfHyperbolaPy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast (static_cast(o)->getGeomHyperbolaPtr()->handle()); - GC_MakeArcOfHyperbola arc(hyperbola->Hypr(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfHyperbola arc(hyperbola->Hypr(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/ArcOfParabolaPyImp.cpp b/src/Mod/Part/App/ArcOfParabolaPyImp.cpp index 9d4c0df626..beeaac9e63 100644 --- a/src/Mod/Part/App/ArcOfParabolaPyImp.cpp +++ b/src/Mod/Part/App/ArcOfParabolaPyImp.cpp @@ -87,7 +87,7 @@ int ArcOfParabolaPy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom_Parabola) parabola = Handle(Geom_Parabola)::DownCast (static_cast(o)->getGeomParabolaPtr()->handle()); - GC_MakeArcOfParabola arc(parabola->Parab(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfParabola arc(parabola->Parab(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/ArcPyImp.cpp b/src/Mod/Part/App/ArcPyImp.cpp index 8714ee404b..a3e5908e6b 100644 --- a/src/Mod/Part/App/ArcPyImp.cpp +++ b/src/Mod/Part/App/ArcPyImp.cpp @@ -69,7 +69,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) try { Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast (static_cast(o)->getGeomCirclePtr()->handle()); - GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfCircle arc(circle->Circ(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; @@ -114,7 +114,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) try { Handle(Geom_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast (static_cast(o)->getGeomEllipsePtr()->handle()); - GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfEllipse arc(ellipse->Elips(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; @@ -139,7 +139,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) try { Handle(Geom_Parabola) parabola = Handle(Geom_Parabola)::DownCast (static_cast(o)->getGeomParabolaPtr()->handle()); - GC_MakeArcOfParabola arc(parabola->Parab(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfParabola arc(parabola->Parab(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; @@ -164,7 +164,7 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) try { Handle(Geom_Hyperbola) hyperbola = Handle(Geom_Hyperbola)::DownCast (static_cast(o)->getGeomHyperbolaPtr()->handle()); - GC_MakeArcOfHyperbola arc(hyperbola->Hypr(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GC_MakeArcOfHyperbola arc(hyperbola->Hypr(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp b/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp index b40f331648..99f5f29729 100644 --- a/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp +++ b/src/Mod/Part/App/BRepFeat/MakePrismPyImp.cpp @@ -66,7 +66,7 @@ int MakePrismPy::PyInit(PyObject* args, PyObject* kwds) TopoDS_Face skface = TopoDS::Face(static_cast(Skface)->getTopoShapePtr()->getShape()); Base::Vector3d dir = static_cast(Direction)->value(); std::unique_ptr ptr(new BRepFeat_MakePrism(sbase, pbase, skface, gp_Dir(dir.x, dir.y, dir.z), Fuse, - PyObject_IsTrue(Modify) ? Standard_True : Standard_False)); + Base::asBoolean(Modify))); setTwinPointer(ptr.release()); return 0; @@ -126,7 +126,7 @@ PyObject* MakePrismPy::init(PyObject *args, PyObject* kwds) TopoDS_Face skface = TopoDS::Face(static_cast(Skface)->getTopoShapePtr()->getShape()); Base::Vector3d dir = static_cast(Direction)->value(); getBRepFeat_MakePrismPtr()->Init(sbase, pbase, skface, gp_Dir(dir.x, dir.y, dir.z), Fuse, - PyObject_IsTrue(Modify) ? Standard_True : Standard_False); + Base::asBoolean(Modify)); Py_Return; } diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp index d82bc4c591..a07d38e8be 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakeFillingPyImp.cpp @@ -100,7 +100,7 @@ int BRepOffsetAPI_MakeFillingPy::PyInit(PyObject* args, PyObject* kwds) try { std::unique_ptr ptr(new BRepOffsetAPI_MakeFilling(degree, nbPtsOnCur, nbIter, - PyObject_IsTrue(anisotropy) ? Standard_True : Standard_False, + Base::asBoolean(anisotropy), tol2d, tol3d, tolAng, tolCurv, maxDeg, maxSegments)); @@ -155,7 +155,7 @@ PyObject* BRepOffsetAPI_MakeFillingPy::setResolParam(PyObject *args, PyObject *k try { getBRepOffsetAPI_MakeFillingPtr()->SetResolParam(degree, nbPtsOnCur, nbIter, - PyObject_IsTrue(anisotropy) ? Standard_True : Standard_False); + Base::asBoolean(anisotropy)); Py_Return; } catch (const Standard_Failure& e) { @@ -273,7 +273,7 @@ PyObject* BRepOffsetAPI_MakeFillingPy::add(PyObject *args, PyObject *kwds) } getBRepOffsetAPI_MakeFillingPtr()->Add(edge, static_cast(order), - PyObject_IsTrue(isbound) ? Standard_True : Standard_False); + Base::asBoolean(isbound)); Py_Return; } catch (const Standard_Failure& e) { @@ -307,7 +307,7 @@ PyObject* BRepOffsetAPI_MakeFillingPy::add(PyObject *args, PyObject *kwds) } getBRepOffsetAPI_MakeFillingPtr()->Add(edge, face, static_cast(order), - PyObject_IsTrue(isbound) ? Standard_True : Standard_False); + Base::asBoolean(isbound)); Py_Return; } catch (const Standard_Failure& e) { diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp index 047d2cfa15..592d2cd387 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp @@ -78,7 +78,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args) return nullptr; try { - this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(PyObject_IsTrue(obj) ? Standard_True : Standard_False); + this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(Base::asBoolean(obj)); Py_Return; } catch (Standard_Failure& e) { @@ -169,7 +169,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) } this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode( TopoDS::Wire(s), - PyObject_IsTrue(curv) ? Standard_True : Standard_False, + Base::asBoolean(curv), typeOfCantact); Py_Return; } @@ -189,9 +189,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) ,&PyBool_Type,&keep)) { try { const TopoDS_Shape& s = static_cast(prof)->getTopoShapePtr()->getShape(); - this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, - PyObject_IsTrue(curv) ? Standard_True : Standard_False, - PyObject_IsTrue(keep) ? Standard_True : Standard_False); + this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, Base::asBoolean(curv), Base::asBoolean(keep)); Py_Return; } catch (Standard_Failure& e) { @@ -211,9 +209,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) try { const TopoDS_Shape& s = static_cast(prof)->getTopoShapePtr()->getShape(); const TopoDS_Vertex& v = TopoDS::Vertex(static_cast(loc)->getTopoShapePtr()->getShape()); - this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, v, - PyObject_IsTrue(curv) ? Standard_True : Standard_False, - PyObject_IsTrue(keep) ? Standard_True : Standard_False); + this->getBRepOffsetAPI_MakePipeShellPtr()->Add(s, v, Base::asBoolean(curv), Base::asBoolean(keep)); Py_Return; } catch (Standard_Failure& e) { @@ -446,7 +442,7 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args) return nullptr; try { - this->getBRepOffsetAPI_MakePipeShellPtr()->SetForceApproxC1(PyObject_IsTrue(obj) ? Standard_True : Standard_False); + this->getBRepOffsetAPI_MakePipeShellPtr()->SetForceApproxC1(Base::asBoolean(obj)); Py_Return; } catch (Standard_Failure& e) { diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index 9b5f76d9fe..f16aa93e2a 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -213,7 +213,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args) try { Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); - curve->InsertKnot(U,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + curve->InsertKnot(U, M, tol, Base::asBoolean(add)); } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); @@ -252,7 +252,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args) Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast (getGeometryPtr()->handle()); - curve->InsertKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + curve->InsertKnots(k, m, tol, Base::asBoolean(add)); Py_Return; } catch (Standard_Failure& e) { @@ -1044,19 +1044,18 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds) std::unique_ptr aBSplineInterpolation; if (parameters.IsNull()) { aBSplineInterpolation.reset(new GeomAPI_Interpolate(interpolationPoints, - PyObject_IsTrue(periodic) ? Standard_True : Standard_False, tol3d)); + Base::asBoolean(periodic), tol3d)); } else { aBSplineInterpolation.reset(new GeomAPI_Interpolate(interpolationPoints, parameters, - PyObject_IsTrue(periodic) ? Standard_True : Standard_False, tol3d)); + Base::asBoolean(periodic), tol3d)); } if (t1 && t2) { Base::Vector3d v1 = Py::Vector(t1,false).toVector(); Base::Vector3d v2 = Py::Vector(t2,false).toVector(); gp_Vec initTangent(v1.x,v1.y,v1.z), finalTangent(v2.x,v2.y,v2.z); - aBSplineInterpolation->Load(initTangent, finalTangent, PyObject_IsTrue(scale) - ? Standard_True : Standard_False); + aBSplineInterpolation->Load(initTangent, finalTangent, Base::asBoolean(scale)); } else if (ts && fl) { Py::Sequence tlist(ts); @@ -1076,8 +1075,7 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds) tangentFlags->SetValue(findex++, static_cast(flag) ? Standard_True : Standard_False); } - aBSplineInterpolation->Load(tangents, tangentFlags, PyObject_IsTrue(scale) - ? Standard_True : Standard_False); + aBSplineInterpolation->Load(tangents, tangentFlags, Base::asBoolean(scale)); } aBSplineInterpolation->Perform(); @@ -1120,10 +1118,10 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args) if (poles.Length() <= degree) degree = poles.Length()-1; - if (PyObject_IsTrue(periodic) ? true : false) { + if (Base::asBoolean(periodic)) { int mult; int len; - if (PyObject_IsTrue(interpolate) ? true : false) { + if (Base::asBoolean(interpolate)) { mult = degree; len = poles.Length() - mult + 2; } @@ -1227,7 +1225,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key else { if (knots != Py_None) { number_of_knots = PyObject_Length(knots); } else { //guess number of knots - if (PyObject_IsTrue(periodic) ? true : false) { + if (Base::asBoolean(periodic)) { if (number_of_poles < degree) {degree = number_of_poles+1;} number_of_knots = number_of_poles+1; } @@ -1302,15 +1300,14 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key } } // check if the number of poles matches the sum of mults - if (((PyObject_IsTrue(periodic) ? true : false) && sum_of_mults != number_of_poles) || + if ((Base::asBoolean(periodic) && sum_of_mults != number_of_poles) || ((PyObject_Not(periodic) ? true : false) && sum_of_mults - degree -1 != number_of_poles)) { Standard_Failure::Raise("number of poles and sum of mults mismatch"); return(nullptr); } Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree, - PyObject_IsTrue(periodic) ? Standard_True : Standard_False, - PyObject_IsTrue(CheckRational) ? Standard_True : Standard_False); + Base::asBoolean(periodic), Base::asBoolean(CheckRational)); if (!spline.IsNull()) { this->getGeomBSplineCurvePtr()->setHandle(spline); Py_Return; diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index 28e69ab5ef..05e50cdbec 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -247,7 +247,7 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args) try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); - surf->InsertUKnot(U,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + surf->InsertUKnot(U, M, tol, Base::asBoolean(add)); } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); @@ -286,7 +286,7 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args) Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); - surf->InsertUKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + surf->InsertUKnots(k, m, tol, Base::asBoolean(add)); Py_Return; } catch (Standard_Failure& e) { @@ -308,7 +308,7 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args) try { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); - surf->InsertVKnot(V,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + surf->InsertVKnot(V, M, tol, Base::asBoolean(add)); } catch (Standard_Failure& e) { PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); @@ -347,7 +347,7 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args) Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); - surf->InsertVKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + surf->InsertVKnots(k, m, tol, Base::asBoolean(add)); Py_Return; } catch (Standard_Failure& e) { @@ -1453,9 +1453,9 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k occvknots.SetValue(i,(double)(i-1)/(occvknots.Length()-1)); } } - if (((PyObject_IsTrue(uperiodic) ? true : false) && sum_of_umults != lu) || + if ((Base::asBoolean(uperiodic) && sum_of_umults != lu) || ((PyObject_Not(uperiodic) ? true : false) && sum_of_umults - udegree -1 != lu) || - ((PyObject_IsTrue(vperiodic) ? true : false) && sum_of_vmults != lv) || + (Base::asBoolean(vperiodic) && sum_of_vmults != lv) || ((PyObject_Not(vperiodic) ? true : false) && sum_of_vmults - vdegree -1 != lv)) { Standard_Failure::Raise("number of poles and sum of mults mismatch"); } @@ -1473,8 +1473,8 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k Handle(Geom_BSplineSurface) spline = new Geom_BSplineSurface(occpoles,occweights, occuknots,occvknots,occumults,occvmults,udegree,vdegree, - PyObject_IsTrue(uperiodic) ? Standard_True : Standard_False, - PyObject_IsTrue(vperiodic) ? Standard_True : Standard_False); + Base::asBoolean(uperiodic), + Base::asBoolean(vperiodic)); if (!spline.IsNull()) { this->getGeomBSplineSurfacePtr()->setHandle(spline); Py_Return; @@ -1534,7 +1534,7 @@ PyObject* BSplineSurfacePy::buildFromNSections(PyObject *args) } GeomFill_NSections fillOp(curveSeq); - if (PyObject_IsTrue(refSurf) ? true : false) { + if (Base::asBoolean(refSurf)) { Handle(Geom_BSplineSurface) ref = Handle(Geom_BSplineSurface)::DownCast (getGeometryPtr()->handle()); fillOp.SetSurface(ref); diff --git a/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp index f41607e2d0..25ef756a10 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp @@ -62,7 +62,7 @@ int ArcOfCircle2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom2d_Circle) circle = Handle(Geom2d_Circle)::DownCast (static_cast(o)->getGeom2dCirclePtr()->handle()); - GCE2d_MakeArcOfCircle arc(circle->Circ2d(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GCE2d_MakeArcOfCircle arc(circle->Circ2d(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp index 23710b7604..5a0ecbe6ab 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp @@ -60,7 +60,7 @@ int ArcOfEllipse2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom2d_Ellipse) ellipse = Handle(Geom2d_Ellipse)::DownCast (static_cast(o)->getGeom2dEllipsePtr()->handle()); - GCE2d_MakeArcOfEllipse arc(ellipse->Elips2d(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GCE2d_MakeArcOfEllipse arc(ellipse->Elips2d(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp index 0efd3e954f..a20d9f6713 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp @@ -60,7 +60,7 @@ int ArcOfHyperbola2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom2d_Hyperbola) hyperbola = Handle(Geom2d_Hyperbola)::DownCast (static_cast(o)->getGeom2dHyperbolaPtr()->handle()); - GCE2d_MakeArcOfHyperbola arc(hyperbola->Hypr2d(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GCE2d_MakeArcOfHyperbola arc(hyperbola->Hypr2d(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp index bbfaa12c10..f7cc422bb4 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp @@ -60,7 +60,7 @@ int ArcOfParabola2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) try { Handle(Geom2d_Parabola) parabola = Handle(Geom2d_Parabola)::DownCast (static_cast(o)->getGeom2dParabolaPtr()->handle()); - GCE2d_MakeArcOfParabola arc(parabola->Parab2d(), u1, u2, PyObject_IsTrue(sense) ? Standard_True : Standard_False); + GCE2d_MakeArcOfParabola arc(parabola->Parab2d(), u1, u2, Base::asBoolean(sense)); if (!arc.IsDone()) { PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(arc.Status())); return -1; diff --git a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp index df3bd1589f..c21b2ea909 100644 --- a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp @@ -212,7 +212,7 @@ PyObject* BSplineCurve2dPy::insertKnots(PyObject * args) Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast (getGeometry2dPtr()->handle()); - curve->InsertKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); + curve->InsertKnots(k, m, tol, Base::asBoolean(add)); Py_Return; } catch (Standard_Failure& e) { @@ -950,11 +950,11 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds) std::unique_ptr aBSplineInterpolation; if (parameters.IsNull()) { aBSplineInterpolation.reset(new Geom2dAPI_Interpolate(interpolationPoints, - PyObject_IsTrue(periodic) ? Standard_True : Standard_False, tol3d)); + Base::asBoolean(periodic), tol3d)); } else { aBSplineInterpolation.reset(new Geom2dAPI_Interpolate(interpolationPoints, parameters, - PyObject_IsTrue(periodic) ? Standard_True : Standard_False, tol3d)); + Base::asBoolean(periodic), tol3d)); } if (t1 && t2) { @@ -1022,10 +1022,10 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args) if (poles.Length() <= degree) degree = poles.Length()-1; - if (PyObject_IsTrue(periodic) ? true : false) { + if (Base::asBoolean(periodic)) { int mult; int len; - if (PyObject_IsTrue(interpolate) ? true : false) { + if (Base::asBoolean(interpolate)) { mult = degree; len = poles.Length() - mult + 2; } @@ -1126,7 +1126,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k else { if (knots != Py_None) { number_of_knots = PyObject_Length(knots); } else { //guess number of knots - if (PyObject_IsTrue(periodic) ? true : false) { + if (Base::asBoolean(periodic)) { if (number_of_poles < degree) {degree = number_of_poles+1;} number_of_knots = number_of_poles+1; } @@ -1193,14 +1193,14 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k } } // check if the number of poles matches the sum of mults - if (((PyObject_IsTrue(periodic) ? true : false) && sum_of_mults != number_of_poles) || + if (((Base::asBoolean(periodic)) && sum_of_mults != number_of_poles) || ((PyObject_Not(periodic) ? true : false) && sum_of_mults - degree -1 != number_of_poles)) { Standard_Failure::Raise("number of poles and sum of mults mismatch"); return(nullptr); } - Handle(Geom2d_BSplineCurve) spline = new Geom2d_BSplineCurve(occpoles,occweights,occknots,occmults,degree, - PyObject_IsTrue(periodic) ? Standard_True : Standard_False); + Handle(Geom2d_BSplineCurve) spline = new Geom2d_BSplineCurve(occpoles, occweights, occknots, + occmults, degree, Base::asBoolean(periodic)); if (!spline.IsNull()) { this->getGeom2dBSplineCurvePtr()->setHandle(spline); Py_Return; diff --git a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp index 947eec1a75..f44dcb5c23 100644 --- a/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/GeomPlate/BuildPlateSurfacePyImp.cpp @@ -103,7 +103,7 @@ int BuildPlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) try { std::unique_ptr ptr(new GeomPlate_BuildPlateSurface (degree, nbPtsOnCur, nbIter, tol2d, tol3d, tolAng, tolCurv, - PyObject_IsTrue(anisotropy) ? Standard_True : Standard_False)); + Base::asBoolean(anisotropy))); if (surf) { GeomSurface* surface = static_cast(surf)->getGeomSurfacePtr(); diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 85168470f5..b9728251dd 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -1688,8 +1688,8 @@ void GeomBSplineCurve::Restore(Base::XMLReader& reader) // Handle(Geom_BSplineCurve) spline = new // Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree, - // PyObject_IsTrue(periodic) ? Standard_True : Standard_False, - // PyObject_IsTrue(CheckRational) ? Standard_True : Standard_False); + // Base::asBoolean(periodic), + // Base::asBoolean(CheckRational)); TColgp_Array1OfPnt p(1,polescount); TColStd_Array1OfReal w(1,polescount); diff --git a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp index c7ec94e454..4bd64c3b9e 100644 --- a/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp +++ b/src/Mod/Part/App/GeometryBoolExtensionPyImp.cpp @@ -62,14 +62,14 @@ int GeometryBoolExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/) PyErr_Clear(); PyObject* val; if (PyArg_ParseTuple(args, "O!", &PyBool_Type, &val)) { - this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(val) ? true : false); + this->getGeometryBoolExtensionPtr()->setValue(Base::asBoolean(val)); return 0; } PyErr_Clear(); char * pystr; if (PyArg_ParseTuple(args, "O!s", &PyBool_Type, &val, &pystr)) { - this->getGeometryBoolExtensionPtr()->setValue(PyObject_IsTrue(val) ? true : false); + this->getGeometryBoolExtensionPtr()->setValue(Base::asBoolean(val)); this->getGeometryBoolExtensionPtr()->setName(pystr); return 0; } diff --git a/src/Mod/Part/App/GeometryCurvePyImp.cpp b/src/Mod/Part/App/GeometryCurvePyImp.cpp index 4b1bf41b3f..1b17d1e969 100644 --- a/src/Mod/Part/App/GeometryCurvePyImp.cpp +++ b/src/Mod/Part/App/GeometryCurvePyImp.cpp @@ -925,8 +925,8 @@ PyObject* GeometryCurvePy::continuityWith(PyObject *args) if (u2 < 0.0) u2 = c2->FirstParameter(); - Standard_Boolean r1 = PyObject_IsTrue(rev1) ? Standard_True : Standard_False; - Standard_Boolean r2 = PyObject_IsTrue(rev2) ? Standard_True : Standard_False; + Standard_Boolean r1 = Base::asBoolean(rev1); + Standard_Boolean r2 = Base::asBoolean(rev2); try { if (!c1.IsNull() && !c2.IsNull()) { diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index d0ac2e1ba3..fdbf4069b9 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -143,7 +143,7 @@ PyObject* GeometrySurfacePy::toShell(PyObject *args, PyObject* kwds) try { if (!s.IsNull()) { if (segm) { - Standard_Boolean segment = PyObject_IsTrue(segm) ? Standard_True : Standard_False; + Standard_Boolean segment = Base::asBoolean(segm); BRepBuilderAPI_MakeShell mkBuilder(s, segment); TopoDS_Shape sh = mkBuilder.Shape(); return new TopoShapeShellPy(new TopoShape(sh)); diff --git a/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp b/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp index b8a8fb9ca7..9e39f386a6 100644 --- a/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/HLRToShapePyImp.cpp @@ -252,14 +252,12 @@ PyObject* HLRToShapePy::compoundOfEdges(PyObject *args, PyObject *kwds) if (shape) { TopoDS_Shape input = static_cast(shape)->getTopoShapePtr()->getShape(); TopoDS_Shape result = getHLRBRep_HLRToShapePtr()->CompoundOfEdges(input, static_cast(type), - PyObject_IsTrue(visible) ? Standard_True : Standard_False, - PyObject_IsTrue(in3d) ? Standard_True : Standard_False); + Base::asBoolean(visible), Base::asBoolean(in3d)); return new TopoShapePy(new TopoShape(result)); } else { TopoDS_Shape result = getHLRBRep_HLRToShapePtr()->CompoundOfEdges(static_cast(type), - PyObject_IsTrue(visible) ? Standard_True : Standard_False, - PyObject_IsTrue(in3d) ? Standard_True : Standard_False); + Base::asBoolean(visible), Base::asBoolean(in3d)); return new TopoShapePy(new TopoShape(result)); } } diff --git a/src/Mod/Part/App/PlateSurfacePyImp.cpp b/src/Mod/Part/App/PlateSurfacePyImp.cpp index c3a56c6f31..1233510ead 100644 --- a/src/Mod/Part/App/PlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/PlateSurfacePyImp.cpp @@ -94,7 +94,7 @@ int PlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) try { GeomPlate_BuildPlateSurface buildPlate(Degree, NbPtsOnCur, NbIter, Tol2d, Tol3d, TolAng, TolCurv, - PyObject_IsTrue(Anisotropie) ? Standard_True : Standard_False); + Base::asBoolean(Anisotropie)); if (!surf.IsNull()) { buildPlate.LoadInitSurface(surf); diff --git a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp index 7331761be0..09a7658b88 100644 --- a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp +++ b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp @@ -59,8 +59,8 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/) Handle(Geom_Surface)::DownCast(static_cast(surf)-> getGeomSurfacePtr()->handle()), u1, u2, v1, v2, - PyObject_IsTrue(usense) ? Standard_True : Standard_False, - PyObject_IsTrue(vsense) ? Standard_True : Standard_False + Base::asBoolean(usense), + Base::asBoolean(vsense) )); return 0; } @@ -70,8 +70,8 @@ int RectangularTrimmedSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/) PyObject *utrim=Py_False, *sense=Py_True; if (PyArg_ParseTuple(args, "O!ddO!|O!",&(Part::GeometrySurfacePy::Type),&surf, ¶m1,¶m2,&PyBool_Type,&utrim,&PyBool_Type,&sense)) { - Standard_Boolean UTrim = PyObject_IsTrue(utrim) ? Standard_True : Standard_False; - Standard_Boolean Sense = PyObject_IsTrue(sense) ? Standard_True : Standard_False; + Standard_Boolean UTrim = Base::asBoolean(utrim); + Standard_Boolean Sense = Base::asBoolean(sense); getGeomTrimmedSurfacePtr()->setHandle(new Geom_RectangularTrimmedSurface( Handle(Geom_Surface)::DownCast(static_cast(surf)-> getGeomSurfacePtr()->handle()), diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePyImp.cpp index e10de77e1a..01a460c3d1 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_EdgePyImp.cpp @@ -116,7 +116,7 @@ PyObject* ShapeFix_EdgePy::fixAddPCurve(PyObject *args) TopoDS_Shape f = static_cast(face)->getTopoShapePtr()->getShape(); bool ok = getShapeFix_EdgePtr()->FixAddPCurve(TopoDS::Edge(e), TopoDS::Face(f), - PyObject_IsTrue(seam) ? Standard_True : Standard_False, + Base::asBoolean(seam), prec); return Py::new_reference_to(Py::Boolean(ok)); } @@ -133,7 +133,7 @@ PyObject* ShapeFix_EdgePy::fixAddPCurve(PyObject *args) TopLoc_Location loc = Tools::fromPlacement(*pm); bool ok = getShapeFix_EdgePtr()->FixAddPCurve(TopoDS::Edge(e), surf, loc, - PyObject_IsTrue(seam) ? Standard_True : Standard_False, + Base::asBoolean(seam), prec); return Py::new_reference_to(Py::Boolean(ok)); } diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_FacePyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_FacePyImp.cpp index 46cc5e146f..f7bd455fda 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_FacePyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_FacePyImp.cpp @@ -67,7 +67,7 @@ int ShapeFix_FacePy::PyInit(PyObject* args, PyObject* /*kwds*/) setHandle(new ShapeFix_Face()); if (face) { Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast(static_cast(face)->getGeomSurfacePtr()->handle()); - getShapeFix_FacePtr()->Init(surf, prec, PyObject_IsTrue(fwd) ? Standard_True : Standard_False); + getShapeFix_FacePtr()->Init(surf, prec, Base::asBoolean(fwd)); } return 0; @@ -96,7 +96,7 @@ PyObject* ShapeFix_FacePy::init(PyObject *args) if (PyArg_ParseTuple(args, "O!d|O!", &GeometrySurfacePy::Type, &face, &prec, &PyBool_Type, &fwd)) { if (face) { Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast(static_cast(face)->getGeomSurfacePtr()->handle()); - getShapeFix_FacePtr()->Init(surf, prec, PyObject_IsTrue(fwd) ? Standard_True : Standard_False); + getShapeFix_FacePtr()->Init(surf, prec, Base::asBoolean(fwd)); } Py_Return; @@ -174,7 +174,7 @@ PyObject* ShapeFix_FacePy::fixSmallAreaWire(PyObject *args) if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &removeSmall)) return nullptr; - Standard_Boolean ok = getShapeFix_FacePtr()->FixSmallAreaWire(PyObject_IsTrue(removeSmall) ? Standard_True : Standard_False); + Standard_Boolean ok = getShapeFix_FacePtr()->FixSmallAreaWire(Base::asBoolean(removeSmall)); return Py::new_reference_to(Py::Boolean(ok)); } diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_FixSmallFacePyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_FixSmallFacePyImp.cpp index bf4575f47d..1b6ecf9541 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_FixSmallFacePyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_FixSmallFacePyImp.cpp @@ -108,7 +108,7 @@ PyObject* ShapeFix_FixSmallFacePy::fixStripFace(PyObject *args) if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &wasdone)) return nullptr; - TopoShape sh = getShapeFix_FixSmallFacePtr()->FixStripFace(PyObject_IsTrue(wasdone) ? Standard_True : Standard_False); + TopoShape sh = getShapeFix_FixSmallFacePtr()->FixStripFace(Base::asBoolean(wasdone)); return sh.getPyObject(); } diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_FreeBoundsPyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_FreeBoundsPyImp.cpp index 22cf89c550..63bbc279dd 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_FreeBoundsPyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_FreeBoundsPyImp.cpp @@ -61,8 +61,8 @@ int ShapeFix_FreeBoundsPy::PyInit(PyObject* args, PyObject* /*kwds*/) &PyBool_Type, &splitclosed, &PyBool_Type, &splitopen)) { TopoDS_Shape sh = static_cast(shape)->getTopoShapePtr()->getShape(); setTwinPointer(new ShapeFix_FreeBounds(sh, sewtoler, closetoler, - PyObject_IsTrue(splitclosed) ? Standard_True : Standard_False, - PyObject_IsTrue(splitopen) ? Standard_True : Standard_False)); + Base::asBoolean(splitclosed), + Base::asBoolean(splitopen))); return 0; } @@ -71,8 +71,8 @@ int ShapeFix_FreeBoundsPy::PyInit(PyObject* args, PyObject* /*kwds*/) &PyBool_Type, &splitclosed, &PyBool_Type, &splitopen)) { TopoDS_Shape sh = static_cast(shape)->getTopoShapePtr()->getShape(); setTwinPointer(new ShapeFix_FreeBounds(sh, closetoler, - PyObject_IsTrue(splitclosed) ? Standard_True : Standard_False, - PyObject_IsTrue(splitopen) ? Standard_True : Standard_False)); + Base::asBoolean(splitclosed), + Base::asBoolean(splitopen))); return 0; } diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_ShellPyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_ShellPyImp.cpp index d8cc6c9fff..13d40b6aee 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_ShellPyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_ShellPyImp.cpp @@ -137,8 +137,7 @@ PyObject* ShapeFix_ShellPy::fixFaceOrientation(PyObject *args) return nullptr; bool ok = getShapeFix_ShellPtr()->FixFaceOrientation(TopoDS::Shell(static_cast(shell)->getTopoShapePtr()->getShape()), - PyObject_IsTrue(multiConex) ? Standard_True : Standard_False, - PyObject_IsTrue(nonManifold) ? Standard_True : Standard_False); + Base::asBoolean(multiConex), Base::asBoolean(nonManifold)); return Py::new_reference_to(Py::Boolean(ok)); } @@ -148,7 +147,7 @@ PyObject* ShapeFix_ShellPy::setNonManifoldFlag(PyObject *args) if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &nonManifold)) return nullptr; - getShapeFix_ShellPtr()->SetNonManifoldFlag(PyObject_IsTrue(nonManifold) ? Standard_True : Standard_False); + getShapeFix_ShellPtr()->SetNonManifoldFlag(Base::asBoolean(nonManifold)); Py_Return; } diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_WirePyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_WirePyImp.cpp index b478eda156..1bc9a36ace 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_WirePyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_WirePyImp.cpp @@ -265,7 +265,7 @@ PyObject* ShapeFix_WirePy::fixSmall(PyObject *args) double prec = 0.0; if (PyArg_ParseTuple(args, "O!|d", &PyBool_Type, &lock, &prec)) { try { - int num = getShapeFix_WirePtr()->FixSmall(PyObject_IsTrue(lock) ? Standard_True : Standard_False, prec); + int num = getShapeFix_WirePtr()->FixSmall(Base::asBoolean(lock), prec); return Py::new_reference_to(Py::Long(num)); } catch (const Standard_Failure& e) { @@ -278,7 +278,7 @@ PyObject* ShapeFix_WirePy::fixSmall(PyObject *args) int num; if (PyArg_ParseTuple(args, "iO!d", &num, &PyBool_Type, &lock, &prec)) { try { - bool ok = getShapeFix_WirePtr()->FixSmall(num, PyObject_IsTrue(lock) ? Standard_True : Standard_False, prec); + bool ok = getShapeFix_WirePtr()->FixSmall(num, Base::asBoolean(lock), prec); return Py::new_reference_to(Py::Boolean(ok)); } catch (const Standard_Failure& e) { @@ -366,7 +366,7 @@ PyObject* ShapeFix_WirePy::fixLacking(PyObject *args) PyObject* force = Py_False; if (PyArg_ParseTuple(args, "|O!", &PyBool_Type, &force)) { try { - Standard_Boolean ok = getShapeFix_WirePtr()->FixLacking(PyObject_IsTrue(force) ? Standard_True : Standard_False); + Standard_Boolean ok = getShapeFix_WirePtr()->FixLacking(Base::asBoolean(force)); return Py::new_reference_to(Py::Boolean(ok)); } catch (const Standard_Failure& e) { @@ -380,7 +380,7 @@ PyObject* ShapeFix_WirePy::fixLacking(PyObject *args) force = Py_False; if (PyArg_ParseTuple(args, "i|O!", &num, &PyBool_Type, &force)) { try { - Standard_Boolean ok = getShapeFix_WirePtr()->FixLacking(num, PyObject_IsTrue(force) ? Standard_True : Standard_False); + Standard_Boolean ok = getShapeFix_WirePtr()->FixLacking(num, Base::asBoolean(force)); return Py::new_reference_to(Py::Boolean(ok)); } catch (const Standard_Failure& e) { @@ -431,7 +431,7 @@ PyObject* ShapeFix_WirePy::fixGap3d(PyObject *args) return nullptr; try { - Standard_Boolean ok = getShapeFix_WirePtr()->FixGap3d(num, PyObject_IsTrue(convert) ? Standard_True : Standard_False); + Standard_Boolean ok = getShapeFix_WirePtr()->FixGap3d(num, Base::asBoolean(convert)); return Py::new_reference_to(Py::Boolean(ok)); } catch (const Standard_Failure& e) { @@ -448,7 +448,7 @@ PyObject* ShapeFix_WirePy::fixGap2d(PyObject *args) return nullptr; try { - Standard_Boolean ok = getShapeFix_WirePtr()->FixGap2d(num, PyObject_IsTrue(convert) ? Standard_True : Standard_False); + Standard_Boolean ok = getShapeFix_WirePtr()->FixGap2d(num, Base::asBoolean(convert)); return Py::new_reference_to(Py::Boolean(ok)); } catch (const Standard_Failure& e) { diff --git a/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp b/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp index 82abc3cf60..7f6120cbcd 100644 --- a/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp +++ b/src/Mod/Part/App/ShapeUpgrade/UnifySameDomainPyImp.cpp @@ -62,9 +62,9 @@ int UnifySameDomainPy::PyInit(PyObject* args, PyObject* kwds) try { TopoDS_Shape shp = static_cast(shape)->getTopoShapePtr()->getShape(); std::unique_ptr ptr(new ShapeUpgrade_UnifySameDomain(shp, - PyObject_IsTrue(unifyEdges) ? Standard_True : Standard_False, - PyObject_IsTrue(unifyFaces) ? Standard_True : Standard_False, - PyObject_IsTrue(concatBSpl) ? Standard_True : Standard_False)); + Base::asBoolean(unifyEdges), + Base::asBoolean(unifyFaces), + Base::asBoolean(concatBSpl))); setTwinPointer(ptr.release()); return 0; @@ -93,9 +93,9 @@ PyObject* UnifySameDomainPy::initialize(PyObject *args, PyObject* kwds) try { TopoDS_Shape shp = static_cast(shape)->getTopoShapePtr()->getShape(); getShapeUpgrade_UnifySameDomainPtr()->Initialize(shp, - PyObject_IsTrue(unifyEdges) ? Standard_True : Standard_False, - PyObject_IsTrue(unifyFaces) ? Standard_True : Standard_False, - PyObject_IsTrue(concatBSpl) ? Standard_True : Standard_False); + Base::asBoolean(unifyEdges), + Base::asBoolean(unifyFaces), + Base::asBoolean(concatBSpl)); Py_Return; } @@ -118,7 +118,7 @@ PyObject* UnifySameDomainPy::allowInternalEdges(PyObject *args) return nullptr; try { - getShapeUpgrade_UnifySameDomainPtr()->AllowInternalEdges(PyObject_IsTrue(allow) ? Standard_True : Standard_False); + getShapeUpgrade_UnifySameDomainPtr()->AllowInternalEdges(Base::asBoolean(allow)); Py_Return; } catch (const Standard_Failure& e) { @@ -174,7 +174,7 @@ PyObject* UnifySameDomainPy::setSafeInputMode(PyObject *args) return nullptr; try { - getShapeUpgrade_UnifySameDomainPtr()->SetSafeInputMode(PyObject_IsTrue(mode) ? Standard_True : Standard_False); + getShapeUpgrade_UnifySameDomainPtr()->SetSafeInputMode(Base::asBoolean(mode)); Py_Return; } catch (const Standard_Failure& e) { diff --git a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp index ca0a4a582a..93f8f4de73 100644 --- a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp @@ -135,7 +135,7 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args) for (TopExp_Explorer xp(s, TopAbs_EDGE); xp.More(); xp.Next()) hEdges->Append(xp.Current()); - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, PyObject_IsTrue(shared) ? Standard_True : Standard_False, hWires); + ShapeAnalysis_FreeBounds::ConnectEdgesToWires(hEdges, tol, Base::asBoolean(shared), hWires); TopoDS_Compound comp; BRep_Builder builder; diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp index 5ce0b82375..6d2dbf75d0 100644 --- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp @@ -722,7 +722,7 @@ PyObject* TopoShapeEdgePy::firstVertex(PyObject *args) if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &orient)) return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); - TopoDS_Vertex v = TopExp::FirstVertex(e, PyObject_IsTrue(orient) ? Standard_True : Standard_False); + TopoDS_Vertex v = TopExp::FirstVertex(e, Base::asBoolean(orient)); return new TopoShapeVertexPy(new TopoShape(v)); } @@ -732,7 +732,7 @@ PyObject* TopoShapeEdgePy::lastVertex(PyObject *args) if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &orient)) return nullptr; const TopoDS_Edge& e = TopoDS::Edge(getTopoShapePtr()->getShape()); - TopoDS_Vertex v = TopExp::LastVertex(e, PyObject_IsTrue(orient) ? Standard_True : Standard_False); + TopoDS_Vertex v = TopExp::LastVertex(e, Base::asBoolean(orient)); return new TopoShapeVertexPy(new TopoShape(v)); } diff --git a/src/Mod/Part/App/TopoShapeFacePyImp.cpp b/src/Mod/Part/App/TopoShapeFacePyImp.cpp index 007c53bc22..039514992b 100644 --- a/src/Mod/Part/App/TopoShapeFacePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeFacePyImp.cpp @@ -473,9 +473,9 @@ PyObject* TopoShapeFacePy::makeEvolved(PyObject *args, PyObject *kwds) try { BRepOffsetAPI_MakeEvolved evolved(spine, profile, joinType, - PyObject_IsTrue(AxeProf) ? Standard_True : Standard_False, - PyObject_IsTrue(Solid) ? Standard_True : Standard_False, - PyObject_IsTrue(ProfOnSpine) ? Standard_True : Standard_False, + Base::asBoolean(AxeProf), + Base::asBoolean(Solid), + Base::asBoolean(ProfOnSpine), Tolerance); TopoDS_Shape shape = evolved.Shape(); return Py::new_reference_to(shape2pyshape(shape)); diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index c66d0faab1..a73d7d523f 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -176,9 +176,7 @@ PyObject* TopoShapePy::copy(PyObject *args) } if (!shape.IsNull()) { - BRepBuilderAPI_Copy c(shape, - PyObject_IsTrue(copyGeom) ? Standard_True : Standard_False, - PyObject_IsTrue(copyMesh) ? Standard_True : Standard_False); + BRepBuilderAPI_Copy c(shape, Base::asBoolean(copyGeom), Base::asBoolean(copyMesh)); static_cast(cpy)->getTopoShapePtr()->setShape(c.Shape()); } return cpy; @@ -713,7 +711,7 @@ PyObject* TopoShapePy::check(PyObject *args) if (!getTopoShapePtr()->getShape().IsNull()) { std::stringstream str; - if (!getTopoShapePtr()->analyze(PyObject_IsTrue(runBopCheck) ? true : false, str)) { + if (!getTopoShapePtr()->analyze(Base::asBoolean(runBopCheck), str)) { PyErr_SetString(PyExc_ValueError, str.str().c_str()); return nullptr; } @@ -929,7 +927,7 @@ PyObject* TopoShapePy::section(PyObject *args) TopoDS_Shape shape = static_cast(pcObj)->getTopoShapePtr()->getShape(); try { // Let's call algorithm computing a section operation: - TopoDS_Shape secShape = this->getTopoShapePtr()->section(shape,PyObject_IsTrue(approx) ? true : false); + TopoDS_Shape secShape = this->getTopoShapePtr()->section(shape, Base::asBoolean(approx)); return new TopoShapePy(new TopoShape(secShape)); } catch (Standard_Failure& e) { @@ -948,7 +946,7 @@ PyObject* TopoShapePy::section(PyObject *args) std::vector shapeVec; shapeVec.push_back(static_cast(pcObj)->getTopoShapePtr()->getShape()); try { - TopoDS_Shape sectionShape = this->getTopoShapePtr()->section(shapeVec,tolerance,PyObject_IsTrue(approx) ? true : false); + TopoDS_Shape sectionShape = this->getTopoShapePtr()->section(shapeVec, tolerance, Base::asBoolean(approx)); return new TopoShapePy(new TopoShape(sectionShape)); } catch (Standard_Failure& e) { @@ -976,7 +974,7 @@ PyObject* TopoShapePy::section(PyObject *args) } } try { - TopoDS_Shape multiSectionShape = this->getTopoShapePtr()->section(shapeVec,tolerance,PyObject_IsTrue(approx) ? true : false); + TopoDS_Shape multiSectionShape = this->getTopoShapePtr()->section(shapeVec, tolerance, Base::asBoolean(approx)); return new TopoShapePy(new TopoShape(multiSectionShape)); } catch (Standard_Failure& e) { @@ -1193,9 +1191,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args) PyErr_SetString(PyExc_ValueError, "Shape is null"); return nullptr; } - TopoDS_Iterator it(shape, - PyObject_IsTrue(cumOri) ? Standard_True : Standard_False, - PyObject_IsTrue(cumLoc) ? Standard_True : Standard_False); + TopoDS_Iterator it(shape, Base::asBoolean(cumOri), Base::asBoolean(cumLoc)); Py::List list; for (; it.More(); it.Next()) { const TopoDS_Shape& aChild = it.Value(); @@ -1369,7 +1365,7 @@ PyObject* TopoShapePy::transformGeometry(PyObject *args) try { Base::Matrix4D mat = static_cast(obj)->value(); - TopoDS_Shape shape = this->getTopoShapePtr()->transformGShape(mat, PyObject_IsTrue(cpy) ? true : false); + TopoDS_Shape shape = this->getTopoShapePtr()->transformGShape(mat, Base::asBoolean(cpy)); return new TopoShapePy(new TopoShape(shape)); } catch (Standard_Failure& e) { @@ -1388,8 +1384,7 @@ PyObject* TopoShapePy::transformShape(PyObject *args) Base::Matrix4D mat = static_cast(obj)->value(); PY_TRY { - this->getTopoShapePtr()->transformShape(mat, PyObject_IsTrue(copy) ? true : false, - PyObject_IsTrue(checkScale) ? true : false); + this->getTopoShapePtr()->transformShape(mat, Base::asBoolean(copy), Base::asBoolean(checkScale)); return IncRef(); } PY_CATCH_OCC @@ -1410,7 +1405,7 @@ PyObject* TopoShapePy::transformed(PyObject *args, PyObject *keywds) (void)op; PY_TRY { TopoShape s(*getTopoShapePtr()); - s.transformShape(mat,PyObject_IsTrue(copy) ? true : false,PyObject_IsTrue(checkScale) ? true : false); + s.transformShape(mat,Base::asBoolean(copy), Base::asBoolean(checkScale)); return Py::new_reference_to(shape2pyshape(s)); } PY_CATCH_OCC @@ -1679,7 +1674,7 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) } TopoDS_Shape shape = this->getTopoShapePtr()->makeThickSolid(facesToRemove, offset, tolerance, - PyObject_IsTrue(inter) ? true : false, PyObject_IsTrue(self_inter) ? true : false, offsetMode, join); + Base::asBoolean(inter), Base::asBoolean(self_inter), offsetMode, join); return new TopoShapeSolidPy(new TopoShape(shape)); } catch (Standard_Failure& e) { @@ -1702,9 +1697,9 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds) try { TopoDS_Shape shape = this->getTopoShapePtr()->makeOffsetShape(offset, tolerance, - PyObject_IsTrue(inter) ? true : false, - PyObject_IsTrue(self_inter) ? true : false, offsetMode, join, - PyObject_IsTrue(fill) ? true : false); + Base::asBoolean(inter), + Base::asBoolean(self_inter), offsetMode, join, + Base::asBoolean(fill)); return new TopoShapePy(new TopoShape(shape)); } catch (Standard_Failure& e) { @@ -1727,9 +1722,7 @@ PyObject* TopoShapePy::makeOffset2D(PyObject *args, PyObject *keywds) try { TopoDS_Shape resultShape = this->getTopoShapePtr()->makeOffset2D(offset, join, - PyObject_IsTrue(fill) ? true : false, - PyObject_IsTrue(openResult) ? true : false, - PyObject_IsTrue(inter) ? true : false); + Base::asBoolean(fill), Base::asBoolean(openResult), Base::asBoolean(inter)); return new_reference_to(shape2pyshape(resultShape)); } PY_CATCH_OCC; @@ -1943,7 +1936,7 @@ PyObject* TopoShapePy::tessellate(PyObject *args) try { std::vector Points; std::vector Facets; - if (PyObject_IsTrue(ok) ? true : false) + if (Base::asBoolean(ok)) BRepTools::Clean(getTopoShapePtr()->getShape()); getTopoShapePtr()->getFaces(Points, Facets,tolerance); Py::Tuple tuple(2); @@ -2098,8 +2091,7 @@ PyObject* TopoShapePy::reflectLines(PyObject *args, PyObject *kwds) HLRAppli_ReflectLines reflect(shape); reflect.SetAxes(v.x, v.y, v.z, p.x, p.y, p.z, u.x, u.y, u.z); reflect.Perform(); - TopoDS_Shape lines = reflect.GetCompoundOf3dEdges(t, PyObject_IsTrue(vis) ? Standard_True : Standard_False, - PyObject_IsTrue(in3d) ? Standard_True : Standard_False); + TopoDS_Shape lines = reflect.GetCompoundOf3dEdges(t, Base::asBoolean(vis), Base::asBoolean(in3d)); return new TopoShapePy(new TopoShape(lines)); } catch (Standard_Failure& e) { @@ -2137,7 +2129,7 @@ PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args) } getTopoShapePtr()->setFaces(Points, Facets, tolerance); - if (PyObject_IsTrue(sewShape) ? true : false) + if (Base::asBoolean(sewShape)) getTopoShapePtr()->sewShape(tolerance); Py_Return; @@ -2210,7 +2202,7 @@ PyObject* TopoShapePy::isInside(PyObject *args) solidClassifier.Perform(vertex, tolerance); Standard_Boolean test = (solidClassifier.State() == stateIn); - if ((PyObject_IsTrue(checkFace) ? true : false) && (solidClassifier.IsOnAFace())) + if (Base::asBoolean(checkFace) && solidClassifier.IsOnAFace()) test = Standard_True; return Py_BuildValue("O", (test ? Py_True : Py_False)); } @@ -2719,8 +2711,8 @@ PyObject* TopoShapePy::optimalBoundingBox(PyObject *args) TopoDS_Shape shape = this->getTopoShapePtr()->getShape(); Bnd_Box bounds; BRepBndLib::AddOptimal(shape, bounds, - PyObject_IsTrue(useT) ? Standard_True : Standard_False, - PyObject_IsTrue(useS) ? Standard_True : Standard_False); + Base::asBoolean(useT), + Base::asBoolean(useS)); bounds.SetGap(0.0); Standard_Real xMin, yMin, zMin, xMax, yMax, zMax; bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax); diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp index 1a3a983b59..3a89674785 100644 --- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp @@ -287,9 +287,7 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) } } TopoDS_Shape shape = this->getTopoShapePtr()->makePipeShell(sections, - PyObject_IsTrue(make_solid) ? Standard_True : Standard_False, - PyObject_IsTrue(is_Frenet) ? Standard_True : Standard_False, - transition); + Base::asBoolean(make_solid), Base::asBoolean(is_Frenet), transition); return new TopoShapePy(new TopoShape(shape)); } catch (Standard_Failure& e) { @@ -349,9 +347,9 @@ PyObject* TopoShapeWirePy::makeEvolved(PyObject *args, PyObject *kwds) try { BRepOffsetAPI_MakeEvolved evolved(spine, profile, joinType, - PyObject_IsTrue(AxeProf) ? Standard_True : Standard_False, - PyObject_IsTrue(Solid) ? Standard_True : Standard_False, - PyObject_IsTrue(ProfOnSpine) ? Standard_True : Standard_False, + Base::asBoolean(AxeProf), + Base::asBoolean(Solid), + Base::asBoolean(ProfOnSpine), Tolerance); TopoDS_Shape shape = evolved.Shape(); return Py::new_reference_to(shape2pyshape(shape)); diff --git a/src/Mod/PartDesign/App/BodyPyImp.cpp b/src/Mod/PartDesign/App/BodyPyImp.cpp index 4f7d29db60..c1d342afc6 100644 --- a/src/Mod/PartDesign/App/BodyPyImp.cpp +++ b/src/Mod/PartDesign/App/BodyPyImp.cpp @@ -71,7 +71,7 @@ PyObject* BodyPy::insertObject(PyObject *args) return nullptr; } - bool after = PyObject_IsTrue(afterPy) ? true : false; + bool after = Base::asBoolean(afterPy); Body* body = this->getBodyPtr(); try { diff --git a/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp b/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp index 2d672aac7f..0c01560189 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPyImp.cpp @@ -52,10 +52,10 @@ PyObject* ViewProviderPy::setBodyMode(PyObject* args) PyObject* b_mode; if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &b_mode)) { return nullptr; - }; + } PartDesignGui::ViewProvider* base = getViewProviderPtr(); - base->setBodyMode(PyObject_IsTrue(b_mode) ? true : false); + base->setBodyMode(Base::asBoolean(b_mode)); return Py::new_reference_to(Py::None()); } @@ -65,10 +65,10 @@ PyObject* ViewProviderPy::makeTemporaryVisible(PyObject* args) PyObject* b_vis; if (!PyArg_ParseTuple(args, "O!", &PyBool_Type, &b_vis)) { return nullptr; - }; + } PartDesignGui::ViewProvider* base = getViewProviderPtr(); - base->makeTemporaryVisible(PyObject_IsTrue(b_vis) ? true : false); + base->makeTemporaryVisible(Base::asBoolean(b_vis)); return Py::new_reference_to(Py::None()); }