refactor: Separate H-S joint component

This commit is contained in:
Leni Aniva 2024-06-27 23:22:54 -04:00
parent 0bee80f582
commit 4dd43f7151
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
3 changed files with 37 additions and 11 deletions

View File

@ -174,16 +174,20 @@ class Parameters:
(-dx, dx), (-dx, dx),
] ]
def hs_joint_component(self):
hirth = nhf.joints.hirth_joint(
radius=self.hs_joint_radius,
radius_inner=self.hs_joint_radius_inner,
tooth_height=self.hs_joint_tooth_height,
base_height=self.hs_joint_ring_thickness)
return hirth
def hs_joint_parent(self): def hs_joint_parent(self):
""" """
Parent part of the Houjuu-Scarlett joint, which is composed of a Hirth Parent part of the Houjuu-Scarlett joint, which is composed of a Hirth
coupling, a cylindrical base, and a mounting base. coupling, a cylindrical base, and a mounting base.
""" """
hirth = nhf.joints.hirth_joint( hirth = self.hs_joint_component().val()
radius=self.hs_joint_radius,
radius_inner=self.hs_joint_radius_inner,
tooth_height=self.hs_joint_tooth_height,
base_height=self.hs_joint_ring_thickness).val()
#hirth = ( #hirth = (
# hirth # hirth
# .faces("<Z") # .faces("<Z")
@ -289,7 +293,7 @@ class Parameters:
Generate the wing root which contains a Hirth joint at its base and a Generate the wing root which contains a Hirth joint at its base and a
rectangular opening on its side, with the necessary interfaces. rectangular opening on its side, with the necessary interfaces.
""" """
return MW.wing_base().val()#self.wing_root_radius) return MW.wing_root()
###################### ######################
# Assemblies # # Assemblies #

View File

@ -12,6 +12,12 @@ class Test(unittest.TestCase):
p = M.Parameters() p = M.Parameters()
obj = p.wing_root() obj = p.wing_root()
self.assertIsInstance(obj.solids(), Cq.Solid, msg="Wing root must be in one piece") self.assertIsInstance(obj.solids(), Cq.Solid, msg="Wing root must be in one piece")
bbox = obj.BoundingBox()
msg = "Must fix 256^3 bbox"
self.assertLess(bbox.xlen, 255, msg=msg)
self.assertLess(bbox.ylen, 255, msg=msg)
self.assertLess(bbox.zlen, 255, msg=msg)
def test_wings(self): def test_wings(self):
p = M.Parameters() p = M.Parameters()
p.wing_r1() p.wing_r1()

View File

@ -117,7 +117,7 @@ def wing_root_profiles(
.wires().val() .wires().val()
) )
return base, middle, tip return base, middle, tip
def wing_base(): def wing_root():
root_profile, middle_profile, tip_profile = wing_root_profiles() root_profile, middle_profile, tip_profile = wing_root_profiles()
rotate_centre = Cq.Vector(-200, 0, -25) rotate_centre = Cq.Vector(-200, 0, -25)
@ -130,12 +130,17 @@ def wing_base():
middle_profile = middle_profile.rotate( middle_profile = middle_profile.rotate(
startVector=rotate_centre, startVector=rotate_centre,
endVector=rotate_centre + rotate_axis, endVector=rotate_centre + rotate_axis,
angleDegrees = 35, angleDegrees = 30,
)
antetip_profile = tip_profile.rotate(
startVector=rotate_centre,
endVector=rotate_centre + rotate_axis,
angleDegrees = 60,
) )
tip_profile = tip_profile.rotate( tip_profile = tip_profile.rotate(
startVector=rotate_centre, startVector=rotate_centre,
endVector=rotate_centre + rotate_axis, endVector=rotate_centre + rotate_axis,
angleDegrees = 70, angleDegrees = 90,
) )
seg1 = ( seg1 = (
Cq.Workplane('XY') Cq.Workplane('XY')
@ -154,9 +159,20 @@ def wing_base():
.add(middle_profile) .add(middle_profile)
.toPending() .toPending()
.workplane() .workplane()
.add(antetip_profile)
.toPending()
.loft()
)
seg3 = (
Cq.Workplane('XY')
.add(antetip_profile)
.toPending()
.workplane()
.add(tip_profile) .add(tip_profile)
.toPending() .toPending()
.loft() .loft()
) )
seg1 = seg1.union(seg2) result = seg1.union(seg2).union(seg3)
return seg1 result.faces("<Z").tag("base")
result.faces(">X").tag("conn")
return result