From 1bcb27c711585c6615f5f46f0d00585b9c9e3823 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 14 Jul 2024 00:47:44 -0700 Subject: [PATCH] feat: Wing root class --- nhf/touhou/houjuu_nue/wing.py | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/nhf/touhou/houjuu_nue/wing.py b/nhf/touhou/houjuu_nue/wing.py index da83b90..d05eaf5 100644 --- a/nhf/touhou/houjuu_nue/wing.py +++ b/nhf/touhou/houjuu_nue/wing.py @@ -231,6 +231,51 @@ def wing_root(joint: HirthJoint, ) return result +@dataclass +class WingRoot: + """ + Generator for the wing root profile and model + """ + + panel_thickness: float = 25.4 / 16 + height: float = 100.0 + shoulder_width: float = 20.0 + root_width: float = 60.0 + + def outer_spline(self) -> list[Tuple[float, float]]: + """ + Generate outer wing shape spline + """ + + def profile(self) -> Cq.Sketch: + tip_x, tip_y = -100.0, 70.0 + sketch = ( + Cq.Sketch() + .segment((-self.root_width, 0), (0, 0)) + .spline([ + (0, 0), + (-30.0, 50.0), + (tip_x, tip_y) + ]) + .segment( + (tip_x, tip_y), + (tip_x, tip_y - self.shoulder_width) + ) + .segment( + (tip_x, tip_y - self.shoulder_width), + (-self.root_width, 0) + ) + .assemble() + ) + return sketch + + def xy_surface(self) -> Cq.Workplane: + + return ( + Cq.Workplane() + .placeSketch(self.profile()) + .extrude(self.panel_thickness) + ) @dataclass class WingProfile: