From ebf84ff152ad22475858a6a2cc0b40691924b079 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 30 Jun 2018 21:45:00 -0700 Subject: [PATCH] Fixed holding tags issue with Path's at the same height as the tag top. --- src/Mod/Path/PathScripts/PathDressupDogbone.py | 2 +- src/Mod/Path/PathScripts/PathDressupHoldingTags.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index 70aef765ea..82032f2bc3 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -231,7 +231,7 @@ class Chord (object): def getDirectionOfVector(self, B): A = self.asVector() # if the 2 vectors are identical, they head in the same direction - if A == B: + if PathGeom.pointsCoincide(A, B): return 'Straight' d = -A.x*B.y + A.y*B.x if d < 0: diff --git a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py index b372a1c099..defb39aa9e 100644 --- a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py +++ b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py @@ -44,6 +44,7 @@ if False: else: PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +failures = [] # Qt tanslation handling def translate(context, text, disambig=None): @@ -209,8 +210,15 @@ class Tag: return None def intersects(self, edge, param): + def isDefinitelySmaller(z, zRef): + # Eliminate false positives of edges that just brush along the top of the tag + return z < zRef and not PathGeom.isRoughly(z, zRef, 0.01) + if self.enabled: - if edge.valueAt(edge.FirstParameter).z < self.top() or edge.valueAt(edge.LastParameter).z < self.top(): + zFirst = edge.valueAt(edge.FirstParameter).z + zLast = edge.valueAt(edge.LastParameter).z + zMax = self.top() + if isDefinitelySmaller(zFirst, zMax) or isDefinitelySmaller(zLast, zMax): return self.nextIntersectionClosestTo(edge, self.solid, edge.valueAt(param)) return None @@ -429,6 +437,7 @@ class MapWireToTag: return shell.removeShape(filter(lambda f: PathGeom.isRoughly(f.Area, 0), shell.Faces)) def commandsForEdges(self): + global failures if self.edges: try: shape = self.shell().common(self.tag.solid) @@ -455,6 +464,7 @@ class MapWireToTag: commands = [] for e in self.edges: commands.extend(PathGeom.cmdsForEdge(e)) + failures.append(self) return commands return [] @@ -920,6 +930,8 @@ class ObjectTagDressup: @waiting_effects def processTags(self, obj): + global failures + failures = [] tagID = 0 if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG: for tag in self.tags: