--- /dev/null
+debug = 1;
+tube_diam = 25;
+tube_angle = 35;
+view_angle = 15;
+
+wall = 2;
+led_w = 3;
+screw_hole = 3.5;
+screw_head = 5;
+screw_base = 3;
+epsilon=0.01;
+
+module outer_shape() {
+ difference() {
+ hull() {
+ translate([-26, 0, 5])
+ rotate([0, -70, 0])
+ scale([2, 1, 1])
+ cylinder(r=6, h=1);
+
+ scale([1, 1, 1/2])
+ sphere(r=tube_diam/2, center=true);
+ }
+
+ translate([0, 0, -100+epsilon])
+ cube(200, center=true);
+
+ translate([-25, 0, 0])
+ rotate([0, -35, 0])
+ translate([-100, 0, 0])
+ cube(200, center=true);
+ }
+}
+
+module inner_shape() {
+ difference() {
+ hull() {
+ translate([-26-epsilon, 0, 5])
+ rotate([0, -70, 0])
+ scale([2.5, 1, 1])
+ cylinder(r=4, h=1);
+
+ scale([1, 1, 1/2])
+ sphere(r=tube_diam/2 - 4, center=true);
+ }
+
+ translate([0, 0, 2+-100+epsilon])
+ cube(200, center=true);
+
+ translate([-22, 0, 0])
+ rotate([0, -35, 0])
+ translate([-100, 0, 0])
+ cube(200, center=true);
+ }
+}
+
+module screw_hole(d1, d2, z_base) {
+ union() {
+ // body
+ translate([0, 0, -epsilon])
+ cylinder(r=d1/2, h=z_base + 2*epsilon);
+ // head
+ translate([0, 0, z_base])
+ cylinder(r=d2/2, h=20);
+ }
+}
+
+module front_hole() {
+ difference() {
+ inner_shape();
+ translate([-35, 0, 0])
+ rotate([0, view_angle + tube_angle, 0])
+ translate([100, 0, 0]) cube([200, 200, 200], center=true);
+ }
+}
+
+module inner_hole() {
+ intersection() {
+ inner_shape();
+
+ translate([-32, 0, 0])
+ rotate([0, view_angle + tube_angle, 0])
+ translate([100, 0, 0]) cube([200, 200, 200], center=true);
+
+ translate([-27, 0, 0])
+ rotate([0, 20, 0])
+ translate([100, 0, 0]) cube([200, 200, 200], center=true);
+
+ translate([-108, 0, 0]) cube([200, 200, 200], center=true);
+ }
+}
+
+module cable_hole() {
+ translate([-10, 0, -epsilon])
+ difference() {
+ cylinder(r=6.5, h=3);
+ translate([12-epsilon, 0, 0]) cube(20, center=true);
+ }
+}
+
+module tube() {
+ // presmykacova trubka
+ color("grey") {
+ rotate([0, -tube_angle, 0])
+ translate([0, 0, -50])
+ cylinder(r=tube_diam/2, h=50);
+ }
+}
+
+module led(h, w, h1, w1) {
+ union() {
+ translate([0, 0, h-w/2])
+ sphere(r=w/2, $fn=64);
+ cylinder(r=w/2, h=h-w/2, $fn=64);
+ translate([0, 0, -h1])
+ cylinder(r=w1/2, h=h1+epsilon, $fn=64);
+ }
+}
+
+module illum_led() {
+ translate([-24, 0, 3])
+ rotate([0, 180+tube_angle, 0])
+ led(h=5,w=3.5,h1=2,w1=4);
+};
+
+module status_led() {
+ translate([-21, 0, 8.5])
+ rotate([0, 270+view_angle+tube_angle, 0])
+ led(h=5,w=3.5,h1=2,w1=4);
+}
+
+module main() {
+ difference() {
+ outer_shape();
+ screw_hole(d1=4, d2=8, z_base=4);
+ front_hole();
+ inner_hole();
+ cable_hole($fn=8);
+ status_led();
+ illum_led();
+ };
+};
+
+if (debug == 1) {
+ rotate([0, -tube_angle, 0]) {
+ difference() {
+ main($fn=16);
+ translate([0, -100, 0]) cube([200, 200, 200], center=true);
+ };
+ color("red") status_led();
+ color("deepskyblue") illum_led();
+ };
+ color("gray") tube();
+} else {
+ main($fn=32);
+}
+