From 556a35392dfb60a090775dd594cf69fcb0fe8d91 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sun, 4 Aug 2024 14:32:10 -0700 Subject: [PATCH] feat: Truncate inner panel to avoid collision --- nhf/touhou/houjuu_nue/wing.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/nhf/touhou/houjuu_nue/wing.py b/nhf/touhou/houjuu_nue/wing.py index 1024e1a..7651450 100644 --- a/nhf/touhou/houjuu_nue/wing.py +++ b/nhf/touhou/houjuu_nue/wing.py @@ -59,6 +59,7 @@ class WingProfile(Model): # strength spacer_thickness: float = 25.4 / 4 rod_width: float = 10.0 + panel_s0_inner_trunc = 0.05 light_strip: LightStrip = LightStrip() @@ -186,7 +187,7 @@ class WingProfile(Model): ] ] ) - def inner_profile_s0(self) -> Cq.Edge: + def inner_profile_s0(self, trunc: float=0.0) -> Cq.Edge: """ The inner boundary of s0 """ @@ -203,9 +204,21 @@ class WingProfile(Model): (-self.base_width + dx1, dy1), (-self.base_width, 0), ] - return Cq.Edge.makeBezier( + bezier = Cq.Edge.makeBezier( [Cq.Vector(x, y) for x, y in points] ) + if trunc == 0.0: + return bezier + + tip = bezier.positionAt(d=trunc, mode='parameter') + tangent = bezier.tangentAt(locationParam=trunc, mode='parameter') + points = [ + tip, + tip + tangent, + Cq.Vector(-self.base_width + dx1, dy1), + Cq.Vector(-self.base_width, 0), + ] + return Cq.Edge.makeBezier(points) @property @@ -266,7 +279,7 @@ class WingProfile(Model): return result def inner_shell_s0(self) -> Cq.Workplane: t = self.panel_thickness_s0 - profile = self.inner_profile_s0() + profile = self.inner_profile_s0(trunc=self.panel_s0_inner_trunc) result = ( Cq.Workplane('XZ') .moveTo(-t, 0) @@ -291,7 +304,7 @@ class WingProfile(Model): """ This part should be laser cut and then bent on a falsework to create the required shape. """ - length = self.inner_profile_s0().Length() + length = self.inner_profile_s0(trunc=self.panel_s0_inner_trunc).Length() height = self.root_height + self.panel_thickness_s0 * 2 return Cq.Sketch().rect(length, height)