add method to check for planar surface
This commit is contained in:
@@ -71,7 +71,15 @@ the second vector corresponds to the minimum curvature.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Continuity" ReadOnly="true">
|
||||
<Methode Name="isPlanar">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isPlanar([float]) -> Bool
|
||||
Checks if the surface is planar within a certain tolerance.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Continuity" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
Returns the global continuity of the surface.
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
# include <Standard_Version.hxx>
|
||||
# include <ShapeAnalysis_Surface.hxx>
|
||||
# include <GeomAPI_IntSS.hxx>
|
||||
# include <GeomLib_IsPlanarSurface.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user