diff options
author | VG <vg@devys.org> | 2016-12-09 13:44:41 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2016-12-09 13:44:41 +0100 |
commit | 5ba1423b0276762ca751ae3b06ab7b6bda2512e5 (patch) | |
tree | 1a6df07ac04571c229b8222d675db1cf5264718d /cad/assembly.py | |
parent | f22f28ab8712b28c6b549c7c85783a081719a43d (diff) | |
download | catcad-5ba1423b0276762ca751ae3b06ab7b6bda2512e5.tar.gz catcad-5ba1423b0276762ca751ae3b06ab7b6bda2512e5.tar.bz2 catcad-5ba1423b0276762ca751ae3b06ab7b6bda2512e5.zip |
use python2 and render motherboard
Diffstat (limited to 'cad/assembly.py')
-rw-r--r-- | cad/assembly.py | 53 |
1 files changed, 45 insertions, 8 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) |