Add test for slot function.

This commit is contained in:
bweissinger
2019-09-04 01:11:07 -05:00
parent 48cd1a78f2
commit c22cdd1c0b

View File

@ -2059,3 +2059,17 @@ class TestCadQuery(BaseTest):
s = r.findSolid()
self.assertEqual(len(s.Solids()),2)
self.assertTrue(isinstance(s,Compound))
def testSlot(self):
decimal_places = 9
#Ensure it produces a solid with the correct volume
result = Workplane("XY").slot(4,1,0).extrude(1)
self.assertAlmostEqual(result.val().Volume(), 3.785398163)
#Test to see if slot is rotated correctly
result = Workplane("XY").slot(4,1,45).extrude(1)
point = result.faces(">Z").edges(">X").first().val().startPoint().toTuple()
self.assertTupleAlmostEquals(point, (0.707106781, 1.414213562, 1.0), decimal_places)