Filter out duplicate selections
This commit is contained in:
@@ -52,17 +52,25 @@ class TaskPanelBaseGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
return super(TaskPanelBaseGeometryPage, self)
|
||||
|
||||
def addBaseGeometry(self, selection):
|
||||
if 1 == len(selection) and selection[0].Object.isDerivedFrom('Part::Part2DObject'):
|
||||
sel = selection[0]
|
||||
if sel.HasSubObjects:
|
||||
for sub in sel.SubElementNames:
|
||||
self.obj.Proxy.addBase(self.obj, sel.Object, sub)
|
||||
added = False
|
||||
shapes = self.obj.BaseShapes
|
||||
for sel in selection:
|
||||
if sel.Object in shapes:
|
||||
PathLog.notice((translate("Path", "Base shape %s already in the list")+"\n") % (sel.Object.Label))
|
||||
continue
|
||||
if sel.Object.isDerivedFrom('Part::Part2DObject'):
|
||||
if sel.HasSubObjects:
|
||||
for sub in sel.SubElementNames:
|
||||
self.obj.Proxy.addBase(self.obj, sel.Object, sub)
|
||||
else:
|
||||
shapes.append(sel.Object)
|
||||
self.obj.BaseShapes = shapes
|
||||
added = True
|
||||
else:
|
||||
shapes = self.obj.BaseShapes
|
||||
shapes.append(sel.Object)
|
||||
self.obj.BaseShapes = shapes
|
||||
return True
|
||||
return self.super().addBaseGeometry(selection)
|
||||
base = self.super().addBaseGeometry(selection)
|
||||
added = added or base
|
||||
|
||||
return added
|
||||
|
||||
def setFields(self, obj):
|
||||
self.super().setFields(obj)
|
||||
|
||||
@@ -427,7 +427,7 @@ class ObjectOp(object):
|
||||
return result
|
||||
|
||||
def addBase(self, obj, base, sub):
|
||||
PathLog.track()
|
||||
PathLog.track(obj, base, sub)
|
||||
base = PathUtil.getPublicObject(base)
|
||||
|
||||
if self._setBaseAndStock(obj):
|
||||
@@ -436,10 +436,11 @@ class ObjectOp(object):
|
||||
baselist = obj.Base
|
||||
if baselist is None:
|
||||
baselist = []
|
||||
item = (base, sub)
|
||||
if item in baselist:
|
||||
PathLog.notice(translate("Path", "This object already in the list")+"\n")
|
||||
else:
|
||||
baselist.append(item)
|
||||
obj.Base = baselist
|
||||
for p, el in baselist:
|
||||
if p == base and sub in el:
|
||||
PathLog.notice((translate("Path", "Base object %s.%s already in the list")+"\n") % (base.Label, sub))
|
||||
return
|
||||
|
||||
baselist.append((base, sub))
|
||||
obj.Base = baselist
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class ENGRAVEGate:
|
||||
except:
|
||||
return False
|
||||
|
||||
if shape.BoundBox.ZLength == 0.0 and len(obj.Wires) > 0:
|
||||
if shape.BoundBox.ZLength == 0.0 and len(shape.Wires) > 0:
|
||||
return True
|
||||
|
||||
if shape.ShapeType == 'Edge':
|
||||
|
||||
Reference in New Issue
Block a user