From 44cd6ee960a157a9bc6e8914dbb1f236be3119eb Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Mon, 12 May 2025 23:33:20 -0700 Subject: [PATCH] Onbashira dimension update and flanges --- nhf/touhou/yasaka_kanako/onbashira.py | 64 ++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/nhf/touhou/yasaka_kanako/onbashira.py b/nhf/touhou/yasaka_kanako/onbashira.py index 76610ca..9418628 100644 --- a/nhf/touhou/yasaka_kanako/onbashira.py +++ b/nhf/touhou/yasaka_kanako/onbashira.py @@ -11,12 +11,13 @@ class Onbashira(Model): n_side: int = 6 # Dimensions of each side panel - side_width: float = 200.0 + side_width: float = 170.0 # Side panels have different lengths side_length1: float = 200.0 side_length2: float = 350.0 side_length3: float = 400.0 + side_length4: float = 400.0 side_thickness: float = 25.4 / 8 @@ -31,30 +32,32 @@ class Onbashira(Model): # Position of the holes, with (0, 0) being the centre of each side angle_joint_bolt_position: list[float] = field(default_factory=lambda: [ (20, 15), - (70, 15), + (50, 15), ]) + angle_joint_flange_thickness: float = 7.8 + angle_joint_flange_radius: float = 40.0 # Dimensions of gun barrels barrel_diam: float = 25.4 * 2 barrel_length: float = 300.0 # Radius from barrel centre to axis - rotation_radius: float = 90.0 + rotation_radius: float = 75.0 n_bearing_balls: int = 24 # Size of ball bearings bearing_ball_diam: float = 25.4 * 1/2 bearing_ball_gap: float = .5 # Thickness of bearing disks bearing_thickness: float = 20.0 - bearing_track_radius: float = 135.0 + bearing_track_radius: float = 110.0 # Gap between the inner and outer bearing disks bearing_gap: float = 10.0 bearing_disk_thickness: float = 25.4 / 8 - rotor_inner_radius: float = 55.0 + rotor_inner_radius: float = 40.0 rotor_bind_bolt_diam: float = 10.0 - rotor_bind_radius: float = 110.0 - stator_bind_radius: float = 170.0 + rotor_bind_radius: float = 85.0 + stator_bind_radius: float = 140.0 material_side: Material = Material.WOOD_BIRCH material_bearing: Material = Material.PLASTIC_PLA @@ -253,6 +256,7 @@ class Onbashira(Model): return result + @target(name="angle-joint") def angle_joint(self) -> Cq.Workplane: """ Angular joint between two side panels. This sits at the intersection of @@ -358,6 +362,37 @@ class Onbashira(Model): result.tagAbsolute(f"holeRSI{i}", locrot * Cq.Location(dri, -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.Sketch() + .push([ + (r, r * math.tan(th)) + ]) + .circle(self.angle_joint_flange_radius) + .reset() + .regularPolygon(self.side_width_inner, self.n_side, mode="i") + ) + flange = ( + Cq.Workplane() + .placeSketch(flange) + .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 bearing_ball(self) -> Cq.Solid: return Cq.Solid.makeSphere(radius=self.bearing_ball_diam/2, angleDegrees1=-90) @@ -427,9 +462,9 @@ class Onbashira(Model): loc=Cq.Location.rot2d(i*360/self.n_side) * Cq.Location(-r,0,0,90,0,90), ) return a - def assembly_ring(self) -> Cq.Assembly: + def assembly_ring(self, flanged=False) -> Cq.Assembly: a = Cq.Assembly() - side = self.angle_joint() + side = self.angle_joint_flanged() if flanged else self.angle_joint() r = self.bulk_radius for i in range(self.n_side): a = a.addS( @@ -450,7 +485,7 @@ class Onbashira(Model): name="section1", ) .add( - self.assembly_ring(), + self.assembly_ring(flanged=True), name="ring1", ) .add( @@ -465,10 +500,19 @@ class Onbashira(Model): self.assembly_section(length=self.side_length3, hasFrontHole=True, hasBackHole=True), name="section3", ) + .add( + self.assembly_ring(), + name="ring3", + ) + .add( + self.assembly_section(length=self.side_length4, hasFrontHole=True, hasBackHole=False), + name="section4", + ) ) for (nl, nc, nr) in [ ("section1", "ring1", "section2"), ("section2", "ring2", "section3"), + ("section3", "ring3", "section4"), ]: for i in range(self.n_side): j = (i + 1) % self.n_side