tool: Light panel #9

Open
aniva wants to merge 7 commits from tool/lighting into main
2 changed files with 9 additions and 7 deletions
Showing only changes of commit 418e6517a0 - Show all commits

View File

@ -90,7 +90,7 @@ class Target:
x = ( x = (
Cq.Workplane() Cq.Workplane()
.add(x._faces) .add(x._faces)
.add(x._wires) .add(x.wires)
.add(x._edges) .add(x._edges)
) )
assert isinstance(x, Cq.Workplane) assert isinstance(x, Cq.Workplane)

View File

@ -14,7 +14,7 @@ class LightPanel(Model):
width: float = 200.0 width: float = 200.0
grid_height: float = 30.0 grid_height: float = 30.0
grid_top_height: float = 10.0 grid_top_height: float = 5.0
# Distance from grid to edge # Distance from grid to edge
grid_margin: float = 20.0 grid_margin: float = 20.0
# Number of holes in each row of the grid # Number of holes in each row of the grid
@ -23,7 +23,7 @@ class LightPanel(Model):
grid_hole_width: float = 15.0 grid_hole_width: float = 15.0
base_thickness: float = 25.4/16 base_thickness: float = 25.4/16
grid_thickness: float = 25.4/8 grid_thickness: float = 25.4/4
base_material: Material = Material.WOOD_BIRCH base_material: Material = Material.WOOD_BIRCH
grid_material: Material = Material.ACRYLIC_TRANSPARENT grid_material: Material = Material.ACRYLIC_TRANSPARENT
@ -68,9 +68,11 @@ class LightPanel(Model):
@submodel(name="base") @submodel(name="base")
def base(self) -> MountingBox: def base(self) -> MountingBox:
xshift = self.length / 2 - self.controller.length - self.grid_margin / 2
yshift = self.grid_margin / 2
holes = [ holes = [
Hole( Hole(
x=x, y=y, x=x + xshift, y=y + yshift,
diam=self.controller.hole_diam, diam=self.controller.hole_diam,
tag=f"controller_conn{i}", tag=f"controller_conn{i}",
) )
@ -96,9 +98,9 @@ class LightPanel(Model):
) )
) )
# Grid thickness t is fixed, so the spacing of the grid satisfies # Grid thickness t is fixed, so the spacing of the grid satisfies
# margin + t + (n-1) * (t + spacing) + margin = width # margin + t + (n-1) * spacing + margin = width
spacing = (self.width - 2 * self.grid_margin - self.grid_thickness) / (self.grid_layers - 1) - self.grid_thickness spacing = (self.width - 2 * self.grid_margin - self.grid_thickness) / (self.grid_layers - 1)
shift = self.grid_margin + self.grid_thickness * 2 shift = self.grid_margin + self.grid_thickness / 2
for i in range(self.grid_layers): for i in range(self.grid_layers):
assembly = assembly.addS( assembly = assembly.addS(
self.grid(), self.grid(),