From 57deefbd5fe9f145fe39351e955304e3e8ab19a3 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Thu, 25 Jul 2024 13:27:25 -0700 Subject: [PATCH] fix: Elbow joint output problem --- nhf/touhou/houjuu_nue/joints.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/nhf/touhou/houjuu_nue/joints.py b/nhf/touhou/houjuu_nue/joints.py index b5ebd81..4e2834a 100644 --- a/nhf/touhou/houjuu_nue/joints.py +++ b/nhf/touhou/houjuu_nue/joints.py @@ -1252,8 +1252,7 @@ class ElbowJoint(Model): ) return mbox.generate() - @target(name="child") - def child_joint(self, generate_mount: bool=False) -> Cq.Assembly: + def child_joint(self, generate_mount: bool=False, generate_tags=True) -> Cq.Assembly: angle = -self.disk_joint.tongue_span / 2 dz = self.disk_joint.disk_thickness / 2 # We need to ensure the disk is on the "other" side so @@ -1290,7 +1289,7 @@ class ElbowJoint(Model): ) # Orientes the hole surface so it faces +X loc_thickness = Cq.Location((-self.lip_thickness, 0, 0), (0, 1, 0), 90) - if self.flexor: + if self.flexor and generate_tags: loc_mount = self.actuator_mount_loc(child=True, unflip=True) result.add( Cq.Edge.makeLine((-1,0,0), (1,0,0)), @@ -1306,12 +1305,15 @@ class ElbowJoint(Model): ) return result + @target(name="child") + def target_child(self) -> Cq.Assembly: + return self.child_joint(generate_tags=False) + @target(name="parent-lower") def parent_joint_lower(self) -> Cq.Workplane: return self.disk_joint.housing_lower() - @target(name="parent-upper") - def parent_joint_upper(self, generate_mount: bool=False): + def parent_joint_upper(self, generate_mount: bool=False, generate_tags=True): axial_offset = Cq.Location((self.parent_arm_radius, 0, 0)) housing_dz = self.disk_joint.housing_upper_dz conn_h = self.disk_joint.total_thickness @@ -1355,7 +1357,7 @@ class ElbowJoint(Model): #.constrain("connector", "Fixed") #.solve() ) - if self.flexor: + if self.flexor and generate_tags: loc_mount = self.actuator_mount_loc(child=False, unflip=True) result.add( Cq.Edge.makeLine((-1,0,0), (1,0,0)), @@ -1371,6 +1373,10 @@ class ElbowJoint(Model): ) return result + @target(name="parent-upper") + def target_parent_upper(self) -> Cq.Assembly: + return self.parent_joint_upper(generate_tags=False) + @assembly() def assembly(self, angle: float = 0,