From 23ad93c9d4b16b09708fc233156647e655de0fd1 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 4 Aug 2024 00:25:47 -0700 Subject: [PATCH] feat: Make space for shoulder parent joint --- nhf/touhou/houjuu_nue/joints.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/nhf/touhou/houjuu_nue/joints.py b/nhf/touhou/houjuu_nue/joints.py index f98822d..c58116d 100644 --- a/nhf/touhou/houjuu_nue/joints.py +++ b/nhf/touhou/houjuu_nue/joints.py @@ -389,6 +389,8 @@ class ShoulderJoint(Model): # The parent side has arms which connect to the lips parent_arm_width: float = 25.0 parent_arm_height: float = 12.0 + # remove a bit of material from the base so it does not interfere with gluing + parent_arm_base_shift: float = 2.0 # Generates a child guard which covers up the internals. The lip length is # relative to the +X surface of the guard. @@ -515,17 +517,24 @@ class ShoulderJoint(Model): assert self.parent_arm_width <= joint.radius_track * 2 assert self.parent_lip_ext > joint.radius_track + cut_arm = Cq.Solid.makeBox( + self.parent_lip_ext + self.parent_lip_width / 2, + self.parent_arm_width, + self.parent_arm_base_shift, + ) arm = ( Cq.Solid.makeBox( self.parent_lip_ext + self.parent_lip_width / 2, self.parent_arm_width, self.parent_arm_height) + .cut(cut_arm) .located(Cq.Location((0, -self.parent_arm_width/2 , 0))) .cut(Cq.Solid.makeCylinder(joint.radius_track, self.parent_arm_height)) .cut(self._contraction_cut_geometry(parent=True, mirror=top)) ) + t = self.parent_arm_base_shift lip_args = dict( - length=self.parent_lip_length, + length=self.parent_lip_length - t, width=self.parent_lip_width, thickness=self.parent_lip_thickness, hole_diam=self.parent_conn_hole_diam, @@ -534,19 +543,20 @@ class ShoulderJoint(Model): lip1 = MountingBox( **lip_args, holes=[ - Hole(x=self.height / 2 - x, y=-y) + Hole(x=self.height / 2 - x - t, y=-y) for x, y in self.parent_conn_hole_pos ], ) lip2 = MountingBox( **lip_args, holes=[ - Hole(x=self.height / 2 - x, y=y) + Hole(x=self.height / 2 - x - t, y=y) for x, y in self.parent_conn_hole_pos ], ) lip_dy = self.parent_arm_width / 2 - self.parent_lip_thickness # Flip so the lip's holes point to -X + loc_shift = Cq.Location((self.parent_arm_base_shift, 0, 0)) loc_axis = Cq.Location((0,0,0), (0, 1, 0), -90) loc_dir1 = Cq.Location((0,lip_dy,0), (0, 0, 1), -90) loc_dir2 = Cq.Location((0,-lip_dy,0), (0, 0, 1), 90) @@ -562,8 +572,8 @@ class ShoulderJoint(Model): .add(joint.track(), name="track", loc=Cq.Location((0, 0, 0), (0, 0, 1), rot)) .add(arm, name="arm") - .add(lip1.generate(), name=lip_p_tag, loc=loc_pos * loc_dir1 * loc_axis) - .add(lip2.generate(), name=lip_n_tag, loc=loc_pos * loc_dir2 * loc_axis) + .add(lip1.generate(), name=lip_p_tag, loc=loc_pos * loc_dir1 * loc_axis * loc_shift) + .add(lip2.generate(), name=lip_n_tag, loc=loc_pos * loc_dir2 * loc_axis * loc_shift) ) return result