diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp
index 3246fbe4b5..32d817cd82 100644
--- a/src/Mod/Part/App/TopoShape.cpp
+++ b/src/Mod/Part/App/TopoShape.cpp
@@ -4206,6 +4206,33 @@ bool TopoShape::findPlane(gp_Pln &pln, double tol) const {
}
}
+bool TopoShape::isInfinite() const
+{
+ if (_Shape.IsNull())
+ return false;
+
+ try {
+ // If the shape is empty an exception may be thrown
+ Bnd_Box bounds;
+ BRepBndLib::Add(_Shape, bounds);
+ bounds.SetGap(0.0);
+ Standard_Real xMin, yMin, zMin, xMax, yMax, zMax;
+ bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
+
+ if (Precision::IsInfinite(xMax - xMin))
+ return true;
+ if (Precision::IsInfinite(yMax - yMin))
+ return true;
+ if (Precision::IsInfinite(zMax - zMin))
+ return true;
+
+ return false;
+ }
+ catch (Standard_Failure&) {
+ return false;
+ }
+}
+
bool TopoShape::isCoplanar(const TopoShape &other, double tol) const {
if(isNull() || other.isNull())
return false;
diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h
index 96ccb0df9f..2ef6027191 100644
--- a/src/Mod/Part/App/TopoShape.h
+++ b/src/Mod/Part/App/TopoShape.h
@@ -198,6 +198,8 @@ public:
bool isClosed() const;
bool isCoplanar(const TopoShape &other, double tol=-1) const;
bool findPlane(gp_Pln &pln, double tol=-1) const;
+ /// Returns true if the expansion of the shape is infinite, false otherwise
+ bool isInfinite() const;
//@}
/** @name Boolean operation*/
diff --git a/src/Mod/Part/App/TopoShapePy.xml b/src/Mod/Part/App/TopoShapePy.xml
index f0924ebc59..f50d37e9c1 100644
--- a/src/Mod/Part/App/TopoShapePy.xml
+++ b/src/Mod/Part/App/TopoShapePy.xml
@@ -552,6 +552,11 @@ If the shape is an edge it returns True if its vertices are the same.
isCoplanar(shape,tol=None) -- Checks if this shape is coplanar with the given shape.
+
+
+ isInfinite() -- Checks if this shape has an infinite expansion.
+
+
findPlane(tol=None) -- return a plane if the shape is planar
diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp
index 4d5f69718b..4b4870ca06 100644
--- a/src/Mod/Part/App/TopoShapePyImp.cpp
+++ b/src/Mod/Part/App/TopoShapePyImp.cpp
@@ -1896,6 +1896,17 @@ PyObject* TopoShapePy::isCoplanar(PyObject *args)
}PY_CATCH_OCC
}
+PyObject* TopoShapePy::isInfinite(PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return nullptr;
+
+ PY_TRY {
+ return Py::new_reference_to(Py::Boolean(getTopoShapePtr()->isInfinite()));
+ }
+ PY_CATCH_OCC
+}
+
PyObject* TopoShapePy::findPlane(PyObject *args)
{
double tol = -1;