[Sketcher] add python command sketch.getGeoVertexIndex(int index) -- returns tuple (geoId, posId) of vertex at that index in the sketch. usage example: (geoId, posId) = App.ActiveDocument.Sketch.getGeoVertexIndex(int(Gui.Selection.getSelectionEx()[0].SubElementNames[0][6:])-1)

This commit is contained in:
mwganson
2020-07-18 18:40:59 -05:00
committed by abdullahtahiriyo
parent 71e1f7c331
commit 2bfc6301bc
2 changed files with 23 additions and 0 deletions

View File

@@ -178,6 +178,13 @@ If there is no such constraint an exception is raised.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getGeoVertexIndex" Const="true">
<Documentation>
<UserDocu>
(geoId, posId) = getGeoVertexIndex(index) - retrieve the GeoId and PosId of a point in the sketch
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getAxis" Const="true">
<Documentation>
<UserDocu>

View File

@@ -941,6 +941,22 @@ PyObject* SketchObjectPy::movePoint(PyObject *args)
}
PyObject* SketchObjectPy::getGeoVertexIndex(PyObject *args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
return 0;
SketchObject* obj = this->getSketchObjectPtr();
int geoId;
PointPos posId;
obj->getGeoVertexIndex(index, geoId, posId);
Py::Tuple tuple(2);
tuple.setItem(0, Py::Long(geoId));
tuple.setItem(1, Py::Long(posId));
return Py::new_reference_to(tuple);
}
PyObject* SketchObjectPy::getPoint(PyObject *args)
{
int GeoId, PointType;