| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571 |
- include <../config/platform.scad>
- include <../config/thread.scad>
- include <corner.scad>
- include <wall.scad>
- 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();
- }
- }
- }
- }
|