diff --git a/src/Mod/Path/PathScripts/PathDressupTag.py b/src/Mod/Path/PathScripts/PathDressupTag.py index 48cea4c487..f17f4faa08 100644 --- a/src/Mod/Path/PathScripts/PathDressupTag.py +++ b/src/Mod/Path/PathScripts/PathDressupTag.py @@ -162,7 +162,7 @@ class ObjectDressup(QtCore.QObject): self.obj = obj; - minZ = sys.maxint + minZ = +sys.maxint minX = minZ minY = minZ @@ -191,10 +191,28 @@ class ObjectDressup(QtCore.QObject): self.ptMax = FreeCAD.Vector(maxX, maxY, maxZ) self.masterSolid = TagSolid(self, minZ, self.toolRadius()) self.solids = [self.masterSolid.cloneAt(pos) for pos in self.obj.Positions] + self.tagSolid = Part.Compound(self.solids) self.wire, rapid = PathGeom.wireForPath(obj.Base.Path) self.edges = self.wire.Edges + maxTagZ = minZ + obj.Height + + lastX = 0 + lastY = 0 + lastZ = 0 + + commands = [] + + for cmd in obj.Base.Path.Commands: + if cmd in PathGeom.CmdMove: + if lastZ <= maxTagZ or cmd.Parameters.get('Z', lastZ) <= maxTagZ: + pass + else: + commands.append(cmd) + else: + commands.append(cmd) + obj.Path = obj.Base.Path self.changed.emit() diff --git a/src/Mod/Path/PathScripts/PathDressupTagGui.py b/src/Mod/Path/PathScripts/PathDressupTagGui.py index e1dff487a2..997c621ad2 100644 --- a/src/Mod/Path/PathScripts/PathDressupTagGui.py +++ b/src/Mod/Path/PathScripts/PathDressupTagGui.py @@ -143,17 +143,39 @@ class PathDressupTagTaskPanel: tags.append((x, y, enabled)) return tags - def getTagParameters(self): - self.obj.Width = FreeCAD.Units.Quantity(self.formTags.ifWidth.text()).Value - self.obj.Height = FreeCAD.Units.Quantity(self.formTags.ifHeight.text()).Value - self.obj.Angle = self.formTags.dsbAngle.value() - self.obj.Radius = FreeCAD.Units.Quantity(self.formTags.ifRadius.text()).Value - def getFields(self): - self.getTagParameters() + width = FreeCAD.Units.Quantity(self.formTags.ifWidth.text()).Value + height = FreeCAD.Units.Quantity(self.formTags.ifHeight.text()).Value + angle = self.formTags.dsbAngle.value() + radius = FreeCAD.Units.Quantity(self.formTags.ifRadius.text()).Value + tags = self.getTags(True) - self.obj.Proxy.setXyEnabled(tags) - self.isDirty = True + positions = [] + disabled = [] + for i, (x, y, enabled) in enumerate(tags): + positions.append(FreeCAD.Vector(x, y, 0)) + if not enabled: + disabled.append(i) + + if width != self.obj.Width: + self.obj.Width = width + self.isDirty = True + if height != self.obj.Height: + self.obj.Height = height + self.isDirty = True + if angle != self.obj.Angle: + self.obj.Angle = angle + self.isDirty = True + if radius != self.obj.Radius: + self.obj.Radius = radius + self.isDirty = True + if positions != self.obj.Positions: + self.obj.Positions = positions + self.isDirty = True + if disabled != self.obj.Disabled: + self.obj.Disabled = disabled + self.isDirty = True + def updateTagsView(self): PathLog.track()