include ; use ; $fn=100; guard_width = 57.8; thickness = 1.6; gap = 0.24; glass = 0.3; // pcb-related sizes: inner = [ 12, // height 12.4, // depth 50 // width ]; thread = [ 3.8, // diameter 18 // depth ]; nose = [ 4.2, // height 3.6, // length 1.6, // width ]; function length(dim, thread, thickness) = dim.y + 2*thickness + 1.6*thread.x; module form( dim, thread, thickness) { length = length(dim, thread, thickness); d = dim.y+2*thickness; w = dim.z+2*thickness; m = w/2; l = length+3*thickness; t = 3*thread.x; difference() { // Gehäuseform außen intersection() { /*union() { translate( [0, -3.25*length, 0]) rotate( [90,45,90]) rotate_extrude( angle = 90) { translate( [4*length + 2*thickness, 0, 0]) { //circle( d = dim.x + 4*thickness - gap); translate( [-(dim.x + 4*thickness - gap)/2,0,0]) square( dim.x + 4*thickness - gap, center=true); } } translate([0,dim.y/2+thickness,0]) linear_extrude(dim.z+2*thickness, center=true) square( [dim.x+4*thickness-gap, dim.y+2*thickness], center=true); }*/ translate( [2*thickness,0,0]) rotate( [0,90,0]) linear_extrude( dim.x+5*thickness, center=true) polygon( [ [-w/2, 0], [-w/2, d], [-2*t, d], [ -t, l], [ t, l], [ 2*t, d], [ w/2, d], [ w/2, 0], ]); //translate( [0, length/2, 0]) //cube( [dim.x+2*thickness, length, dim.z+2*thickness], center=true); } // Raum für Platine+LEDs translate( [0, dim.y/2+thickness, 0]) cube( [dim.x, dim.y+0.1, dim.z+0.1], center=true); // Fenster translate( [0, thickness/2-gap/2, 0]) cube( [dim.x-thickness, thickness+gap, dim.z-2*thickness], center=true); translate( [-2*thickness, 4*thickness, 0]) { // Schutzblechabdruck translate( [(dim.x+guard_width)/2+2.5*thickness, dim.y+dim.x/2, 0]) rotate( [0, 90, 96]) linear_extrude( dim.x*4, center=true) circle( d=guard_width); // Schraubloch rotate([0,0,4]) { translate( [dim.x/2 + 4*thickness, dim.y + thread.x/2 + thickness/2, 0]) rotate( [0, -90, 0]) linear_extrude( thread.y+gap) circle( d=thread.x); translate( [1, dim.y + thread.x/2 + thickness/2, 0]) rotate( [0, -90, 0]) linear_extrude( thread.y+gap) circle( d=thread.x+3); }; }; // Kabelaussparung *translate([5,0,0]) cube([5,5+gap,1.7]); } } module top( dim, thread, thickness, osg) { length = length( dim, thread, thickness); // Oberfläche translate( [-dim.x/2-thickness/2-gap/2, thickness+length/2, -gap/2]) cube( [2*thickness+gap+2*osg, 2*thickness+length+2*gap, dim.z+2*thickness+2*gap], center=true); // Steg (für das Loch) translate( [0, dim.y+thread.x+2.5*thickness, 0]) cube( [dim.x+4*thickness, 2*(thread.x+osg), 2*(thread.x+osg)], center=true); //rotate( [0,90,0]) //cylinder( h = dim.x+4*thickness, d = 2*(thread.x+osg), center=true); } module bottom( dim, thread, thickness, osg) { length = length( dim, thread, thickness); // Boden l = 3*thickness+dim.y+osg+2*gap; translate( [(dim.x+4*thickness+gap)/2, length/2, -gap/2]) cube( [5*thickness+gap+2*osg, 2*length, dim.z+3*thickness+2*gap], center=true); // Nut/Feder w = 8*thread.x; m = 1*thickness; d = 5*thickness; translate( [dim.x/2-d, l-m-2*osg, -w/2-osg]) cube( [d+osg, m+2*osg, w+2*osg]); } translate( [0, -10-length(inner,thread,thickness), 4*thickness]) rotate( [180, 90, 180]) union() { intersection() { form( inner, thread, thickness); bottom( inner, thread, thickness, 0); } // Nasen zum Einhaken vom Oberteil ins Unterteil for( i = [1, -1]) { scale( [-1, 1, i]) { translate( [-inner.x/2-gap/2, inner.y/2+thickness-nose.y/2, inner.z/2-nose.z/2-gap/2]) { translate( [0,0,-nose.z/2]) cube( [nose.x, nose.y, nose.z], center=false); translate( [nose.x-thickness/2, nose.y/2, thickness/2-1.5*gap]) difference() { rotate( [90,0,0]) cylinder( h=nose.y, r=3*gap, center=true); translate( [-thickness/2,0,0]) cube( [thickness, nose.y+0.1, 6*gap], center=true); } } } } } /*module haken( width, height, depth, gap) { cube( [nose.x, nose.y, nose.z], center=false); } module mulde( width, height, depth, gap) { } haken( nose.);*/ rotate([0,-90,0]) difference() { form( inner, thread, thickness); bottom( inner, thread, thickness, gap); // Mulde zum Einhaken vom Oberteil ins Unterteil for(i = [1,-1]) scale( [-1,1,i]) translate([-inner.x/2+2.5*thickness-gap/2, inner.y/2+thickness-gap/2, inner.z/2]) cube( [thickness, nose.y+gap, thickness], center=true); }