/* parameters */ door_thick = 50; flap_w = 150; flap_h = 150; flap_thick = 6; bearing_inner_dia = 5; bearing_outer_dia = 20; bearing_h = 5; gap = 1; /* constants */ $fn = 32; rx = [90,0,0]; // rotate 90 deg around x ry = [0,90,0]; // rotate 90 deg around y silver = [0.7,0.7,0.7]; plexy = [0.4,0.6,1,0.6]; red = [1,0,0]; /* variable */ raise_stopper = 0; angle = 0; module door(){ difference(){ translate([900,door_thick,0]/-2)cube([900,door_thick,2000]); translate([-flap_w/2-gap,(door_thick+1)/-2,-1])cube([2*gap+flap_w,door_thick+1,flap_h+1]); } } module stopper_guide(){ translate([-30,flap_thick/2,bearing_outer_dia]) difference(){ cube([60,flap_thick,20-bearing_outer_dia]); translate([8,0,5])rotate(rx) cylinder(d=4,h=40,center=true); translate([52,0,5])rotate(rx) cylinder(d=4,h=40,center=true); } } module flap(){ color(plexy) { difference(){ translate([flap_w,flap_thick,0]/-2) cube([flap_w,flap_thick,flap_h]); translate([2*(10+gap)+bearing_h,bearing_outer_dia+gap,2]/-2) cube([bearing_h+2*(gap+10),bearing_outer_dia+gap,2*bearing_h+20+gap+1]); } translate([0,0,flap_h]) rotate(ry) cylinder(d=flap_thick,h=flap_w,center=true); stopper_guide(); rotate([0,0,180])stopper_guide(); } translate([0,0,raise_stopper])stopper(); } module bearing(){ color(silver) rotate(ry) difference(){ cylinder(d=bearing_outer_dia,h=bearing_h,center=true); cylinder(d=bearing_inner_dia,h=bearing_h+2,center=true); } } module bearing_case(){ rotate(ry) cylinder(d=bearing_inner_dia-gap,h=bearing_h+gap); translate([(bearing_h+gap)/2,0,0]) rotate(ry) cylinder(d=flap_thick,h=10); translate([bearing_h+1,-flap_thick,0]/2) cube([10,flap_thick,bearing_h+20]); translate([0,flap_thick/-2,bearing_h+1]) cube([bearing_h,flap_thick,19]); translate([0,flap_thick/-2-2,20]) #cube([(20+bearing_h+gap)/2,flap_thick+4,5]); } module stopper(){ color(red){ bearing_case(); rotate([0,0,180]) bearing_case(); } bearing(); } module frame(){ difference(){ translate([flap_w+20,0,20]/-2) cube([flap_w+20,door_thick,flap_h+20]); translate([flap_w+2*gap,1,gap]/-2) cube([flap_w+2*gap,door_thick+1,flap_h+2*gap]); translate([bearing_h+2*gap,bearing_outer_dia-door_thick,bearing_outer_dia+2]/-2) cube([bearing_h+2*gap,bearing_outer_dia,2+bearing_outer_dia/2]); } } *door(); translate([0,door_thick/-2,flap_h]) frame(); translate([0,0,flap_h*2]) rotate([angle,0,0]) translate([0,0,-flap_h]) flap();