diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml
index e89859e806..451cc6160b 100644
--- a/src/Mod/Sketcher/App/SketchObjectPy.xml
+++ b/src/Mod/Sketcher/App/SketchObjectPy.xml
@@ -63,6 +63,14 @@
Rename a constraint of the sketch
+
+
+
+Get the index of the constraint by name.
+If there is no such constraint an exception is raised.
+
+
+
copy another sketch's geometry and constraints
@@ -88,7 +96,7 @@
set the Datum of a Distance or Angle constraint
-
+
Get the value of a datum constraint
@@ -108,7 +116,7 @@
Moves all datum constraints to the end of the constraint list
-
+
Get the Driving status of a datum constraint
@@ -138,7 +146,7 @@
sets the constraint on/off (enforced or not)
-
+
Get the constraint status (enforced or not)
@@ -163,14 +171,14 @@
-
+
getPoint(GeoIndex,PointPos) - retrieve the vector of a point in the sketch
-
+
return an axis based on the corresponding construction line
diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
index eaade9bb50..be2be86344 100644
--- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
+++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp
@@ -406,6 +406,31 @@ PyObject* SketchObjectPy::renameConstraint(PyObject *args)
Py_Return;
}
+PyObject* SketchObjectPy::getIndexByName(PyObject *args)
+{
+ char* utf8Name;
+ if (!PyArg_ParseTuple(args, "et", "utf-8", &utf8Name))
+ return 0;
+
+ std::string Name = utf8Name;
+ PyMem_Free(utf8Name);
+
+ if (Name.empty()) {
+ PyErr_SetString(PyExc_ValueError, "Passed string is empty");
+ return 0;
+ }
+
+ const std::vector< Sketcher::Constraint * > &vals = getSketchObjectPtr()->Constraints.getValues();
+ for (std::size_t i = 0; i < vals.size(); ++i) {
+ if (Name == vals[i]->Name) {
+ return Py_BuildValue("i", i);
+ }
+ }
+
+ PyErr_SetString(PyExc_LookupError, "No such constraint found");
+ return 0;
+}
+
PyObject* SketchObjectPy::carbonCopy(PyObject *args)
{
char *ObjectName;