You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
176 lines
5.2 KiB
176 lines
5.2 KiB
use <cadmodel-sg90/sg90.scad>; |
|
use <cadmodel-sg90/fastener_1.scad>; |
|
|
|
flap_angle = 0; |
|
servo_angle = -10; |
|
axle_dia = 4; |
|
axle_len = 40; |
|
raise = 0; |
|
|
|
tunnel_w = 160; |
|
tunnel_h = 160; |
|
tunnel_t = 10; // tunnel thickness |
|
tunnel_s = 40; // tunnel spacing: overlap for screws |
|
door_t = 50; // door thickness |
|
plexy_t = 6; // thickness of plexy glass sheet |
|
gap = 1; // gap between parts moving relative to each other |
|
seal = 1; // thickness of seal. May be set to gap |
|
guide_h = 40; |
|
bearing_inner_dia = 10; |
|
bearing_outer_dia = 20; |
|
bearing_h = 5; |
|
stopper_h = 40; |
|
stopper_w = 30; |
|
space = bearing_outer_dia; // space between plexy glass sheets |
|
|
|
// calculations |
|
rad = (space+2*plexy_t)/2; |
|
sheet_h = tunnel_h-2*seal-rad; |
|
h0 = stopper_w/2; |
|
h1 = guide_h-gap-10; |
|
h2 = 10+gap+h0; |
|
h3 = bearing_h/2+gap; |
|
|
|
// colors |
|
plexy = [0.4,0.6,1,0.6]; |
|
red = [1,0,0]; |
|
green = [0,0.6,0]; |
|
silver = [0.7,0.7,0.7]; |
|
snow = [1,1,1,0.5]; |
|
wood = [0.8,0.3,0]; |
|
|
|
// constants |
|
$fn = 32; |
|
rx = [90,0,0]; // rotate 90 deg around x |
|
ry = [0,90,0]; // rotate 90 deg around y |
|
x = [1,0,0]; |
|
y = [0,1,0]; |
|
z = [0,0,1]; |
|
|
|
module door(){ |
|
color(wood) difference(){ |
|
cube([1000,door_t,2000],true); |
|
tunnel_core(); |
|
} |
|
} |
|
|
|
module tunnel_core(){ |
|
cube([tunnel_w+2*tunnel_t,door_t+2*tunnel_t,tunnel_h+2*tunnel_t],true); // eigentlicher tunnel |
|
} |
|
|
|
module tunnel(){ |
|
color(snow)difference(){ |
|
union(){ |
|
tunnel_core(); |
|
translate(-y*(door_t+tunnel_t)/2) cube([tunnel_w+2*tunnel_s,tunnel_t,tunnel_h+2*tunnel_s],true); // krempe |
|
translate( y*(door_t+tunnel_t)/2) cube([tunnel_w+2*tunnel_s,tunnel_t,tunnel_h+2*tunnel_s],true); // krempe |
|
translate((tunnel_t+tunnel_h)/-2*z) hull(){ |
|
cube([bearing_h,tunnel_h,tunnel_t],true); |
|
cube([tunnel_w+2*tunnel_t,door_t+2*tunnel_t,tunnel_t],true); |
|
} |
|
} |
|
cube([tunnel_w,door_t+2*tunnel_t+2,tunnel_h],true); // öffnung |
|
translate((tunnel_h+bearing_outer_dia-gap)/-2*z)cube([bearing_h+2*gap,bearing_outer_dia,bearing_outer_dia],true); |
|
translate(z*(sheet_h-rad)/2){ |
|
translate( x*(tunnel_t+(tunnel_w-axle_len)/2)) rotate(y*90) cylinder(d=axle_dia+gap,h=axle_len+gap,center=true); // axle |
|
translate(-x*(tunnel_t+(tunnel_w-axle_len)/2)) rotate(y*90) cylinder(d=axle_dia+gap,h=axle_len+gap,center=true); // axle |
|
} |
|
} |
|
} |
|
|
|
module screw(){ |
|
rotate(x*90)cylinder(d=4,h=space+3*plexy_t,center=true); |
|
} |
|
|
|
module sheets(){ |
|
difference(){ |
|
union(){ |
|
translate([0,(plexy_t+space)/2,-sheet_h/2])cube([tunnel_w-2*seal,plexy_t,sheet_h],true); |
|
translate([0, (plexy_t+space)/-2,-sheet_h/2])cube([tunnel_w-2*seal,plexy_t,sheet_h],true); |
|
} |
|
hull(){ |
|
translate(-z*(sheet_h+10)) rotate(ry) cylinder(d=bearing_outer_dia+2*gap,h=bearing_h+2*gap,center=true); |
|
translate(z*(bearing_outer_dia/2-sheet_h)) rotate(ry) cylinder(d=bearing_outer_dia+2*gap,h=bearing_h+2*gap,center=true); |
|
} |
|
} |
|
|
|
} |
|
|
|
module guide(){ |
|
|
|
translate([h2, 0,h1/2-sheet_h])cube([20,space,h1],true); |
|
translate([-h2, 0,h1/2-sheet_h])cube([20,space,h1],true); |
|
|
|
} |
|
|
|
module bearing_case(){ |
|
rotate(ry) cylinder(d=bearing_inner_dia-gap,h=h3); |
|
translate([h3/2+stopper_w/4,0,stopper_h/2]) cube([h0-h3,space-2*gap,stopper_h],true); |
|
translate([(h0+5)/2,0,stopper_h-5]) cube([h0+5,space-2*gap,10],true); |
|
} |
|
|
|
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 stopper(){ |
|
color(green) { |
|
bearing_case(); |
|
rotate(z*180)bearing_case(); |
|
} |
|
bearing(); |
|
} |
|
|
|
module axles(){ |
|
translate(z*(sheet_h-rad)/2){ |
|
translate( x*(tunnel_t+(tunnel_w-axle_len)/2)) rotate(y*90) cylinder(d=axle_dia,h=axle_len,center=true); // axle |
|
translate(-x*(tunnel_t+(tunnel_w-axle_len)/2)) rotate(y*90) cylinder(d=axle_dia,h=axle_len,center=true); // axle |
|
} |
|
|
|
} |
|
|
|
module flap(){ |
|
translate(z*(sheet_h-rad)/2) rotate(x*flap_angle) { |
|
difference(){ |
|
rotate(y*90) cylinder(d=2*rad,h=tunnel_w-2*seal,center=true); |
|
sheets(); |
|
translate([tunnel_w/ 4,0,rad/-2])screw(); |
|
translate([tunnel_w/-4,0,rad/-2])screw(); |
|
translate(-x*(tunnel_t+(tunnel_w-axle_len)/2)) rotate(y*90) cylinder(d=axle_dia+gap,h=axle_len+2*gap,center=true); |
|
translate( x*(tunnel_t+(tunnel_w-axle_len)/2)) rotate(y*90) cylinder(d=axle_dia+gap,h=axle_len+2*gap,center=true); |
|
} |
|
color(plexy) difference(){ |
|
union(){ |
|
sheets(); |
|
guide(); |
|
} |
|
translate([h2,0,5-sheet_h])screw(); |
|
translate([h2,0,guide_h-15-gap-sheet_h])screw(); |
|
translate([-h2,0,5-sheet_h])screw(); |
|
translate([-h2,0,guide_h-15-gap-sheet_h])screw(); |
|
translate([tunnel_w/ 4,0,rad/-2])screw(); |
|
translate([tunnel_w/-4,0,rad/-2])screw(); |
|
} |
|
translate(z*(raise-sheet_h))stopper(); |
|
} |
|
} |
|
|
|
module servo(){ |
|
translate(-[5.5,0,28.5]) sg90(); |
|
rotate(servo_angle*z) sg90_f1(); |
|
} |
|
|
|
module servo_in_place(){ |
|
translate([-11,0,-tunnel_h/2 -10])rotate(90*x)servo(); |
|
} |
|
|
|
door(); |
|
tunnel(); |
|
flap(); |
|
axles(); |
|
servo_in_place();
|
|
|