Prevent user from adding stock features to chamfer.
This commit is contained in:
@@ -106,6 +106,10 @@ class ObjectChamfer(PathEngraveBase.ObjectOp):
|
||||
self.wires = wires
|
||||
self.buildpathocc(obj, wires, [depth], True)
|
||||
|
||||
def opRejectAddBase(self, obj, base, sub):
|
||||
'''The chamfer op can only deal with features of the base model, all others are rejected.'''
|
||||
return base != self.baseobject
|
||||
|
||||
def opSetDefaultValues(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
obj.Width = '1 mm'
|
||||
|
||||
@@ -222,6 +222,11 @@ class ObjectOp(object):
|
||||
Should be overwritten by subclasses.'''
|
||||
pass
|
||||
|
||||
def opRejectAddBase(self, obj, base, sub):
|
||||
'''opRejectAddBase(base, sub) ... if op returns True the addition of the feature is prevented.
|
||||
Should be overwritten by subclasses.'''
|
||||
return False
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
'''onChanged(obj, prop) ... base implementation of the FC notification framework.
|
||||
Do not overwrite, overwrite opOnChanged() instead.'''
|
||||
@@ -454,6 +459,9 @@ class ObjectOp(object):
|
||||
PathLog.notice((translate("Path", "Base object %s.%s already in the list")+"\n") % (base.Label, sub))
|
||||
return
|
||||
|
||||
baselist.append((base, sub))
|
||||
obj.Base = baselist
|
||||
if not self.opRejectAddBase(obj, base, sub):
|
||||
baselist.append((base, sub))
|
||||
obj.Base = baselist
|
||||
else:
|
||||
PathLog.notice((translate("Path", "Base object %s.%s rejected by operation")+"\n") % (base.Label, sub))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user