diff --git a/src/Mod/Path/PathScripts/PathChamfer.py b/src/Mod/Path/PathScripts/PathChamfer.py index e29134e3b3..374139688a 100644 --- a/src/Mod/Path/PathScripts/PathChamfer.py +++ b/src/Mod/Path/PathScripts/PathChamfer.py @@ -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' diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 8dc9f1ebe6..6485e641c6 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -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))