77ff3b1f3adeb5e46dd5031b450b2cd68a470759
[clinton/prusa3.git] / box_frame / x-end.scad
1 // PRUSA iteration3
2 // X end prototype
3 // GNU GPL v3
4 // Josef Průša <iam@josefprusa.cz> and contributors
5 // http://www.reprap.org/wiki/Prusa_Mendel
6 // http://prusamendel.org
7
8 // Also includes code from Wilson and Wilson2, (c) Marty Rice
9 // https://github.com/mjrice/wilson
10
11 // major issues with rev 3
12
13 // - motor side screw hole conflicts with switch / other rear mount is
14 // inaccessible without removing the leadscrew from the nut
15
16 use <bushing.scad>
17 include <configuration.scad>
18
19 pushfit_d = bushing_xy[0] * 2 + 0.2;
20 thinwall = single_wall_width * 6; // 3 perimeters
21 vertical_bushing_base_size = bushing_z[1]*2 + 2 * thinwall;
22
23 x_box_length = 45; // TODO: auto-adjust based on bearing size?
24
25 // todo: add ghost bearing model to make it easier to spot check if
26 // everything is aligned
27 module vertical_bushing_base(){
28 translate(v=[-2-vertical_bushing_base_size/4,0,x_box_height/2]) cube(size = [4+vertical_bushing_base_size/2,vertical_bushing_base_size,x_box_height], center = true);
29 cylinder(h = x_box_height, r=vertical_bushing_base_size/2, $fn = 90);
30 }
31
32 module vertical_bushing_holes(){
33 // FIXME: is extra cut necessary? check conf_bushing
34 bushing_cut_extra = 0.2; // padding so it's not too tight
35 translate(v=[0,0,-4]) cylinder(h = x_box_height + 3, r=bushing_z[1] + bushing_cut_extra, $fn = 60);
36 translate(v=[0,0,x_box_height-4]) cylinder(h=x_box_height,r=bushing_z[1]-1,$fn=60);
37 // TODO: is slit too wide or too low? Wilson increased width from 1
38 // -> 2 mm, slit also might need to end 1-2mm before the base
39 #rotate(a=[0,0,-50]) translate(v=[thinwall*2 + 1,0,x_box_height/2 - 2]) cube(size = [bushing_z[2]/2, 2 ,x_box_height], center = true);
40 translate([0,0,-1]) cylinder(h=9,r1=bushing_z[1]+thinwall/2+1,r2=4,$fn=60);
41 }
42
43 module nut_trap_base () {
44 // TODO: cube doesn't line up with edge of base, cylinder is slightly asymmetrical
45 // adapt newer nut trap from prusa i3 mk3 instead of wilson2
46 cube(size=[16,21,8],center=true);
47 translate ([2,0,0]) cylinder(h=8,r=12.5,$fn=50,center=true);
48 }
49
50 module nut_trap () {
51 union() {
52 // center post of brass nut
53 cylinder(h=12,r=5.45,$fn=50,center=true);
54 // holes for m3 screws in brass nut
55 translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
56 #rotate([0,0,90]) translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
57 rotate([0,0,180]) translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
58 #rotate([0,0,270]) translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
59 }
60 }
61
62 // x position of edge of main block (facing frame), for attaching objects to it
63 function x_base_back() = -10 - bushing_xy[0] - x_box_width/2;
64 // y position of edge of main block facing away from x-axis
65 function x_base_outside() = vertical_bushing_base_size/2;
66 // y position of edge of main block facing toward the x-axis
67 function x_base_inside() = -x_box_length/2 - vertical_bushing_base_size/2;
68
69 module x_end_base(){
70 // Main block
71 translate(v=[-10 - bushing_xy[0], -x_box_length/2 + vertical_bushing_base_size/2,x_box_height/2]) cube(size = [x_box_width,x_box_length,x_box_height], center = true);
72 // Bearing holder
73 vertical_bushing_base();
74 //Nut trap
75 translate(v=[-4+zmotor_delta_x,-17-zmotor_delta_y,4]) nut_trap_base ();
76 }
77
78 // TODO: x translation of belt and smooth rods needs to adapt to
79 // x_end_width and motor/idler pulley position.
80
81 module x_end_holes(){
82 vertical_bushing_holes();
83 // Belt hole
84 translate(v=[-1,0,0]){
85 // Stress relief
86 translate(v=[-5.5-10+1.5,-bushing_z[1]-4,30]) cube(size = [20,1,28], center = true);
87 // Cut out for belt (this is NOT centered because the motor isn't centered)
88 x_box_offset = -x_box_length/2 + vertical_bushing_base_size/2;
89 difference(){
90 translate(v=[-5.5-10+1.5, x_box_offset ,30]) cube(size = [10, x_box_length + 1,28], center = true);
91
92 // Nice edges
93 translate(v=[-5.5-10+1.5,x_box_offset,30+23]) rotate([0,45,0]) cube(size = [10,x_box_length + 1,28], center = true);
94 translate(v=[-5.5-10+1.5,x_box_offset,30+23]) rotate([0,-45,0]) cube(size = [10,x_box_length + 1,28], center = true);
95 translate(v=[-5.5-10+1.5,x_box_offset,30-23]) rotate([0,45,0]) cube(size = [10,x_box_length + 1,28], center = true);
96 translate(v=[-5.5-10+1.5,x_box_offset,30-23]) rotate([0,-45,0]) cube(size = [10,x_box_length + 1,28], center = true);
97
98 }
99 }
100
101
102 // FIXME: confirm length of smooth rod doesn't change when x_box_length or bearing size changes
103 // should also make sure this is long enough if x-ends somehow end up larger than 50mm
104 // TODO: needs to shift top rod as diameter increases, wall is very
105 // thing for 10mm, and fails entirely for 12mm
106 translate([-10 - bushing_xy[0], 0, 0]) {
107 // Top pushfit rod
108 #translate([0, -41.5, 6]) rotate([-90, 0, 0]) pushfit_rod(pushfit_d, 50);
109 // Bottom pushfit rod
110 translate([0, -41.5, xaxis_rod_distance+6]) rotate([-90, 0, 0]) pushfit_rod(pushfit_d, 50);
111 }
112
113 // Nut trap
114 translate(v=[zmotor_delta_x,-17-zmotor_delta_y,3]) rotate ([0, 0, 45]) nut_trap ();
115 }
116
117
118 // Final prototype
119 module x_end_plain(){
120 difference(){
121 x_end_base();
122 x_end_holes();
123 }
124 }
125
126 x_end_plain();
127
128
129 module pushfit_rod(diameter,length){
130 translate([0,-0.3,0]) cylinder(h = length, r=diameter/2, $fn=30);
131 translate([0,0.3,0]) cylinder(h = length, r=diameter/2, $fn=30);
132 // TODO: reintroduce teardrop holes?
133 // difference(){
134 // translate(v=[0,-diameter/2.85,length/2]) rotate([0,0,45]) cube(size = [diameter/2,diameter/2,length], center = true);
135 // translate(v=[0,-diameter/4-diameter/2-0.4,length/2]) rotate([0,0,0]) cube(size = [diameter,diameter/2,length], center = true);
136 // }
137
138 }