diff options
author | VG <vg@devys.org> | 2016-12-09 14:09:35 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2016-12-09 14:09:35 +0100 |
commit | 111b6ff394355f8a1a2045b504584573acde12af (patch) | |
tree | dc3e37264f6811c89d4ff122e3f3c21eee2b1889 /cad | |
parent | 5ba1423b0276762ca751ae3b06ab7b6bda2512e5 (diff) | |
download | catcad-111b6ff394355f8a1a2045b504584573acde12af.tar.gz catcad-111b6ff394355f8a1a2045b504584573acde12af.tar.bz2 catcad-111b6ff394355f8a1a2045b504584573acde12af.zip |
try to add support geometry
Diffstat (limited to 'cad')
-rw-r--r-- | cad/assembly.py | 59 | ||||
-rw-r--r-- | cad/parameters.py | 3 |
2 files changed, 37 insertions, 25 deletions
diff --git a/cad/assembly.py b/cad/assembly.py index f6da273..c850532 100644 --- a/cad/assembly.py +++ b/cad/assembly.py @@ -4,16 +4,8 @@ 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 = [ +def motherboard_holes(datum=parameters.motherboard_datum): + return [ datum, [datum[0] + 45.72, datum[1]], [datum[0] + 203.2, datum[1] - 22.86], @@ -26,24 +18,41 @@ def motherboard(): [datum[0] + 45.72, datum[1] - 227.33], [datum[0] + 203.2, datum[1] - 227.33], ] - hole_cylinders = union()([ + + +def motherboard_hole_objects(datum=parameters.motherboard_datum): + return union()([ translate([h[0], h[1], 0])(cylinder(h=10, r=3.96/2, center=True)) - for h in holes + for h in motherboard_holes(datum) ]) - #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) - #) +def motherboard(): + hole_objects = motherboard_hole_objects() + mb_size = parameters.motherboard_size + board = cube(mb_size, center=True) + return color(parameters.colors.motherboard)(render()(board - hole_objects)) + + +def motherboard_support(): + plan_size = parameters.motherboard_support_size + support = cube(plan_size, center=True) + hmount = parameters.motherboard_support_mount_height + support_mounts = union()([ + translate([h[0], h[1], plan_size[2]/2 + hmount/2])( + difference()( + cylinder(h=hmount, r=2.5, center=True), + cylinder(h=hmount + 1, r=1.5, center=True), + ) + ) + for h in motherboard_holes() + ]) + support = support + support_mounts + return color(parameters.colors.metal)(render()(support)) - #d = render()(d) - scad_render_to_file(motherboard(), 'assembly.scad', + +def main(): + #d = motherboard() + d = motherboard_support() + scad_render_to_file(d, 'assembly.scad', include_orig_code=False) diff --git a/cad/parameters.py b/cad/parameters.py index fd38e57..34e4a28 100644 --- a/cad/parameters.py +++ b/cad/parameters.py @@ -12,6 +12,9 @@ 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] +motherboard_datum = [motherboard_size[0]/2 - 243.84 + 34.29, + motherboard_size[1]/2 - 10.16] +motherboard_support_mount_height = 5 powersupply_size = [150, 150, 80] storage_size = [70, 80, 10] wood_thickness = 16 |