include <../config/platform.scad> include <../config/thread.scad> include include function platform_full_support_depth() = platform_support_depth + thread_height + platform_thickness; function platform_top_width() = platform_width - corner_radius * 2; function platform_side_width() = platform_height - corner_radius * 2; function platform_connector_holes() = [ 0, platform_depth / 2 - corner_radius, platform_depth / 4 - corner_radius, -platform_depth / 4 - corner_radius ]; function platform_connector_space() = thread_top_diameter + platform_thickness; module platform_connector_hole(move_x, move_y, thickness = 0) { translate([move_x, move_y]) { if (thickness == 0) { circle(r = thread_screw / 2); } else { cylinder(r = thread_screw / 2, h = thickness, center = true); } } } module platform_side_holes(thread = false) { move_x = platform_side_width() / 2 - corner_radius - thread_screw; move_top_y = platform_full_support_depth() / 2 - thread_screw; move_bottom_y = thread_top_diameter / 2 - move_top_y; module thread(move_x, move_y) { translate([move_x, move_y]) { thread_object(false, platform_thickness); } } module screw(move_x, move_y) { translate([move_x, move_y]) { thread_screw_object(thread_height); } } if (thread) { screw(move_x, move_top_y); screw(0, move_top_y); thread(move_x, move_bottom_y); thread(-move_x, move_bottom_y); } else { thread_screw_hole(move_x, move_top_y); thread_screw_hole(0, move_top_y); thread_screw_hole(move_x, move_bottom_y); thread_screw_hole(-move_x, move_bottom_y); } } module platform_top_holes(thread = false) { move_x = platform_top_width() / 2 - corner_radius - thread_screw; move_top_y = platform_full_support_depth() / 2 - thread_screw; move_bottom_y = thread_top_diameter / 2 - move_top_y; module thread(move_x, move_y) { translate([move_x, move_y]) { thread_object(false, platform_thickness); } } module screw(move_x, move_y) { translate([move_x, move_y]) { thread_screw_object(thread_height); } } if (thread) { screw(move_x, move_top_y); screw(-move_x, move_top_y); thread(move_x, move_bottom_y); thread(-move_x, move_bottom_y); } else { thread_screw_hole(move_x, move_top_y); thread_screw_hole(-move_x, move_top_y); thread_screw_hole(move_x, move_bottom_y); thread_screw_hole(-move_x, move_bottom_y); } } module platform_mount_object() { rounding = corner_radius; holes_width = platform_width - rounding * 2 - thread_screw * 2 - platform_side_thickness * 2; holes_height = platform_height - rounding * 2 - thread_screw * 2 - platform_side_thickness; module base_shape() { move_x = platform_width / 2 - rounding; move_y = platform_height / 2 - rounding; hull() { corner(move_x, move_y); corner(-move_x, move_y); corner(move_x, -move_y); corner(-move_x, -move_y); } } base_thickness = platform_thickness + thread_height; module base_object() { linear_extrude(height = base_thickness, center = true) { base_shape(); } } module bottom_object() { center = base_thickness / 2 - thread_height / 2; render() { difference() { base_object(); translate([0, 0, center]) { rotate([180, 0, 0]) { width = holes_width; height = holes_height; thickness = platform_thickness; wall_thread_object(width, height, thickness); } } } } } module side_shape() { module cutout_shape() { move_x = platform_width / 2 - platform_side_thickness - rounding; move_top_y = platform_height / 2 - platform_side_thickness - rounding; move_bottom_y = -platform_height / 2 + rounding; hull() { corner(move_x, move_top_y); corner(-move_x, move_top_y); corner(move_x, move_bottom_y, false); corner(-move_x, move_bottom_y, false); } } module bottom_cutout_shape() { bottom = rounding / 2 - platform_height / 2; translate([0, bottom]) { square([platform_width, rounding], center = true); } } render() { difference() { base_shape(); cutout_shape(); bottom_cutout_shape(); } } } module side_object() { thickness = platform_support_depth; linear_extrude(height = thickness, center = true) { side_shape(); } } bottom_center = thread_height / 2 + platform_thickness / 2 - platform_full_support_depth() / 2; side_center = platform_support_depth / 2 + thread_height + platform_thickness - platform_full_support_depth() / 2; module layer_base_object() { translate([0, 0, bottom_center]) { bottom_object(); } translate([0, 0, side_center]) { side_object(); } } module top_holes() { center_y = platform_height / 2 - thread_height / 2; translate([0, center_y, 0]) { rotate([90, 0, 0]) { platform_top_holes(true); } } } module left_holes() { center_x = platform_width / 2 - thread_height / 2; translate([center_x, 0, 0]) { mirror([0, 1, 0]) { rotate([90, 0, 270]) { platform_side_holes(true); } } } } module right_holes() { center_x = thread_height / 2 - platform_width / 2; translate([center_x, 0, 0]) { rotate([90, 0, 90]) { platform_side_holes(true); } } } color("#4C4CB3") { render() { difference() { layer_base_object(); top_holes(); left_holes(); right_holes(); } } } } module platform_top_shape() { move_x = platform_top_width() / 2 - corner_radius; move_y = platform_depth / 2 - corner_radius; module base_shape() { hull() { corner(move_x, move_y); corner(-move_x, move_y); corner(move_x, -move_y); corner(-move_x, -move_y); } } holes_y = platform_full_support_depth() / 2 - platform_depth / 2; module connector_holes() { for (count = platform_connector_holes()) { move = count - platform_connector_space(); platform_connector_hole(move_x, move); platform_connector_hole(-move_x, move); } } module mounting_holes() { radius = platform_mounting_holes_diameter / 2; for (count = platform_mounting_holes_positions) { translate([count.y, count.x]) { circle(r = radius); } } } difference() { base_shape(); connector_holes(); mounting_holes(); translate([0, holes_y]) { platform_top_holes(); } } } module platform_top_object() { height = platform_thickness; color("#9711EE") { render() { linear_extrude(height = height, center = true) { platform_top_shape(); } } } } module platform_side_shape() { move_x = platform_side_width() / 2 - corner_radius; move_y = platform_depth / 2 - corner_radius; module base_shape() { hull() { corner(0, -move_y / 1.5); corner(move_x, -move_y / 1.5); corner(move_x, -move_y); corner(-move_x, -move_y); } hull() { corner(0, -move_y / 1.5); corner(move_x, -move_y / 1.5); corner(move_x, move_y); } } support_holes_y = platform_full_support_depth() / 2 - platform_depth / 2; module connector_holes() { for (count = platform_connector_holes()) { platform_connector_hole(move_x, count); } } difference() { base_shape(); connector_holes(); translate([0, support_holes_y]) { platform_side_holes(); } } } module platform_side_object() { height = platform_thickness; color("#DA25B3") { render() { linear_extrude(height = height, center = true) { platform_side_shape(); } } } } function platform_connector_depth() = platform_thickness * 2 + thread_screw / 2 + corner_radius * 2; function platform_connector_width() = platform_connector_space() + platform_thickness * 2 + thread_screw; module platform_connector_object(split = false) { thickness = platform_thickness; corner = corner_radius; width = platform_connector_depth(); module corner() { outside = corner * 2; inside = outside - thickness * 2; module center() { difference() { circle(r = outside / 2); circle(r = inside / 2); } } module differ() { translate([0, -outside / 4]) { square([outside, outside / 2], center = true); } translate([-outside / 4, outside / 4]) { square([outside / 2, outside / 2], center = true); } } translate([-outside / 4, -outside / 4]) { render() { difference() { center(); differ(); } } } } module side(rotation = 0) { move = width / 2 - corner / 2 - thickness / 2; rotate(rotation) { hull() { translate([move, 0]) { square(thickness, center = true); } translate([-move, 0]) { circle(r = thickness / 2); } } } } module base_shape() { corner_move = width / 2 - corner / 2; top_side_x = -corner / 2; top_side_y = width / 2 - thickness / 2; side_x = top_side_y; side_y = top_side_x; translate([corner_move, corner_move]) { corner(); } translate([top_side_x, top_side_y]) { side(); } translate([side_x, side_y]) { side(90); } } depth = platform_connector_width(); module top_screw() { move_x = width / 2 - corner_radius * 2; move_y = width / 2 - thickness / 2; move_z = -platform_connector_space() / 2; translate([move_x, move_y, move_z]) { rotate([90, 0, 0]) { thread_screw_object(thickness); } } } module side_screw() { move_x = width / 2 - thickness / 2; move_y = width / 2 - corner_radius * 2; move_z = platform_connector_space() / 2; translate([move_x, move_y, move_z]) { rotate([0, 90, 0]) { thread_screw_object(thickness); } } } module base_object() { linear_extrude(height = depth, center = true) { base_shape(); } } module object() { render() { difference() { base_object(); top_screw(); side_screw(); } } } color("#3CC361") { if (split) { object(); } else { mirror([1, 0, 0]) { object(); } } } }