From 46a27ef54331000623e43ba9f7e9bc1056e1d3d7 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 14 Mar 2025 10:25:43 -0700 Subject: [PATCH] Add keyhole and set tilt to 60deg --- nhf/touhou/shiki_eiki/crown.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/nhf/touhou/shiki_eiki/crown.py b/nhf/touhou/shiki_eiki/crown.py index 8f9ef91..9cc6849 100644 --- a/nhf/touhou/shiki_eiki/crown.py +++ b/nhf/touhou/shiki_eiki/crown.py @@ -47,7 +47,7 @@ class Crown(Model): # brass insert thickness slot_thickness: float = 2.0 slot_width: float = 20.0 - slot_tilt: float = 45 + slot_tilt: float = 60 material: Material = Material.METAL_BRASS material_side: Material = Material.PLASTIC_PLA @@ -414,15 +414,17 @@ class Crown(Model): def side_guard_frontal_slot(self) -> Cq.Workplane: angle = 360 / self.facets + inner_d = self.thickness / 2 - self.slot_thickness / 2 + outer_d = self.thickness / 2 + self.slot_thickness / 2 outer = Cq.Solid.makeCone( - radius1=self.radius_lower_front + self.thickness, - radius2=self.radius_upper_front + self.thickness, + radius1=self.radius_lower_front + outer_d, + radius2=self.radius_upper_front + outer_d, height=self.height, angleDegrees=angle, ) inner = Cq.Solid.makeCone( - radius1=self.radius_lower_front, - radius2=self.radius_upper_front, + radius1=self.radius_lower_front + inner_d, + radius2=self.radius_upper_front + inner_d, height=self.height, angleDegrees=angle, ) @@ -486,17 +488,27 @@ class Crown(Model): #) result = shell * profile# - channel - # Create the slots + # Create the downward slots for sign in [-1, 1]: - slot = Cq.Solid.makeBox( + slot_box = Cq.Solid.makeBox( length=self.height, width=self.slot_width, height=self.slot_thickness, ).moved( + Cq.Location(-self.slot_thickness,-self.slot_width/2, -self.slot_thickness/2) + ) + # keyhole for threads to stay in place + slot_cyl = Cq.Solid.makeCylinder( + radius=self.slot_thickness/2, + height=self.height, + pnt=(0,0,self.slot_thickness/2), + dir=(1,0,0), + ) + slot = slot_box + slot_cyl + slot = slot.moved( Cq.Location.rot2d(sign * self.side_guard_slot_angle) * Cq.Location(self.radius_lower + self.side_guard_thickness/2, 0, 0) * - Cq.Location(0,0,0,0,-180 + self.slot_tilt,0) * - Cq.Location(-self.slot_thickness,-self.slot_width/2, -self.slot_thickness/2) + Cq.Location(0,0,0,0,-180 + self.slot_tilt,0) ) result = result - slot @@ -553,7 +565,7 @@ class Crown(Model): attach_left=AttachPoint.DOVETAIL_OUT, attach_right=AttachPoint.DOVETAIL_IN, ) - @target(name="side_guard_3") + @target(name="side_guard_4") def side_guard_4(self) -> Cq.Workplane: return self.side_guard( attach_left=AttachPoint.DOVETAIL_OUT,