diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml
index 52df924057..1f601064f8 100644
--- a/src/Mod/Sketcher/App/SketchObjectPy.xml
+++ b/src/Mod/Sketcher/App/SketchObjectPy.xml
@@ -94,6 +94,38 @@ deleteAllGeometry()
+
+
+
+Detect degenerated geometries. A curve geometry is considered degenerated
+if the parameter range is less than the tolerance.
+
+detectDegeneratedGeometries(tolerance:float)
+
+ Args:
+ tolerance: The tolerance to check the parameter range of a curve.
+
+ Returns:
+ The number of degenerated geometries.
+
+
+
+
+
+
+Remove degenerated geometries. A curve geometry is considered degenerated
+if the parameter range is less than the tolerance.
+
+removeDegeneratedGeometries(tolerance:float)
+
+ Args:
+ tolerance: The tolerance to check the parameter range of a curve.
+
+ Returns:
+ The number of degenerated geometries.
+
+
+
@@ -263,6 +295,11 @@ delConstraintOnPoint(geoId:int, pointPos:int)
+
+
+ Deletes all constraints referencing an external geometry.
+
+
@@ -720,6 +757,20 @@ setLabelDistance(constraintIndex:int, value:float)
+
+
+
+ Check for constraints with invalid indexes. Returns True if invalid constraints are found, False otherwise.
+
+
+
+
+
+
+ Removes constraints with invalid indexes.
+
+
+
diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
index 54d2eac944..56e6af78da 100644
--- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
+++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
@@ -46,6 +46,7 @@
// other python types
#include "ConstraintPy.h"
#include "GeometryFacadePy.h"
+#include "SketchAnalysis.h"
using namespace Sketcher;
@@ -260,6 +261,30 @@ PyObject* SketchObjectPy::deleteAllGeometry(PyObject* args)
Py_Return;
}
+PyObject* SketchObjectPy::detectDegeneratedGeometries(PyObject* args)
+{
+ double tolerance {};
+ if (!PyArg_ParseTuple(args, "d", &tolerance)) {
+ return nullptr;
+ }
+
+ SketchAnalysis analyse(this->getSketchObjectPtr());
+ int count = analyse.detectDegeneratedGeometries(tolerance);
+ return Py::new_reference_to(Py::Long(count));
+}
+
+PyObject* SketchObjectPy::removeDegeneratedGeometries(PyObject* args)
+{
+ double tolerance {};
+ if (!PyArg_ParseTuple(args, "d", &tolerance)) {
+ return nullptr;
+ }
+
+ SketchAnalysis analyse(this->getSketchObjectPtr());
+ int count = analyse.removeDegeneratedGeometries(tolerance);
+ return Py::new_reference_to(Py::Long(count));
+}
+
PyObject* SketchObjectPy::deleteAllConstraints(PyObject* args)
{
if (!PyArg_ParseTuple(args, "")) {
@@ -617,6 +642,12 @@ PyObject* SketchObjectPy::delConstraintOnPoint(PyObject* args)
Py_Return;
}
+PyObject* SketchObjectPy::delConstraintsToExternal()
+{
+ this->getSketchObjectPtr()->delConstraintsToExternal();
+ Py_Return;
+}
+
PyObject* SketchObjectPy::setDatum(PyObject* args)
{
double Datum;
@@ -1941,6 +1972,18 @@ PyObject* SketchObjectPy::makeMissingEquality(PyObject* args)
Py_Return;
}
+PyObject* SketchObjectPy::evaluateConstraints()
+{
+ bool ok = this->getSketchObjectPtr()->evaluateConstraints();
+ return Py::new_reference_to(Py::Boolean(ok));
+}
+
+PyObject* SketchObjectPy::validateConstraints()
+{
+ this->getSketchObjectPtr()->validateConstraints();
+ Py_Return;
+}
+
PyObject* SketchObjectPy::autoRemoveRedundants(PyObject* args)
{
PyObject* updategeo = Py_True;