summaryrefslogtreecommitdiffstats
path: root/cad
diff options
context:
space:
mode:
authorVG <vg@devys.org>2016-12-09 13:44:41 +0100
committerVG <vg@devys.org>2016-12-09 13:44:41 +0100
commit5ba1423b0276762ca751ae3b06ab7b6bda2512e5 (patch)
tree1a6df07ac04571c229b8222d675db1cf5264718d /cad
parentf22f28ab8712b28c6b549c7c85783a081719a43d (diff)
downloadcatcad-5ba1423b0276762ca751ae3b06ab7b6bda2512e5.tar.gz
catcad-5ba1423b0276762ca751ae3b06ab7b6bda2512e5.tar.bz2
catcad-5ba1423b0276762ca751ae3b06ab7b6bda2512e5.zip
use python2 and render motherboard
Diffstat (limited to 'cad')
-rw-r--r--cad/assembly.py53
-rw-r--r--cad/parameters.py15
2 files changed, 55 insertions, 13 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