$fn=30;


fnt = "Liberation Mono:style=Regular";
//"Liberation Sans:style=Bold Italic"

// x-pos, y-pos, text, x-offset-text,y-text-offset, valign, halign, fontsize
positions = [ [96, 2.3, "Reset", -3,1.8, "baseline", "right", 2],
   [105.4, 13.9, "Sel", -3, 1.8, "baseline", "right", 3],
   [105.4, 27.5, "-",-3, 1.8, "baseline", "right",3],
   [105.4, 40.2, "+", -3,1.8, "baseline", "right",3],
   [105.4, 53.4, "OK", -3,1.8, "baseline", "right",3],
   [6.4, 15, "x5 x2 x1", 6, -2,"center", "center",2.5],
   [6.4, 32.9, " 1V 0.1V 10mV",6,-2,  "center", "center",2.5],
   [6.4, 50.5, "GND AC DC ", 6,-2, "center", "center",2.5],
   // Trigger #LED
   [88, 9, "Trigger", -2,-0.7, "baseline", "right",2.5],
   // Bohrungen
   [5.2, 5.2, ""], // center des locks
   [5.2, 71.8, ""],
   [112, 5.2, ""],
   [112, 71.8, ""],
 
             ];

module button(cutout){
  color("black") { 
    cube([6,6, 3.8]);
    if (!cutout){
      translate([3,3,0]) cylinder(d=3.5, h=5);
    } else {
      translate([3,3,0]) cylinder(d=8,h=25);
    }
  }
  color("silver") translate([0,0,3.8]) cube([6,6,0.3]);
}

module switch(cutout){
  color("silver") 
    cube([13,7.4, 4.8]); 
  color("black") {  
    if (!cutout) {
      translate([3.5,3,0]) cube([2.2,2.2, 11]);
    } else {
      translate([2,0.4,0]) cube([9.2,6.2, 25]);
    }
  }
}
    
    module platine(cutout){
        // wenn cutout=true, dann wsind die Auschnitte gemeint
difference(){
  union(){
    color("red") cube([117, 77, 1.8]);
    if (cutout)
      translate([-2,-2,-2]) color("darkred") cube([121, 81, 18.8]);
  }
  for (i=[9:12]){
    translate([ positions[i][0],positions[i][1],-0.1]) cylinder(d=3.3, h=2);}
    if (cutout){
      for (i=[9:12]){
        translate([ positions[i][0],positions[i][1],1.8]) cylinder(d=10, h=15.1);
      }
    }
  }    
  for (i=[0:4])
    translate([ positions[i][0],positions[i][1],1.8]) button(cutout);
  for (i=[5:7])
    translate([ positions[i][0],positions[i][1],1.8]) switch(cutout);
  // Trigger LED
  color("lightgreen")
    translate([ positions[8][0],positions[8][1],1.8]) cylinder(d=3, h=4);
  if (cutout) color ("lightgreen")
    translate([ positions[8][0],positions[8][1],1.8]) cylinder(d=3, h=20);
  
  for (i=[0:8])
   translate([ positions[i][0]+positions[i][3],positions[i][1]+positions[i][4], 17]) linear_extrude(2) {
   text( positions[i][2], font = fnt, valign=positions[i][5],
    halign=positions[i][6], size=positions[i][7]);
 }
    
  translate([29.6, 9.2, 12.8]) union(){
    color("red") cube([71.5, 55, 1.8]);
    // Display
    color("black") {
      translate([0,5.6,1.8]) cube([60, 43, 3]);
      translate([65,2,-11]) cube([5, 51, 11]);
    }
    // display-Ausschnitt nach oben
    if (cutout)
      color("gray")translate([1,6.6,4.7])  cube([58, 41, 13]);
  }
  color("silver")
  if (!cutout){
    translate([15.35,69,5+1.8]) rotate([0,90,90]) cylinder(d=11, h=22);
  } else {
    translate([15.35,77,5+1.8]) rotate([0,90,90]) cylinder(d=15, h=14); 
  }
  color("black")translate([93,63.2,1.8])cube ([9,14, 10.8]);
}
               
               platine(false);
         