From 418e6517a013c8fbffc31eb29e8f6612013b26ea Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sat, 7 Dec 2024 13:44:35 -0800 Subject: [PATCH] fix: Sketch object attribute --- nhf/build.py | 2 +- nhf/tool/light_panel.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/nhf/build.py b/nhf/build.py index 106577c..4d4c6c2 100644 --- a/nhf/build.py +++ b/nhf/build.py @@ -90,7 +90,7 @@ class Target: x = ( Cq.Workplane() .add(x._faces) - .add(x._wires) + .add(x.wires) .add(x._edges) ) assert isinstance(x, Cq.Workplane) diff --git a/nhf/tool/light_panel.py b/nhf/tool/light_panel.py index 86d9983..631637f 100644 --- a/nhf/tool/light_panel.py +++ b/nhf/tool/light_panel.py @@ -14,7 +14,7 @@ class LightPanel(Model): width: float = 200.0 grid_height: float = 30.0 - grid_top_height: float = 10.0 + grid_top_height: float = 5.0 # Distance from grid to edge grid_margin: float = 20.0 # Number of holes in each row of the grid @@ -23,7 +23,7 @@ class LightPanel(Model): grid_hole_width: float = 15.0 base_thickness: float = 25.4/16 - grid_thickness: float = 25.4/8 + grid_thickness: float = 25.4/4 base_material: Material = Material.WOOD_BIRCH grid_material: Material = Material.ACRYLIC_TRANSPARENT @@ -68,9 +68,11 @@ class LightPanel(Model): @submodel(name="base") def base(self) -> MountingBox: + xshift = self.length / 2 - self.controller.length - self.grid_margin / 2 + yshift = self.grid_margin / 2 holes = [ Hole( - x=x, y=y, + x=x + xshift, y=y + yshift, diam=self.controller.hole_diam, tag=f"controller_conn{i}", ) @@ -96,9 +98,9 @@ class LightPanel(Model): ) ) # Grid thickness t is fixed, so the spacing of the grid satisfies - # margin + t + (n-1) * (t + spacing) + margin = width - spacing = (self.width - 2 * self.grid_margin - self.grid_thickness) / (self.grid_layers - 1) - self.grid_thickness - shift = self.grid_margin + self.grid_thickness * 2 + # margin + t + (n-1) * spacing + margin = width + spacing = (self.width - 2 * self.grid_margin - self.grid_thickness) / (self.grid_layers - 1) + shift = self.grid_margin + self.grid_thickness / 2 for i in range(self.grid_layers): assembly = assembly.addS( self.grid(),