summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cad/assembly.py69
-rw-r--r--cad/parameters.py6
2 files changed, 73 insertions, 2 deletions
diff --git a/cad/assembly.py b/cad/assembly.py
index c850532..10e65fe 100644
--- a/cad/assembly.py
+++ b/cad/assembly.py
@@ -4,6 +4,9 @@ from solid.utils import *
from . import parameters
+gap = 0.5 # dissociate parts (do not add it in other calculations)
+
+
def motherboard_holes(datum=parameters.motherboard_datum):
return [
datum,
@@ -51,8 +54,72 @@ def motherboard_support():
return color(parameters.colors.metal)(render()(support))
+def wood_rear_plate():
+ thick = parameters.wood_thickness
+ size = parameters.external_size
+ rear_plate = cube([size[0] - 2*thick, thick, size[2]])
+ tpsu = [thick + gap, -gap, thick + gap + parameters.powersupply_offset_up]
+ psu_hole = translate(tpsu)(
+ cube([parameters.powersupply_size[2],
+ thick + 2*gap,
+ parameters.powersupply_size[0]])
+ )
+ return rear_plate - psu_hole
+
+
+def powersupply():
+ size = parameters.powersupply_size
+ psu = cube(size)
+ psu -= translate([size[0]/2, size[1]/2, -gap])(
+ cylinder(r=60, h=20)
+ )
+ return color(parameters.colors.psu)(render()(psu))
+
+
+def wood_case():
+ thick = parameters.wood_thickness
+ size = parameters.external_size
+ bottom_plate = translate([thick + gap, thick + gap, 0])(
+ cube([size[0] - 2*thick, size[1] - 2*thick, thick])
+ )
+ right_left_plate = cube([thick, size[1] - thick, size[2]])
+ right_plate = translate([size[0] - thick + 2*gap, thick + gap, 0])(
+ right_left_plate
+ )
+ left_plate = translate([0, thick + gap, 0])(right_left_plate)
+ rear_plate = translate([thick + gap, size[1] - thick + 2*gap, 0])(
+ wood_rear_plate()
+ )
+ front_plate = cube([size[0], thick, size[2]])
+ all_plates = (
+ bottom_plate + right_plate + left_plate + rear_plate + front_plate
+ )
+ return color(parameters.colors.wood)(render()(all_plates))
+
+
def main():
#d = motherboard()
- d = motherboard_support()
+ 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 = wood_rear_plate()
+ psu = translate([parameters.powersupply_size[2] + 2*thick + gap,
+ parameters.external_size[1] - thick - gap - parameters.powersupply_size[1],
+ thick + gap + parameters.powersupply_offset_up])(
+ rotate([0, -90, 0])(powersupply())
+ )
+ d += psu
scad_render_to_file(d, 'assembly.scad',
include_orig_code=False)
diff --git a/cad/parameters.py b/cad/parameters.py
index 34e4a28..9d50e0a 100644
--- a/cad/parameters.py
+++ b/cad/parameters.py
@@ -7,15 +7,19 @@ Parameters of model, modify this file to suit your needs
class colors:
metal = [0x8C/255., 0x92/255., 0xAC/255.]
motherboard = [0, 0.5, 0.2]
+ wood = [245/255., 152/255., 83/255.]
+ psu = [0x25/255., 0x25/255., 0x25/255.]
+
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_support_size = [280, 280, 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]
+powersupply_offset_up = 5 + motherboard_support_size[2]
storage_size = [70, 80, 10]
wood_thickness = 16
button_diameter = 20