From 5ba1423b0276762ca751ae3b06ab7b6bda2512e5 Mon Sep 17 00:00:00 2001 From: VG Date: Fri, 9 Dec 2016 13:44:41 +0100 Subject: use python2 and render motherboard --- cad/assembly.py | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) (limited to 'cad/assembly.py') 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) -- cgit v1.2.3