From cec2f4da5527a5e9ca955aac50db893794d533b6 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Wed, 26 Jun 2024 09:42:50 -0400 Subject: [PATCH] test: Trident length --- nhf/touhou/houjuu_nue/test.py | 12 ++++++++---- nhf/touhou/houjuu_nue/trident.py | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nhf/touhou/houjuu_nue/test.py b/nhf/touhou/houjuu_nue/test.py index 2eb8cd7..1f6265a 100644 --- a/nhf/touhou/houjuu_nue/test.py +++ b/nhf/touhou/houjuu_nue/test.py @@ -7,20 +7,24 @@ class Test(unittest.TestCase): def test_hs_joint_parent(self): p = M.Parameters() obj = p.hs_joint_parent() - assert isinstance(obj.val().solids(), Cq.Solid), "H-S joint must be in one piece" + self.assertIsInstance(obj.val().solids(), Cq.Solid, msg="H-S joint must be in one piece") def test_wing_root(self): p = M.Parameters() obj = p.wing_root() - assert isinstance(obj.solids(), Cq.Solid), "Wing root must be in one piece" + self.assertIsInstance(obj.solids(), Cq.Solid, msg="Wing root must be in one piece") def test_wings(self): p = M.Parameters() p.wing_r1() def test_harness(self): p = M.Parameters() p.harness_assembly() - def test_trident(): + def test_trident(self): p = M.Parameters() - p.trident_assembly() + assembly = p.trident_assembly() + bbox = assembly.toCompound().BoundingBox() + length = bbox.zlen + self.assertGreater(length, 1300) + self.assertLess(length, 1700) if __name__ == '__main__': unittest.main() diff --git a/nhf/touhou/houjuu_nue/trident.py b/nhf/touhou/houjuu_nue/trident.py index e270e74..75e4d73 100644 --- a/nhf/touhou/houjuu_nue/trident.py +++ b/nhf/touhou/houjuu_nue/trident.py @@ -26,5 +26,7 @@ def trident_assembly( .constrain("i2?lip", "s2?mate1", "Plane", param=0) .add(handle.insertion(), name="i3", color=mat_i.color) .constrain("s2?mate2", "i3?lip", "Plane", param=0) + .add(handle.one_side_connector(), name="head", color=mat_i.color) + .constrain("i3?mate", "head?mate", "Plane") ) return assembly.solve()