From 2d6d65235dcf6a948c2abada06e4fea9266eff37 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Thu, 29 May 2025 17:24:06 -0700 Subject: [PATCH] Turning bar --- nhf/touhou/yasaka_kanako/onbashira.py | 93 +++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/nhf/touhou/yasaka_kanako/onbashira.py b/nhf/touhou/yasaka_kanako/onbashira.py index c2eeed8..bfd252a 100644 --- a/nhf/touhou/yasaka_kanako/onbashira.py +++ b/nhf/touhou/yasaka_kanako/onbashira.py @@ -267,6 +267,9 @@ class Onbashira(Model): flange_coupler: FlangeCoupler = FlangeCoupler() auxiliary_thickness: float = 25.4 / 8 + turning_bar_width: float = 15.0 + electronic_mount_dx: float = 50.0 + material_side: Material = Material.WOOD_BIRCH material_bearing: Material = Material.PLASTIC_PLA material_spacer: Material = Material.PLASTIC_PLA @@ -821,6 +824,85 @@ class Onbashira(Model): ) return a + @target(name="turning-bar") + def turning_bar(self) -> Cq.Workplane: + """ + Converts the longitudinal/axial mount points on angle joints to + transverse mount points to make them more suitable for electronics. + """ + _, dx = self.angle_joint_bind_pos.to2d_pos() + t = 8 + w = self.turning_bar_width + result = ( + Cq.Workplane() + .box( + length=dx*2 + w, + width=w, + height=t, + centered=(True, True, False) + ) + ) + flange = Cq.Solid.makeBox( + length=w, + width=t, + height=w/2, + ).moved(-w/2, -t, -w/2) + Cq.Solid.makeCylinder( + radius=w/2, + height=t, + pnt=(0, -t, -w/2), + dir=(0, 1, 0), + ) + remover = Cq.Solid.makeCylinder( + radius=BOLT_COMMON.diam_thread/2, + height=w, + ) + removerf = Cq.Solid.makeCylinder( + radius=BOLT_COMMON.diam_thread/2, + height=w*2, + pnt=(0, -w, -w/2), + dir=(0, 1, 0), + ) + dxe = self.electronic_mount_dx + result = ( + result + + flange.moved(dx, w/2, 0) + + flange.moved(-dx, w/2, 0) + - remover.moved(dxe, 0, 0) + - remover.moved(-dxe, 0, 0) + - removerf.moved(dx, 0, 0) + - removerf.moved(-dx, 0, 0) + ) + result.tagAbsolute("holeBO1", (dx, w/2, -w/2), direction="+Y") + result.tagAbsolute("holeBO2", (-dx, w/2, -w/2), direction="+Y") + result.tagAbsolute("holeMO1", (dxe, 0, t)) + result.tagAbsolute("holeMO2", (-dxe, 0, t)) + return result + @target(name="raising-bar") + def raising_bar(self) -> Cq.Workplane: + """ + Create new longitudinal mount points closer to the centre axis, and a + ring for mounting lights + """ + _, dx = self.angle_joint_bind_pos.to2d_pos() + gap = 10 + t1 = 5 + theta = math.pi / self.n_side + r0 = self.bulk_radius + result = ( + Cq.Workplane() + .sketch() + .circle(self.rotation_radius + gap) + .circle(self.rotation_radius - gap, mode="s") + .polygon([ + (0, 0), + (r0 * math.cos(theta), r0 * math.sin(theta)), + (r0 * math.cos(theta), -r0 * math.sin(theta)), + ], mode="i") + .finalize() + .extrude(t1) + ) + return result + def profile_side_panel( self, @@ -1645,6 +1727,17 @@ class Onbashira(Model): ) .add(self.assembly_motor(), name="motor") .add(self.assembly_machine(), name="machine") + .add(self.turning_bar(), name="turning_bar1") + ) + a = a.constrain( + f"turning_bar1?holeBO2", + f"ring3/side0?holeStatorL", + "Plane", + ) + a = a.constrain( + f"turning_bar1?holeBO1", + f"ring3/side1?holeStatorL", + "Plane", ) # Add handle for ih, (x, y) in enumerate(self.angle_joint_bolt_position):