include include include include include <../config/global.scad> include <../config/top.scad> function top_size() = [ top_motherboard_size.x + top_padding * 2, top_motherboard_size.y + top_padding * 2 ]; module top_shape() { padding = top_padding; rounding = top_rounding; motherboard_size = top_motherboard_size; motherboard_holes_positions = top_motherboard_holes; motherboard_hole = top_motherboard_holes_diameters; module corner(move = [0, 0]) { translate(move) { circle(r = rounding); } } module base_shape() { width = top_size().x; height = top_size().y; hull() { for (count = square_vector(width, height, rounding)) { corner(count); } } } module motherboard_holes() { translate([0, padding]) { for (count = motherboard_holes_positions) { translate(count) { circle(d = motherboard_hole); } } } } module angles_cuts() { module front_cutoff(move_x = 0) { move_y = motherboard_size.y / 2 + plywood_thickness; translate([move_x, -move_y]) { angle_cutoff(top = true); } } module side_cutoff(left = true, move_y = 0) { move_x = motherboard_size.x / 2 + plywood_thickness; translate([move_x * (left ? 1 : -1), move_y]) { rotate(90) { angle_cutoff(top = true); } } } front_cutoff(move_x = 0); side_cutoff(left = true, move_y = 0); side_cutoff(left = false, move_y = 0); } render() { difference() { base_shape(); motherboard_holes(); angles_cuts(); if (top_pattern) { pattern(motherboard_size.x, motherboard_size.y); } } } } module top_object() { color("#CCBBAA") { linear_extrude(center = true, height = plywood_thickness) { top_shape(); } } }