From 22a4f4ceec9bc68704e66ba1da6a87c4b6d403c6 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Tue, 13 May 2025 17:20:51 -0700 Subject: [PATCH] Mirror wing geometry --- README.md | 3 ++ nhf/touhou/yasaka_kanako/mirror.py | 64 +++++++++++++++--------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 1ade17c..e254ea7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ This is the design repository for NorCal Hakkero Factory No. 1, where we use parametric CAD to make cosplay props. +> NorCal Hakkero Factory № 1 +> 北加国営八卦炉第一工場 + ## Development Most cosplay schematics are created with Blender, CadQuery, and Inkscape. To diff --git a/nhf/touhou/yasaka_kanako/mirror.py b/nhf/touhou/yasaka_kanako/mirror.py index c8133d9..6ba5242 100644 --- a/nhf/touhou/yasaka_kanako/mirror.py +++ b/nhf/touhou/yasaka_kanako/mirror.py @@ -21,7 +21,7 @@ class Mirror(Model): outer_gap: float = 3.0 core_thickness: float = 25.4 / 8 - casing_thickness: float = 25.4 / 16 + casing_thickness: float = 25.4 / 8 flange_r0: float = 5.0 flange_r1: float = 15.0 @@ -61,36 +61,7 @@ class Mirror(Model): """ Base of the casing with no holes carved out """ - return ( - Cq.Sketch() - .ellipse(self.width/2, self.height/2) - ) - def casing_bot(self) -> Cq.Workplane: - return ( - Cq.Workplane() - .placeSketch(self.profile_casing_bot()) - .extrude(self.casing_thickness) - ) - def profile_wing(self, sign: float=1) -> Cq.Sketch: - xt = self.width / 2 - self.outer_gap - return ( - Cq.Sketch() - .polygon([ - (sign*xt, self.wing_r1), - (sign*(xt+self.wing_x1), self.wing_r1), - (sign*(xt+self.wing_x1), self.wing_r2), - (sign*(xt+self.wing_x2), self.wing_r2), - (sign*(xt+self.wing_x2), -self.wing_r2), - (sign*(xt+self.wing_x1), -self.wing_r2), - (sign*(xt+self.wing_x1), -self.wing_r1), - (sign*xt, -self.wing_r1), - ]) - ) - @target(name="casing-mid", kind=TargetKind.DXF) - def profile_casing_mid(self) -> Cq.Sketch: yt = self.height / 2 - self.outer_gap - rx = self.width/2 - self.outer_gap - ry = self.height/2 - self.outer_gap yh = (self.flange_y1 + self.flange_y2) / 2 flange = ( Cq.Sketch() @@ -124,13 +95,42 @@ class Mirror(Model): ]) ) return ( - self.profile_casing_bot() - .ellipse(rx, ry, mode="s") + Cq.Sketch() + .ellipse(self.width/2, self.height/2) .boolean(flange, mode="a") .boolean(tail, mode="a") .boolean(self.profile_wing(-1), mode="a") .boolean(self.profile_wing(1), mode="a") ) + def casing_bot(self) -> Cq.Workplane: + return ( + Cq.Workplane() + .placeSketch(self.profile_casing_bot()) + .extrude(self.casing_thickness) + ) + def profile_wing(self, sign: float=1) -> Cq.Sketch: + xt = self.width / 2 - self.outer_gap + return ( + Cq.Sketch() + .polygon([ + (sign*xt, self.wing_r1), + (sign*(xt+self.wing_x1), self.wing_r1), + (sign*(xt+self.wing_x1), self.wing_r2), + (sign*(xt+self.wing_x2), self.wing_r2), + (sign*(xt+self.wing_x2), -self.wing_r2), + (sign*(xt+self.wing_x1), -self.wing_r2), + (sign*(xt+self.wing_x1), -self.wing_r1), + (sign*xt, -self.wing_r1), + ]) + ) + @target(name="casing-mid", kind=TargetKind.DXF) + def profile_casing_mid(self) -> Cq.Sketch: + rx = self.width/2 - self.outer_gap + ry = self.height/2 - self.outer_gap + return ( + self.profile_casing_bot() + .ellipse(rx, ry, mode="s") + ) def casing_mid(self) -> Cq.Workplane: return ( Cq.Workplane()