Add test for slot function.
This commit is contained in:
@ -2059,3 +2059,17 @@ class TestCadQuery(BaseTest):
|
|||||||
s = r.findSolid()
|
s = r.findSolid()
|
||||||
self.assertEqual(len(s.Solids()),2)
|
self.assertEqual(len(s.Solids()),2)
|
||||||
self.assertTrue(isinstance(s,Compound))
|
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)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user