From 25e92ca25bc127a030336994ce0d5993feca26d2 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sun, 3 Dec 2017 15:08:12 -0800 Subject: [PATCH] Added circular faces to drillable targets. --- src/Mod/Path/PathScripts/PathCircularHoleBase.py | 9 +++++---- src/Mod/Path/PathScripts/PathUtils.py | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index a9e6bf7e87..f440c94208 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -133,8 +133,11 @@ class ObjectOp(PathOp.ObjectOp): if shape.ShapeType == 'Edge' and hasattr(shape.Curve, 'Center'): return FreeCAD.Vector(shape.Curve.Center.x, shape.Curve.Center.y, 0) - if shape.ShapeType == 'Face' and hasattr(shape.Surface, 'Center'): - return FreeCAD.Vector(shape.Surface.Center.x, shape.Surface.Center.y, 0) + if shape.ShapeType == 'Face': + if hasattr(shape.Surface, 'Center'): + return FreeCAD.Vector(shape.Surface.Center.x, shape.Surface.Center.y, 0) + if len(shape.Edges) == 1 and type(shape.Edges[0].Curve) == Part.Circle: + return shape.Edges[0].Curve.Center PathLog.error(translate("Path", "Feature %s.%s cannot be processed as a circular hole - please remove from Base geometry list.") % (base.Label, sub)) return None @@ -158,8 +161,6 @@ class ObjectOp(PathOp.ObjectOp): return len(obj.Locations) != 0 return False - # if len(obj.Base) == 0 and not haveLocations(self, obj): - holes = [] for base, subs in obj.Base: diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index fdcdd27b84..75edaafab9 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -164,6 +164,9 @@ def isDrillable(obj, candidate, tooldiameter=None, includePartials=False): drillable = face.Surface.Radius >= tooldiameter/2 else: drillable = True + elif type(face.Surface) == Part.Plane and PathGeom.pointsCoincide(face.Surface.Axis, FreeCAD.Vector(0,0,1)): + if len(face.Edges) == 1 and type(face.Edges[0].Curve) == Part.Circle: + return True else: for edge in candidate.Edges: if isinstance(edge.Curve, Part.Circle) and (includePartials or edge.isClosed()):