test: Trident length

This commit is contained in:
Leni Aniva 2024-06-26 09:42:50 -04:00
parent a41906d130
commit cec2f4da55
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 10 additions and 4 deletions

View File

@ -7,20 +7,24 @@ class Test(unittest.TestCase):
def test_hs_joint_parent(self): def test_hs_joint_parent(self):
p = M.Parameters() p = M.Parameters()
obj = p.hs_joint_parent() 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): def test_wing_root(self):
p = M.Parameters() p = M.Parameters()
obj = p.wing_root() 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): def test_wings(self):
p = M.Parameters() p = M.Parameters()
p.wing_r1() p.wing_r1()
def test_harness(self): def test_harness(self):
p = M.Parameters() p = M.Parameters()
p.harness_assembly() p.harness_assembly()
def test_trident(): def test_trident(self):
p = M.Parameters() 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__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -26,5 +26,7 @@ def trident_assembly(
.constrain("i2?lip", "s2?mate1", "Plane", param=0) .constrain("i2?lip", "s2?mate1", "Plane", param=0)
.add(handle.insertion(), name="i3", color=mat_i.color) .add(handle.insertion(), name="i3", color=mat_i.color)
.constrain("s2?mate2", "i3?lip", "Plane", param=0) .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() return assembly.solve()