include <../config/global.scad> include <../config/angle.scad> function angle_top_holes_space() = angle_holes_space; function angle_bottom_holes_space() = angle_holes_space + angle_margin * 2; function angle_width() = max(angle_top_holes_space(), angle_bottom_holes_space()) + angle_margin * 2 + angle_thickness * 2; function angle_outside_depth() = angle_depth + angle_thickness; module angle_cutoff(top = false, only_holes = false) { module holes() { move = top ? angle_top_holes_space() / 2 : angle_bottom_holes_space() / 2; translate([-move, 0]) { circle(d = angle_hole_diameter); } translate([move, 0]) { circle(d = angle_hole_diameter); } } module supports() { move = angle_width() / 2 - angle_thickness / 2; translate([-move, 0]) { square([angle_thickness, angle_depth], center = true); } translate([move, 0]) { square([angle_thickness, angle_depth], center = true); } } holes(); if (!only_holes) { supports(); } } module angle_object() { module cross_section(hulled = false) { module corner(move_x = 0, move_y = 0) { translate([move_x, move_y]) { circle(d = angle_thickness); } } module base() { move = angle_depth / 2; hull() { corner(-move, move); corner(move, move); } hull() { corner(-move, move); corner(-move, -move); } } if (hulled) { hull() { base(); } } else { base (); } } module base_object() { module center() { height = angle_width() - angle_thickness * 2; linear_extrude(height = height, center = true) { cross_section(hulled = false); } } module support() { height = angle_thickness; linear_extrude(height = height, center = true) { cross_section(hulled = true); } } module full() { center(); move = angle_width() / 2 - angle_thickness / 2; translate([0, 0, move]) { support(); } translate([0, 0, -move]) { support(); } } rotate([270, 0, 90]) { full(); } } module holes() { height = angle_outside_depth(); move = angle_thickness / 2; translate([0, move, 0]) { linear_extrude(height = height, center = true) { angle_cutoff(top = true, only_holes = true); } } translate([0, 0, move]) { rotate([90, 0, 0]) { linear_extrude(height = height, center = true) { angle_cutoff(top = false, only_holes = true); } } } } color("#AABBCC") { render() { correction_y = angle_outside_depth() / 2 - angle_depth / 2; correction_z = angle_outside_depth() / 2 - angle_depth / 2; translate([0, correction_y, correction_z]) { difference() { base_object(); holes(); } } } } }