$fn=50; alpha = 0.5; rc = 2.4; //rayon des cylindres sep = 3.2 ; n_hole = 9 ; n_out1 = 2 ; n_out2 = 2; n_out = n_out1+n_out2; lon = (n_hole+n_out)*(2*rc + sep) - sep + 2*sep*alpha; // longueur du cube la = 2*(rc+sep*alpha); //largeur du cube ha = la; // hauteur du cube ha_trou = la*1.5; // hauteur des cylindres formant les trous ha_cyl = la/4; // hauteur des cylindres union(){ // translate([2*rc+sep*alpha+0.5*sep,la/2,0]) // for( i = [0:n_hole+n_out-2]) { // translate([i*(2*rc + sep),0,(1.5*sep*alpha+2*rc)]) // cylinder(h=ha_cyl+(sep*alpha*0.5), r=rc); // } difference(){ cube([lon,la,ha]); translate([rc+sep*alpha,la,ha/2]) for (i=[n_out1:n_out1+n_hole-1]){ translate([i*(2*rc + sep),0,0]) rotate([90,0,0])cylinder(h=ha_trou, r=rc); } } translate([rc+sep*alpha,sep*alpha*0.5,ha/2]) for (i=[0:n_out1-1]){ translate([i*(2*rc + sep),0,0]) rotate([90,0,0]) cylinder(h=ha_cyl+(sep*alpha*0.5),r=rc); } translate([rc+sep*alpha,sep*alpha*0.5,ha/2]) for (i=[n_hole+n_out1:n_hole+n_out-1]){ translate([i*(2*rc + sep),0,0]) rotate([90,0,0]) cylinder(h=ha_cyl+(sep*alpha*0.5),r=rc); } }