chiark / gitweb /
1 // -*- C -*-
3 led_dia = 5 + 0.6;
4 led_depth = 5;
6 led_tip_z = 70;
7 led_angle = -60;
9 vert_space_inside = 8;
10 backfront_space_inside = 12;
12 backfront_mate_size = 25;
13 tower_frontheight = 20;
15 // tuning
17 tower_over_angle = 45;
18 tower_wall_thick = 1.6;
19 tower_base_height = 10;
22 //--- tests ---
24 test_width = 24;
25 test_height = 24;
27 test_thicks = [9,14,21];
29 module Tests(){ ////toplevel
30   for (thicki=[0:len(test_thicks)-1]) {
31     translate([thicki*test_width-0.5, 0, 0]) {
32       difference(){
33         cube([test_width,
34               test_thicks[thicki] + led_depth,
35               test_height]);
36         translate([test_width/2, -1, test_height/2])
37           rotate([-90,0,0])
38           cylinder(r=led_dia/2, h=led_depth+1, \$fn=30);
39       }
40     }
41   }
42 }
44 //Tests();
46 //--- real thing ---
48 tower_overhang = led_dia * 2.5;
50 tower_over_max_y = tower_overhang * sin(tower_over_angle);
51 tower_over_max_z = tower_frontheight + tower_overhang * cos(tower_over_angle);
52 tower_total_max_z = tower_over_max_z + vert_space_inside + led_depth;
53 tower_rearwall_y = -(backfront_space_inside + tower_wall_thick);
55 backfront_mate_extra = (backfront_mate_size - (-tower_rearwall_y));
57 module TowerWallCrossSection(){
58   // generates a 2D shape - a polygon
59   // x is what is going to be -y
60   // y is what is going to be z
61   polygon([[0,                  0],
62            [0,                  tower_frontheight],
63            [-tower_over_max_y,  tower_over_max_z],
64            [-tower_over_max_y
65             + tan(tower_forehead_angle) * (vert_space_inside + led_depth),
66             tower_total_max_z],
67            [-tower_rearwall_y,  tower_total_max_z],
68            [-tower_rearwall_y,  0],
69            [-tower_rearwall_y, -tower_base_height],
70            [-backfront_mate_extra, -tower_base_height]]);
71 }
73 module TowerBulkCrossSection(){
74   intersection(){
75     TowerWallCrossSection();
76     union(){
77       translate([-tower_over_max_y/2,
78                  tower_frontheight + tower_overhang*sin(tower_over_angle)/2])
79         circle(r = led_depth);
80     }
81   }
82 }
84 %TowerWallCrossSection();
85 TowerBulkCrossSection();