summaryrefslogtreecommitdiffstats
path: root/cad/assembly.py
blob: f6da27393ca3aa47e72a6e56d0f3657aaf0aa299 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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, center=True),
    #    cylinder(h=10, r=4, center=True)
    #)

    #d = render()(d)
    scad_render_to_file(motherboard(), 'assembly.scad',
                        include_orig_code=False)