include <../config/splited.scad> module splited_object() { width = splited_width; height = splited_height; depth = splited_depth; thickness = splited_thickness; hole_top_diameter = splited_hole_top_diameter; hole_bottom_diameter = splited_hole_bottom_diameter; holes_top_count = splited_holes_top_count; holes_bottom_count = splited_holes_bottom_count; module splited_cross_section(full = true) { module points(top = false) { radius = thickness / 2; move_x = depth / 2 - radius; move_y = height / 2 - radius; module point(x = 0, y = 0) { translate([x, y]) { circle(r = radius); } } hull() { if (top) { point(move_x, move_y); point(-move_x, move_y); } else { point(-move_x, -move_y); point(-move_x, move_y); } } } if (full) { hull() { points(top = true); points(top = false); } } else { points(top = true); points(top = false); } } module center_section() { linear_extrude(height = thickness, center = true) { splited_cross_section(full = true); } } module rest_section() { linear_extrude(height = width, center = true) { splited_cross_section(full = false); } } module holes(size, height, count, top = false) { move = size / count; for (count = [-size / 2 : move : size / 2 - move / 2]) { translate([count + move / 2, 0]) { linear_extrude(height = height, center = true) { if (top) { circle(d = hole_top_diameter); } else { circle(d = hole_bottom_diameter); } } } } } module holes_height() { module single() { rotate([90, 0, 90]) { holes( size = height - thickness * 2, height = depth, count = holes_bottom_count, top = false ); } } move = (width + thickness) / 4; translate([0, 0, move]) { single(); } translate([0, 0, -move]) { single(); } } module holes_depth() { module single() { rotate([90, 0, 0]) { holes( size = depth - thickness * 2, height = depth, count = holes_top_count, top = true ); } } move = (width + thickness) / 4; translate([0, 0, move]) { single(); } translate([0, 0, -move]) { single(); } } module final() { render() { difference() { union() { center_section(); rest_section(); } holes_height(); holes_depth(); } } } color("#404040") { final(); } }