I've written a class for a python sketch, where I actually can obtain a signal of every change in the sketch's geometry through the execute() method.
Specifically my scripts knows and informs about if the sketch's geometry increase, decrease or still.
In the case of delGeometry I would like to capture the old numbering of the deleted edges, or the last selection before the cleaning.
Code: Select all
class _DynamoSketch():
def __init__(self,sketch):
sketch.addProperty("Part::PropertyGeometryList","GeomHistory","Calenda")
sketch.Proxy = self
self.Type = "DynamoSketch"
def execute(self,sketch):
geomHistory = sketch.GeomHistory ; oldLen = len(geomHistory)
geometryList = sketch.Geometry ; newLen = len(geometryList)
if oldLen == newLen:
print 'equal'
elif oldLen > newLen:
print 'down'
# I would like to obtain the numeration of the removed edges
elif oldLen < newLen:
print 'up'
sketch.GeomHistory = geometryList
sketch.recompute()
class _ViewProvider_DynamoSketch():
def __init__(self,vobj):
vobj.Proxy = self
def getIcon(self):
return iconPath() + "calenda.svg"
def getDefaultDisplayMode(self):
return "Wireframe"
dynamoSketch = FreeCAD.ActiveDocument.addObject("Sketcher::SketchObjecPython","DynamoSketch")
_DynamoSketch(dynamoSketch)
_ViewProvider_DynamoSketch(dynamoSketch.ViewObject)
Code: Select all
App.ActiveDocument.Sketch.delGeometry(2)
has anybody an idea?
Thank you
Edit: I confuse the forum. This question is for python scripting and macros