summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cad/assembly.py53
-rw-r--r--cad/parameters.py15
-rwxr-xr-xmain.py2
3 files changed, 56 insertions, 14 deletions
diff --git a/cad/assembly.py b/cad/assembly.py
index 32c8202..f6da273 100644
--- a/cad/assembly.py
+++ b/cad/assembly.py
@@ -1,12 +1,49 @@
-#!venv/bin/python3
-
-from solid import *
+from solid.solidpython import *
from solid.utils import *
+from . import parameters
+
+
+def motherboard_support():
+ support = cube(parameters.motherboard_support_size, center=True)
+ return color(parameters.colors.metal)(render()(support))
+
+
+def motherboard():
+ mb_size = parameters.motherboard_size
+ board = cube(mb_size, center=True)
+ datum = [mb_size[0]/2 - 243.84 + 34.29, mb_size[1]/2 - 10.16]
+ holes = [
+ datum,
+ [datum[0] + 45.72, datum[1]],
+ [datum[0] + 203.2, datum[1] - 22.86],
+
+ [datum[0] - 20.32, datum[1] - 154.94],
+ [datum[0], datum[1] - 154.94],
+ [datum[0] + 45.72, datum[1] - 154.94],
+ [datum[0] + 203.2, datum[1] - 154.94],
+
+ [datum[0] + 45.72, datum[1] - 227.33],
+ [datum[0] + 203.2, datum[1] - 227.33],
+ ]
+ hole_cylinders = union()([
+ translate([h[0], h[1], 0])(cylinder(h=10, r=3.96/2, center=True))
+ for h in holes
+ ])
+ #for hole in holes:
+ # board = board - translate([hole[0], hole[1], 0])(
+ # cylinder(h = 10, r=3.96/2, center=True)
+ # )
+ return color(parameters.colors.motherboard)(render()(board
+ + hole_cylinders))
+
def main():
- d = difference()(
- cube(10),
- sphere(15)
- )
- scad_render_to_file(d, 'test.scad')
+ #d = difference()(
+ # cube(10, center=True),
+ # cylinder(h=10, r=4, center=True)
+ #)
+
+ #d = render()(d)
+ scad_render_to_file(motherboard(), 'assembly.scad',
+ include_orig_code=False)
diff --git a/cad/parameters.py b/cad/parameters.py
index 705a41a..fd38e57 100644
--- a/cad/parameters.py
+++ b/cad/parameters.py
@@ -4,10 +4,15 @@
Parameters of model, modify this file to suit your needs
'''
-external_size = (370, 270, 180)
-connector_panel_size = (16, 2, 45)
-motherboard_size = (270, 210, 3)
-powersupply_size = (150, 150, 80)
-storage_size = (70, 80, 10)
+class colors:
+ metal = [0x8C/255., 0x92/255., 0xAC/255.]
+ motherboard = [0, 0.5, 0.2]
+
+external_size = [370, 270, 180]
+connector_panel_size = [158.75, 2, 45]
+motherboard_size = [243.84, 243.84, 3]
+motherboard_support_size = [280, 220, 1]
+powersupply_size = [150, 150, 80]
+storage_size = [70, 80, 10]
wood_thickness = 16
button_diameter = 20
diff --git a/main.py b/main.py
index 3903c79..3be7d41 100755
--- a/main.py
+++ b/main.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!venv/bin/python
# SPDX-License-Identifier: MIT