Part: [skip ci] add TopoShape::isInfinite
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -552,6 +552,11 @@ If the shape is an edge it returns True if its vertices are the same.
|
||||
<UserDocu>isCoplanar(shape,tol=None) -- Checks if this shape is coplanar with the given shape.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isInfinite" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>isInfinite() -- Checks if this shape has an infinite expansion.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="findPlane" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>findPlane(tol=None) -- return a plane if the shape is planar</UserDocu>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user