From bd7e8677c7104cf74d2df42ae02d0c80cb938a3e Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 16 May 2025 07:15:30 -0700 Subject: [PATCH] Make all angle joints flanged --- nhf/touhou/yasaka_kanako/onbashira.py | 59 +++++++++++++-------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/nhf/touhou/yasaka_kanako/onbashira.py b/nhf/touhou/yasaka_kanako/onbashira.py index abc105b..8e79934 100644 --- a/nhf/touhou/yasaka_kanako/onbashira.py +++ b/nhf/touhou/yasaka_kanako/onbashira.py @@ -846,7 +846,7 @@ class Onbashira(Model): return result @target(name="angle-joint") - def angle_joint(self) -> Cq.Workplane: + def angle_joint(self, add_flange=True) -> Cq.Workplane: """ Angular joint between two side panels (excluding chamber). This sits at the intersection of 4 side panels to provide compressive, shear, and tensile strength. @@ -961,36 +961,33 @@ class Onbashira(Model): result.tagAbsolute(f"holeRSO{i}", locrot * Cq.Location(dr, -x, -py), direction="+X") result.tagAbsolute(f"holeLSM{i}", locrot * Cq.Location(dr0, -x, py), direction="-X") result.tagAbsolute(f"holeRSM{i}", locrot * Cq.Location(dr0, -x, -py), direction="-X") - return result - @target(name="angle-joint-flanged") - def angle_joint_flanged(self) -> Cq.Workplane: - result = self.angle_joint() - th = math.pi / self.n_side - r = self.bulk_radius - flange = ( - Cq.Workplane() - .sketch() - .push([ - (r, r * math.tan(th)) - ]) - .circle(self.angle_joint_flange_radius) - .reset() - .regularPolygon(self.side_width_inner, self.n_side, mode="i") - .finalize() - .extrude(self.angle_joint_flange_thickness) - .translate((0, 0, -self.angle_joint_flange_thickness/2)) - ) - ri = self.stator_bind_radius - h = self.angle_joint_flange_thickness - cyl = Cq.Solid.makeCylinder( - radius=self.rotor_bind_bolt_diam/2, - height=h, - pnt=(ri * math.cos(th), ri * math.sin(th), -h/2), - ) - result = result + flange - cyl - result.tagAbsolute("holeStatorL", (ri * math.cos(th), ri * math.sin(th), h/2), direction="+Z") - result.tagAbsolute("holeStatorR", (ri * math.cos(th), ri * math.sin(th), -h/2), direction="-Z") + if add_flange: + th = math.pi / self.n_side + r = self.bulk_radius + flange = ( + Cq.Workplane() + .sketch() + .push([ + (r, r * math.tan(th)) + ]) + .circle(self.angle_joint_flange_radius) + .reset() + .regularPolygon(self.side_width_inner, self.n_side, mode="i") + .finalize() + .extrude(self.angle_joint_flange_thickness) + .translate((0, 0, -self.angle_joint_flange_thickness/2)) + ) + ri = self.stator_bind_radius + h = self.angle_joint_flange_thickness + cyl = Cq.Solid.makeCylinder( + radius=self.rotor_bind_bolt_diam/2, + height=h, + pnt=(ri * math.cos(th), ri * math.sin(th), -h/2), + ) + result = result + flange - cyl + result.tagAbsolute("holeStatorL", (ri * math.cos(th), ri * math.sin(th), h/2), direction="+Z") + result.tagAbsolute("holeStatorR", (ri * math.cos(th), ri * math.sin(th), -h/2), direction="-Z") return result def assembly_ring(self, base) -> Cq.Assembly: @@ -1016,7 +1013,7 @@ class Onbashira(Model): name="section1", ) .add( - self.assembly_ring(self.angle_joint_flanged()), + self.assembly_ring(self.angle_joint()), name="ring1", ) .add(