Fixed external thread milling orientation and direction
This commit is contained in:
@@ -28,6 +28,14 @@ import math
|
||||
from PathTests.PathTestUtils import PathTestBase
|
||||
|
||||
|
||||
class TestObject(object):
|
||||
|
||||
def __init__(self, orientation, direction, zTop, zBottom):
|
||||
self.ThreadOrientation = orientation
|
||||
self.Direction = direction
|
||||
self.StartDepth = FreeCAD.Units.Quantity(zTop, FreeCAD.Units.Length)
|
||||
self.FinalDepth = FreeCAD.Units.Quantity(zBottom, FreeCAD.Units.Length)
|
||||
|
||||
def radii(internal, major, minor, toolDia, toolCrest):
|
||||
"""test radii function for simple testing"""
|
||||
return (minor, major)
|
||||
@@ -45,6 +53,18 @@ class TestPathThreadMilling(PathTestBase):
|
||||
for i in range(len(have)):
|
||||
self.assertRoughly(have[i], want[i])
|
||||
|
||||
def assertSetupInternal(self, obj, c, begin, end):
|
||||
cmd, zBegin, zEnd = PathThreadMilling.threadSetupInternal(obj, obj.StartDepth.Value, obj.FinalDepth.Value)
|
||||
self.assertEqual(cmd, c)
|
||||
self.assertEqual(zBegin, begin)
|
||||
self.assertEqual(zEnd, end)
|
||||
|
||||
def assertSetupExternal(self, obj, c, begin, end):
|
||||
cmd, zBegin, zEnd = PathThreadMilling.threadSetupExternal(obj, obj.StartDepth.Value, obj.FinalDepth.Value)
|
||||
self.assertEqual(cmd, c)
|
||||
self.assertEqual(zBegin, begin)
|
||||
self.assertEqual(zEnd, end)
|
||||
|
||||
def test00(self):
|
||||
"""Verify internal radii."""
|
||||
self.assertRadii(PathThreadMilling.threadRadii(True, 20, 18, 2, 0), (8, 9.2))
|
||||
@@ -92,3 +112,36 @@ class TestPathThreadMilling(PathTestBase):
|
||||
PathThreadMilling.threadPasses(5, radii, False, 10, 9, 0, 0),
|
||||
[9.552786, 9.367544, 9.225403, 9.105573, 9],
|
||||
)
|
||||
|
||||
def test40(self):
|
||||
"""Verify internal right hand thread setup."""
|
||||
|
||||
hand = PathThreadMilling.RightHand
|
||||
|
||||
self.assertSetupInternal(TestObject(hand, PathThreadMilling.DirectionConventional, 1, 0), "G2", 1, 0)
|
||||
self.assertSetupInternal(TestObject(hand, PathThreadMilling.DirectionClimb, 1, 0), "G3", 0, 1)
|
||||
|
||||
def test41(self):
|
||||
"""Verify internal left hand thread setup."""
|
||||
|
||||
hand = PathThreadMilling.LeftHand
|
||||
|
||||
self.assertSetupInternal(TestObject(hand, PathThreadMilling.DirectionConventional, 1, 0), "G2", 0, 1)
|
||||
self.assertSetupInternal(TestObject(hand, PathThreadMilling.DirectionClimb, 1, 0), "G3", 1, 0)
|
||||
|
||||
def test50(self):
|
||||
"""Verify exteranl right hand thread setup."""
|
||||
|
||||
hand = PathThreadMilling.RightHand
|
||||
|
||||
self.assertSetupExternal(TestObject(hand, PathThreadMilling.DirectionClimb, 1, 0), "G2", 1, 0)
|
||||
self.assertSetupExternal(TestObject(hand, PathThreadMilling.DirectionConventional, 1, 0), "G3", 0, 1)
|
||||
|
||||
def test51(self):
|
||||
"""Verify exteranl left hand thread setup."""
|
||||
|
||||
hand = PathThreadMilling.LeftHand
|
||||
|
||||
self.assertSetupExternal(TestObject(hand, PathThreadMilling.DirectionClimb, 1, 0), "G2", 0, 1)
|
||||
self.assertSetupExternal(TestObject(hand, PathThreadMilling.DirectionConventional, 1, 0), "G3", 1, 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user