I don't understand the code as yet but a quick test confirms this working. And Yes! We are in Sketch edit mode.
Hopefully this will clear a path for what seemed to be a very complicated issue.
Trying to describe what goes on here, I'm not that good in Python:
Code: Select all
for so in sel:
for sub in so.SubElementNames:
if "Vertex" in sub:
n = eval(sub.lstrip('Vertex'))
geo, pos = so.Object.getGeoVertexIndex(n-1)
p = so.Object.getPoint(geo, pos)
I got this from a search:
Code: Select all
…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)
I will reference this in the other posts on this topic.
This is good stuff!