Fixed offset and depth calculation for Deburr op
This commit is contained in:
@@ -96,7 +96,7 @@ def toolDepthAndOffset(width, extraDepth, tool, printInfo):
|
||||
|
||||
toolDepth = 0 if Path.Geom.isRoughly(tan, 0) else width / tan
|
||||
depth = toolDepth + extraDepth
|
||||
extraOffset = -width if angle == 180 else (extraDepth / tan)
|
||||
extraOffset = -width if angle == 180 else (extraDepth * tan)
|
||||
offset = toolOffset + extraOffset
|
||||
|
||||
return (depth, offset, extraOffset, suppressInfo)
|
||||
|
||||
@@ -92,19 +92,33 @@ class TestPathOpDeburr(PathTestUtils.PathTestBase):
|
||||
def test03(self):
|
||||
"""Verify chamfer depth and offset for a 60 deg v-bit with non 0 flat radius."""
|
||||
tool = MockToolBit()
|
||||
tool.FlatRadius = 10
|
||||
tool.FlatRadius = 0.1
|
||||
tool.CuttingEdgeAngle = 60
|
||||
|
||||
td = 1.73205
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0, tool, True)
|
||||
self.assertRoughly(td, depth)
|
||||
self.assertRoughly(10, offset)
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.5, tool, True)
|
||||
self.assertRoughly(2.232051, depth)
|
||||
self.assertRoughly(0.388675, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
self.assertRoughly(td * 3 + 1, depth)
|
||||
self.assertRoughly(10 + td, offset)
|
||||
self.assertRoughly(6.196153, depth)
|
||||
self.assertRoughly(0.677350, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
def test04(self):
|
||||
"""Verify chamfer depth and offset for a 30 deg v-bit with non 0 flat radius."""
|
||||
tool = MockToolBit()
|
||||
tool.FlatRadius = 0.1
|
||||
tool.CuttingEdgeAngle = 30
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(1, 0.5, tool, True)
|
||||
self.assertRoughly(4.232051, depth)
|
||||
self.assertRoughly(0.233975, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
(depth, offset, __, info) = PathDeburr.toolDepthAndOffset(3, 1, tool, True)
|
||||
self.assertRoughly(12.196155, depth)
|
||||
self.assertRoughly(0.367949, offset)
|
||||
self.assertFalse(info)
|
||||
|
||||
def test10(self):
|
||||
|
||||
Reference in New Issue
Block a user