fix: Sketch object attribute

This commit is contained in:
Leni Aniva 2024-12-07 13:44:35 -08:00
parent d1fd830766
commit 418e6517a0
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 9 additions and 7 deletions

View File

@ -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)

View File

@ -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(),