// -*- C -*- led_dia = 5 + 0.6; led_depth = 5; led_tip_z = 70; led_angle = -60; vert_space_inside = 8; backfront_space_inside = 12; backfront_mate_size = 20; // tuning tower_over_angle = 45; tower_wall_thick = 1.6; tower_base_height = 5; //--- tests --- test_width = 24; test_height = 24; test_thicks = [9,14,21]; module Tests(){ ////toplevel for (thicki=[0:len(test_thicks)-1]) { translate([thicki*test_width-0.5, 0, 0]) { difference(){ cube([test_width, test_thicks[thicki] + led_depth, test_height]); translate([test_width/2, -1, test_height/2]) rotate([-90,0,0]) cylinder(r=led_dia/2, h=led_depth+1, \$fn=30); } } } } //Tests(); //--- real thing --- tower_frontheight = 30; //fixme tower_overhang = led_dia * 4; tower_over_max_y = tower_overhang * sin(tower_over_angle); tower_over_max_z = tower_frontheight + tower_overhang * cos(tower_over_angle); tower_total_max_z = tower_over_max_z + vert_space_inside + led_depth; tower_rearwall_y = -(backfront_space_inside + tower_wall_thick); backfront_mate_extra = (backfront_mate_size - (-tower_rearwall_y))/2; module TowerWallCrossSection(){ // generates a 2D shape - a polygon // x is what is going to be -y // y is what is going to be z polygon([[0, 0], [0, tower_frontheight], [-tower_over_max_y, tower_over_max_z], [-tower_over_max_y, tower_total_max_z], [-tower_rearwall_y, tower_total_max_z], [-tower_rearwall_y, 0], [-tower_rearwall_y+backfront_mate_extra, -tower_base_height], [ -backfront_mate_extra, -tower_base_height]]); } module TowerBulkCrossSection(){ intersection(){ TowerWallCrossSection(); union(){ translate([-tower_over_max_y/2, tower_frontheight + tower_overhang*sin(tower_over_angle)/2]) circle(r = led_depth); } } } %TowerWallCrossSection(); TowerBulkCrossSection();