From 3148d92d6ecfb92f39ad4c4ad2730b29c35de9a4 Mon Sep 17 00:00:00 2001 From: IMback Date: Sun, 11 Aug 2019 17:09:56 +0200 Subject: [PATCH 1/2] Changed hole diameter detection to avoid tessilation inaccuracies in more cases. --- src/Mod/Path/PathScripts/PathCircularHoleBase.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index 0c4bec33de76..f97d85451c52 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -141,8 +141,15 @@ def holeDiameter(self, obj, base, sub): if shape.ShapeType == 'Edge' and type(shape.Curve) == Part.Circle: return shape.Curve.Radius * 2 - - # for all other shapes the diameter is just the dimension in X + + if shape.ShapeType == 'Face': + for i in range(len(shape.Edges)): + if type(shape.Edges[i].Curve) == Part.Circle: + return shape.Edges[i].Curve.Radius * 2 + + + # for all other shapes the diameter is just the dimension in X. This may be inaccurate as the BoundBox is calculated on the tesselated geometry + PathLog.warning(translate("Path", "Hole diameter may be inaccurate due to tessellation on face. Consider selecting hole edge.")) return shape.BoundBox.XLength except Part.OCCError as e: PathLog.error(e) From cf4804ebc0f297ab4730a3547e2b96192bf4a27a Mon Sep 17 00:00:00 2001 From: IMback Date: Sun, 11 Aug 2019 20:56:17 +0200 Subject: [PATCH 2/2] Improve irregular hole detection. --- src/Mod/Path/PathScripts/PathCircularHoleBase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index f97d85451c52..8ab4e85d4a44 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -144,7 +144,9 @@ def holeDiameter(self, obj, base, sub): if shape.ShapeType == 'Face': for i in range(len(shape.Edges)): - if type(shape.Edges[i].Curve) == Part.Circle: + if (type(shape.Edges[i].Curve) == Part.Circle and + shape.Edges[i].Curve.Radius * 2 < shape.BoundBox.XLength*1.1 and + shape.Edges[i].Curve.Radius * 2 > shape.BoundBox.XLength*0.9): return shape.Edges[i].Curve.Radius * 2