Part: Expose Geometry::isSame() to Python

This commit is contained in:
wmayer
2024-11-19 22:46:17 +01:00
committed by wwmayer
parent 8a80ce2ca4
commit 463cc08f3f
2 changed files with 22 additions and 0 deletions

View File

@@ -53,6 +53,14 @@ It describes the common behavior of these objects when:
<UserDocu>Create a clone of this geometry with the same Tag</UserDocu>
</Documentation>
</Methode>
<Methode Name="isSame" Const="true">
<Documentation>
<UserDocu>
isSame(geom, tol, angulartol) -> boolean
Compare this geometry to another one</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasExtensionOfType" Const="true">
<Documentation>
<UserDocu>Returns a boolean indicating whether a geometry extension of the type indicated as a string exists.</UserDocu>

View File

@@ -203,6 +203,20 @@ PyObject* GeometryPy::clone(PyObject *args)
return cpy;
}
PyObject* GeometryPy::isSame(PyObject *args)
{
PyObject* other {};
double tol {};
double angular {};
if (!PyArg_ParseTuple(args, "O!dd", &GeometryPy::Type, &other, &tol, &angular)) {
return nullptr;
}
Part::Geometry* geom = this->getGeometryPtr();
bool same = geom->isSame(*static_cast<GeometryPy*>(other)->getGeometryPtr(), tol, angular);
return Py::new_reference_to(Py::Boolean(same));
}
PyObject* GeometryPy::setExtension(PyObject *args)
{
PyObject* o;