include <../config/wall.scad> include <../config/thread.scad> include include module wall_holes_shape(width, height, diameter = false) { module hole(move_x, move_y) { translate([move_x, move_y]) { if (diameter == false) { circle(r = thread_screw / 2); } else { circle(r = diameter / 2); } } } base_width = width - width % wall_holes_space; base_height = height - height % wall_holes_space; move_x = base_width / 2; move_y = base_height / 2; for (count_x = [-move_x : wall_holes_space : move_x]) { for (count_y = [-move_y : wall_holes_space : move_y]) { hole(count_x, count_y); } } } module wall_thread_object(width, height, oversize = 0) { module hole(move_x, move_y) { translate([move_x, move_y]) { thread_object(false, oversize); } } base_width = width - width % wall_holes_space; base_height = height - height % wall_holes_space; move_x = base_width / 2; move_y = base_height / 2; for (count_x = [-move_x : wall_holes_space : move_x]) { for (count_y = [-move_y : wall_holes_space : move_y]) { hole(count_x, count_y); } } } module wall_base_shape() { move_x = wall_width / 2 - wall_rounding; move_y = wall_height / 2 - wall_rounding; hull() { translate([move_x, move_y]) { circle(r = wall_rounding); } translate([move_x, -move_y]) { circle(r = wall_rounding); } translate([-move_x, -move_y]) { circle(r = wall_rounding); } translate([-move_x, move_y]) { circle(r = wall_rounding); } } } module wall_mount_screws() { move_x = wall_width / 2 - wall_mounting_screws; move_y = wall_height / 2 - wall_mounting_screws; translate([move_x, move_y]) { circle(r = wall_mounting_screws / 2); } translate([move_x, -move_y]) { circle(r = wall_mounting_screws / 2); } translate([-move_x, -move_y]) { circle(r = wall_mounting_screws / 2); } translate([-move_x, move_y]) { circle(r = wall_mounting_screws / 2); } } module wall_holes_on_x() { width_without_screws_margin = wall_width - wall_mounting_screws * 2; width_without_margin = width_without_screws_margin - hole_entrance * 2; width = width_without_margin - width_without_margin % wall_holes_space; for (count = [-width / 2 : wall_holes_space : width / 2]) { translate([count, 0]) { hole_shape(); } } } module wall_holes() { hole_height = hole_entrance * 2 + hole_holding * 3; height_without_screws_margin = wall_height - wall_mounting_screws * 2; height_without_margin = height_without_screws_margin - hole_height; height = height_without_margin - height_without_margin % wall_holes_space; for (count = [-height / 2 : wall_holes_space : height / 2]) { translate([0, count]) { wall_holes_on_x(); } } } module wall_with_mount_screw() { difference() { wall_base_shape(); wall_mount_screws(); } } module wall_shape() { difference() { wall_with_mount_screw(); wall_holes(); } } module wall_object() { color(wall_color) { linear_extrude(height = wall_thickness) { wall_shape(); } } }