Skip to content

Commit

Permalink
Merge pull request #2416 from IMbackK/HoleDiaDetection
Browse files Browse the repository at this point in the history
[Path] Changed hole diameter detection to avoid tessilation inaccuracies in …
  • Loading branch information
sliptonic committed Aug 16, 2019
2 parents e94af7f + dc9e857 commit 64b4bb0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Mod/Path/PathScripts/PathCircularHoleBase.py
Expand Up @@ -141,8 +141,17 @@ 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 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


# 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)
Expand Down

0 comments on commit 64b4bb0

Please sign in to comment.