From b9caead132ccaa2483c9cdb5aa18257127296ea9 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Thu, 24 Mar 2022 15:36:35 -0500 Subject: [PATCH] [Path] Fixes #6658 --- src/Mod/Path/PathScripts/PathProfile.py | 7 ++++++- src/Mod/Path/PathScripts/drillableLib.py | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 03ff482ba5..7066966d79 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -434,6 +434,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): if numpy.isclose( abs(shape.normalAt(0, 0).z), 1 ): # horizontal face + PathLog.debug(abs(shape.normalAt(0, 0).z)) for wire in shape.Wires: if wire.hashCode() == shape.OuterWire.hashCode(): continue @@ -450,7 +451,8 @@ class ObjectProfile(PathAreaOp.ObjectOp): for baseShape, wire in holes: cont = False f = Part.makeFace(wire, "Part::FaceMakerSimple") - drillable = drillableLib.isDrillable(baseShape, f) + drillable = drillableLib.isDrillable(baseShape, f, vector=None) + PathLog.debug(drillable) if obj.processCircles: if drillable: @@ -526,6 +528,9 @@ class ObjectProfile(PathAreaOp.ObjectOp): FreeCADGui.ActiveDocument.getObject(tmpGrpNm).Visibility = False self.tmpGrp.purgeTouched() + # for shape in shapes: + # Part.show(shape[0]) + # print(shape) return shapes # Method to handle each model as a whole, when no faces are selected diff --git a/src/Mod/Path/PathScripts/drillableLib.py b/src/Mod/Path/PathScripts/drillableLib.py index e264e36bcc..f9c1d8f92c 100644 --- a/src/Mod/Path/PathScripts/drillableLib.py +++ b/src/Mod/Path/PathScripts/drillableLib.py @@ -122,7 +122,6 @@ def isDrillableFace(obj, candidate, tooldiameter=None, vector=App.Vector(0, 0, 1 """ checks if a flat face or edge is drillable """ - matchToolDiameter = tooldiameter is not None matchVector = vector is not None PathLog.debug( @@ -131,7 +130,6 @@ def isDrillableFace(obj, candidate, tooldiameter=None, vector=App.Vector(0, 0, 1 ) ) - PathLog.track() if not type(candidate.Surface) == Part.Plane: PathLog.debug("Drilling on non-planar faces not supported") return False @@ -139,12 +137,14 @@ def isDrillableFace(obj, candidate, tooldiameter=None, vector=App.Vector(0, 0, 1 if ( len(candidate.Edges) == 1 and type(candidate.Edges[0].Curve) == Part.Circle ): # Regular circular face + PathLog.debug("Face is circular - 1 edge") edge = candidate.Edges[0] elif ( len(candidate.Edges) == 2 and type(candidate.Edges[0].Curve) == Part.Circle and type(candidate.Edges[1].Curve) == Part.Circle ): # process a donut + PathLog.debug("Face is a donut - 2 edges") e1 = candidate.Edges[0] e2 = candidate.Edges[1] edge = e1 if e1.Curve.Radius < e2.Curve.Radius else e2 @@ -157,11 +157,13 @@ def isDrillableFace(obj, candidate, tooldiameter=None, vector=App.Vector(0, 0, 1 return False if vector is not None: # Check for blind hole alignment if not compareVecs(candidate.normalAt(0, 0), vector, exact=True): + PathLog.debug("Vector not aligned") return False if matchToolDiameter and edge.Curve.Radius < tooldiameter / 2: - PathLog.track() + PathLog.debug("Failed diameter check") return False else: + PathLog.debug("Face is drillable") return True