From c22cdd1c0bedbdc82bf208b32e726a979baf6f20 Mon Sep 17 00:00:00 2001 From: bweissinger Date: Wed, 4 Sep 2019 01:11:07 -0500 Subject: [PATCH] Add test for slot function. --- tests/TestCadQuery.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/TestCadQuery.py b/tests/TestCadQuery.py index 6a93374d..fc25e6ae 100644 --- a/tests/TestCadQuery.py +++ b/tests/TestCadQuery.py @@ -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) +