Compare commits
2 Commits
6470010da6
...
9d78bf604a
Author | SHA1 | Date |
---|---|---|
|
9d78bf604a | |
|
596311f326 |
|
@ -13,7 +13,11 @@ class LightPanel(Model):
|
||||||
length: float = 300.0
|
length: float = 300.0
|
||||||
width: float = 200.0
|
width: float = 200.0
|
||||||
|
|
||||||
grid_height: float = 30.0
|
attach_height: float = 20.0
|
||||||
|
attach_diam: float = 8.0
|
||||||
|
attach_depth: float = 12.7
|
||||||
|
|
||||||
|
grid_height: float = 20.0
|
||||||
grid_top_height: float = 5.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
|
||||||
|
@ -33,6 +37,10 @@ class LightPanel(Model):
|
||||||
assert self.grid_holes >= 2
|
assert self.grid_holes >= 2
|
||||||
super().__init__(name="light-panel")
|
super().__init__(name="light-panel")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def grid_spacing_y(self) -> float:
|
||||||
|
return (self.width - 2 * self.grid_margin - self.grid_thickness) / (self.grid_layers - 1)
|
||||||
|
|
||||||
@target(name="grid", kind=TargetKind.DXF)
|
@target(name="grid", kind=TargetKind.DXF)
|
||||||
def grid_profile(self):
|
def grid_profile(self):
|
||||||
w = self.length - self.grid_margin * 2
|
w = self.length - self.grid_margin * 2
|
||||||
|
@ -87,6 +95,21 @@ class LightPanel(Model):
|
||||||
thickness=self.base_thickness,
|
thickness=self.base_thickness,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@target(name="attachment")
|
||||||
|
def attachment(self) -> Cq.Workplane:
|
||||||
|
l = self.length / 2
|
||||||
|
w = self.width / 2
|
||||||
|
return (
|
||||||
|
Cq.Workplane('XY')
|
||||||
|
.box(
|
||||||
|
l, w, self.attach_height,
|
||||||
|
centered=(True, True, False),
|
||||||
|
)
|
||||||
|
.faces(">Z")
|
||||||
|
.hole(self.attach_diam, self.attach_depth)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def assembly(self) -> Cq.Assembly:
|
def assembly(self) -> Cq.Assembly:
|
||||||
assembly = (
|
assembly = (
|
||||||
Cq.Assembly()
|
Cq.Assembly()
|
||||||
|
@ -99,7 +122,7 @@ 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) * spacing + margin = width
|
# margin + t + (n-1) * spacing + margin = width
|
||||||
spacing = (self.width - 2 * self.grid_margin - self.grid_thickness) / (self.grid_layers - 1)
|
spacing = self.grid_spacing_y
|
||||||
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(
|
||||||
|
@ -116,6 +139,8 @@ if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
p = LightPanel()
|
p = LightPanel()
|
||||||
|
print(p.grid_spacing_y)
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
p.build_all()
|
p.build_all()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue