From 5c44b7b37f3cefb62f97d14e57731b41cd56e7c9 Mon Sep 17 00:00:00 2001 From: VG Date: Sat, 10 Dec 2016 22:07:44 +0100 Subject: attempt a final revision --- cad/assembly.py | 99 ++++++++++++++++++++++++++++++++++++++++--------------- cad/parameters.py | 15 +++++---- 2 files changed, 81 insertions(+), 33 deletions(-) (limited to 'cad') diff --git a/cad/assembly.py b/cad/assembly.py index a687462..74b66b7 100644 --- a/cad/assembly.py +++ b/cad/assembly.py @@ -14,12 +14,10 @@ def motherboard_holes(datum=parameters.motherboard_datum): [datum[0] + 203.2, datum[1] - 22.86], [datum[0] - 20.32, datum[1] - 154.94], - # [datum[0], datum[1] - 154.94], # not on this motherboard [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], + [datum[0] + 45.72, datum[1] - 204.47], ] @@ -39,27 +37,42 @@ def motherboard(): cube([120, 120, 65]) ) ramblock = translate([87, 30, size[2]])(cube([145, 35, 30])) - objects = board + hole_objects + cooler + ramblock + objects = board - hole_objects + cooler + ramblock return color(parameters.colors.motherboard)(render()(objects)) def motherboard_support(): plan_size = parameters.motherboard_support_size - support = cube(plan_size, center=True) + support = cube(plan_size) hmount = parameters.motherboard_support_mount_height support_mounts = union()([ - translate([h[0], h[1], plan_size[2]/2 + hmount/2])( + translate([h[0], h[1], plan_size[2]])( difference()( - cylinder(h=hmount, r=2.5, center=True), - cylinder(h=hmount + 1, r=1.5, center=True), + cylinder(h=hmount, r=2.5), + down(gap)(cylinder(h=hmount + 1, r=1.5)), ) ) for h in motherboard_holes() ]) + support_mounts = right(parameters.powersupply_size[2] + 5)(support_mounts) + support_mounts = forward(plan_size[1] - parameters.motherboard_size[1])( + support_mounts + ) support = support + support_mounts return color(parameters.colors.metal)(render()(support)) +def motherboard_assembly(): + hup = parameters.motherboard_support_mount_height \ + + parameters.motherboard_support_size[2] + support = motherboard_support() + mb = right(parameters.powersupply_size[2] + 5)(motherboard()) + mb = forward(parameters.motherboard_support_size[1] + - parameters.motherboard_size[1])(mb) + motherboard_assembly = support + up(hup)(mb) + return motherboard_assembly + + def wood_rear_plate(): thick = parameters.wood_thickness size = parameters.external_size @@ -77,14 +90,37 @@ def wood_rear_plate(): connector_size[2] + thick + vent_r + 20] vent_hole = translate(tvent)( rotate([90, 0, 0])( - cylinder(r=vent_r, h=thick+2*gap) + #cylinder(r=vent_r, h=thick+2*gap) + cube([1, vent_r*2, thick+2*gap]) \ + + left( 3)(cube([1, vent_r*2, thick+2*gap])) \ + + left( 6)(cube([1, vent_r*2, thick+2*gap])) \ + + left( 9)(cube([1, vent_r*2, thick+2*gap])) \ + + left(12)(cube([1, vent_r*2, thick+2*gap])) \ + + left(15)(cube([1, vent_r*2, thick+2*gap])) \ + + left(18)(cube([1, vent_r*2, thick+2*gap])) \ + + left(21)(cube([1, vent_r*2, thick+2*gap])) \ + + left(24)(cube([1, vent_r*2, thick+2*gap])) + #cylinder(r=vent_r, h=thick+2*gap) ) ) + # TODO: fix x shift tconnector = [size[0] - 2*thick - 10 - connector_size[0], -gap, thick] connector_hole = translate(tconnector)( cube([connector_size[0], thick + 2*gap, connector_size[2]]) ) - return rear_plate - psu_hole - vent_hole - connector_hole + card_size = [10, thick + 2*gap, 100] + tcard = tconnector[:] + tcard[0] -= 7 + card_size[0] + # TODO: fix dimensions + card_hole = translate(tcard)( + cube([card_size[0], thick + 2*gap, card_size[2]]) \ + + left(card_size[0] + 2)(cube([card_size[0], thick + 2*gap, card_size[2]])) \ + + left(2*card_size[0] + 4)(cube([card_size[0], thick + 2*gap, card_size[2]])) \ + + left(3*card_size[0] + 6)(cube([card_size[0], thick + 2*gap, card_size[2]])) \ + + left(4*card_size[0] + 8)(cube([card_size[0], thick + 2*gap, card_size[2]])) + ) + return rear_plate - psu_hole - vent_hole - connector_hole - card_hole + #return card_hole def wood_front_plate(): @@ -93,17 +129,26 @@ def wood_front_plate(): objects = cube([size[0], size[2], thick]) radius = parameters.button_diameter/2 button = down(gap)(cylinder(r=radius, h=thick+2*gap)) - button = forward(size[2] - 10 - radius)(button) + button = forward(radius + thick + 10)(button) button = right(radius + 10 + thick)(button) objects -= button front_panel = down(gap)(cube([101, 25, thick+2*gap])) front_panel = right(size[0]/2 - 101/2)(front_panel) - front_panel = forward(size[2] - 40 - 25)(front_panel) + front_panel = forward(thick + 20)(front_panel) objects -= front_panel usb_ports = down(gap)(cube([100, 20, thick+2*gap])) usb_ports = right(size[0]/2 - 100/2)(usb_ports) - usb_ports = forward(size[2] - 10 - 20)(usb_ports) + usb_ports = forward(thick + 20 + 25 + 10)(usb_ports) objects -= usb_ports + storage_size = parameters.storage_size[:] + storage_size[1] += 10 + sub_storage = cube(storage_size) + sub_storage = right(size[0] - storage_size[0] - thick - 30)(sub_storage) + sub_storage = forward(size[2] - storage_size[1] - 25)(sub_storage) + sub_storage2 = cube(storage_size) + sub_storage2 = right(thick + 30)(sub_storage2) + sub_storage2 = forward(size[2] - storage_size[1] - 25)(sub_storage2) + objects -= down(gap)(sub_storage + sub_storage2) return objects @@ -130,7 +175,7 @@ def wood_case(): rear_plate = translate([thick + gap, size[1] - thick + 2*gap, 0])( wood_rear_plate() ) - front_plate = wood_front_plate() + front_plate = forward(thick-gap)(rotate([90, 0, 0])(wood_front_plate())) all_plates = ( bottom_plate + right_plate + left_plate + rear_plate + front_plate ) @@ -139,20 +184,20 @@ def wood_case(): def main(): thick = parameters.wood_thickness - hup = parameters.motherboard_support_mount_height \ - + parameters.motherboard_support_size[2]/2 \ - + parameters.motherboard_size[2]/2 - motherboard_assembly = motherboard_support() + up(hup)(motherboard()) d = wood_case() - d += translate([thick + gap + parameters.powersupply_size[2], - thick + gap, - thick + gap])( - translate([parameters.motherboard_support_size[0]/2, - parameters.motherboard_support_size[1]/2, - parameters.motherboard_support_size[2]/2])( - motherboard_assembly - ) + #d += translate([thick + gap + parameters.powersupply_size[2], + # thick + gap, + # thick + gap])( + # translate([parameters.motherboard_support_size[0]/2, + # parameters.motherboard_support_size[1]/2, + # parameters.motherboard_support_size[2]/2])( + # motherboard_assembly() + # ) + #) + mb = translate([thick + gap, thick + gap, thick + gap])( + motherboard_assembly() ) + d += mb psu = translate([parameters.powersupply_size[2] + thick + gap, parameters.external_size[1] - thick - gap - parameters.powersupply_size[1], thick + gap + parameters.powersupply_offset_up])( @@ -161,7 +206,7 @@ def main(): d += psu #d = motherboard() #d = wood_rear_plate() - d = wood_front_plate() + #d = wood_front_plate() #d = motherboard() #d = motherboard_assembly() #d = motherboard_support() diff --git a/cad/parameters.py b/cad/parameters.py index 2632728..8d8a7fb 100644 --- a/cad/parameters.py +++ b/cad/parameters.py @@ -11,15 +11,18 @@ class colors: psu = [0x25/255., 0x25/255., 0x25/255.] +wood_thickness = 15 +button_diameter = 20 external_size = [370, 270, 180] connector_panel_size = [158.75, 2, 45] +powersupply_size = [150, 150, 80] motherboard_size = [243.84, 225.84, 20] -motherboard_support_size = [500, 250, 0.75] +# original metal size: 250 +motherboard_support_size = [external_size[0] - 2*wood_thickness, + external_size[1] - 2*wood_thickness, + 0.75] +powersupply_offset_up = 5 + motherboard_support_size[2] motherboard_datum = [motherboard_size[0] - 243.84 + 34.29, motherboard_size[1] - 10.16] motherboard_support_mount_height = 5 -powersupply_size = [150, 150, 80] -powersupply_offset_up = 5 + motherboard_support_size[2] -storage_size = [70, 80, 10] -wood_thickness = 16 -button_diameter = 20 +storage_size = [70, 100, 8] -- cgit v1.2.3