diff --git a/src/Mod/Part/App/GeometrySurfacePy.xml b/src/Mod/Part/App/GeometrySurfacePy.xml index 7d80c7c935..b2276984d6 100644 --- a/src/Mod/Part/App/GeometrySurfacePy.xml +++ b/src/Mod/Part/App/GeometrySurfacePy.xml @@ -71,7 +71,15 @@ the second vector corresponds to the minimum curvature. - + + + +isPlanar([float]) -> Bool +Checks if the surface is planar within a certain tolerance. + + + + Returns the global continuity of the surface. diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index c037942aeb..64b99cd00f 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -40,6 +40,7 @@ # include # include # include +# include #endif #include @@ -456,6 +457,30 @@ PyObject* GeometrySurfacePy::curvature(PyObject *args) return 0; } +PyObject* GeometrySurfacePy::isPlanar(PyObject *args) +{ + try { + Handle(Geom_Surface) surf = Handle(Geom_Surface) + ::DownCast(getGeometryPtr()->handle()); + if (!surf.IsNull()) { + double tol = Precision::Confusion(); + if (!PyArg_ParseTuple(args, "|d", &tol)) + return 0; + + GeomLib_IsPlanarSurface check(surf, tol); + Standard_Boolean val = check.IsPlanar(); + return PyBool_FromLong(val ? 1 : 0); + } + } + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); + return 0; + } + + PyErr_SetString(PartExceptionOCCError, "Geometry is not a surface"); + return 0; +} + PyObject* GeometrySurfacePy::parameter(PyObject *args) { Handle(Geom_Surface) surf = Handle(Geom_Surface)