x-end: use correct zmotor_delta_{x,y}
[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 // todo: make x-end height global and make anything relying implicitly
12 // on the height of the x-end use that for positioning.
13
14 // bearing height, strain relief (&& maybe make dependent upon the bearing diameter)
15
16 // major issues with rev 3
17
18 // - motor side screw hole conflicts with switch / other rear mount is
19 // inaccessible without removing the leadscrew from the nut
20
21 // - New idler anti-pitching ribs are too big (new idler I wasn't
22 // using is larger so the existing ones worked fine for that one...)
23 // NOTE: new idler is meant for integrated toothed idler...
24
25 use <bushing.scad>
26 include <configuration.scad>
27
28 pushfit_d = bushing_xy[0] * 2 + 0.25; //smooth_rod_d + 0.25;
29 rod_distance = 50;
30 x_box_height = 5 + rod_distance + bushing_xy[0] * 2 + 0.25;
31 hex_nut_r = 4.75;
32 thinwall = 3;
33
34 module vertical_bushing_base(bushing){
35 bushing_size = bushing[1]*2 + 2 * thinwall;
36 translate(v=[-2-bushing_size/4,0,x_box_height/2]) cube(size = [4+bushing_size/2,bushing_size,x_box_height], center = true);
37 cylinder(h = x_box_height, r=bushing_size/2, $fn = 90);
38 }
39
40 module vertical_bushing_holes(bushing){
41 bushing_cut_extra = 0.2; // padding so it's not too tight
42 translate(v=[0,0,-4]) cylinder(h = x_box_height + 3, r=bushing[1] + bushing_cut_extra, $fn = 60);
43 translate(v=[0,0,x_box_height-4]) cylinder(h=x_box_height,r=bushing[1]-1,$fn=60);
44 // TODO: make translate(z) use x_box_height to correctly position slit
45 #rotate(a=[0,0,-50]) translate(v=[8,0,24/*was 31.5 mjr*/]) cube(size = [10,2 /*was 1 mjr*/ ,x_box_height+13], center = true);
46 translate([0,0,-1]) cylinder(h=9,r1=bushing[1]+thinwall/2+1,r2=4,$fn=60);
47 //#translate([0,0,49]) cylinder(h=9,r2=bushing[1]+thinwall/2,r1=4,$fn=60);
48 }
49
50
51 module nut_trap_base () {
52 cube(size=[16,21,8],center=true);
53 translate ([2,0,0]) cylinder(h=8,r=12.5,$fn=50,center=true);
54 }
55
56 module nut_trap () {
57 union() {
58 // center post of brass nut
59 cylinder(h=12,r=5.45,$fn=50,center=true);
60 // holes for m3 screws in brass nut
61 translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
62 #rotate([0,0,90]) translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
63 rotate([0,0,180]) translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
64 #rotate([0,0,270]) translate(v=[8,0,0]) cylinder(h=12,r=1.8,$fn=20,center=true);
65 }
66 }
67
68 module x_end_base(){
69 // Main block
70 height = x_box_height;
71 // TODO: calculate correct translate(y) + cube(y) using size of bearing
72 translate(v=[-15,-10,height/2]) cube(size = [17,45,height], center = true);
73 // Bearing holder
74 vertical_bushing_base(bushing_z);
75 //Nut trap
76 translate(v=[-4+zmotor_delta_x,-17-zmotor_delta_y,4]) nut_trap_base ();
77 // Cube
78 // #translate(v=[-2-2,-17,4]) cube(size = [8,16,8], center = true);
79 // Hexagon
80 // #translate(v=[0,-17,0]) rotate([0,0,30]) cylinder(h = 8, r=8, $fn = 6);
81 }
82
83 module x_end_holes(){
84 vertical_bushing_holes(bushing_z);
85 // Belt hole
86 translate(v=[-1,0,0]){
87 // Stress relief
88 translate(v=[-5.5-10+1.5,-bushing_z[1]-4,30]) cube(size = [20,1,28], center = true);
89 // Cut out for belt (this is NOT centered because the motor isn't centered)
90 difference(){
91 translate(v=[-5.5-10+1.5,-10,30]) cube(size = [10,46,28], center = true);
92
93 // Nice edges
94 translate(v=[-5.5-10+1.5,-10,30+23]) rotate([0,45,0]) cube(size = [10,46,28], center = true);
95 translate(v=[-5.5-10+1.5,-10,30+23]) rotate([0,-45,0]) cube(size = [10,46,28], center = true);
96 translate(v=[-5.5-10+1.5,-10,30-23]) rotate([0,45,0]) cube(size = [10,46,28], center = true);
97 translate(v=[-5.5-10+1.5,-10,30-23]) rotate([0,-45,0]) cube(size = [10,46,28], center = true);
98
99 }
100 }
101
102
103 pushrod_extra_z = 2.5;
104 // Bottom pushfit rod
105 #translate(v=[-15,-41.5,bushing_xy[0]+pushrod_extra_z]) rotate(a=[-90,0,0]) pushfit_rod(pushfit_d,50);
106 // Top pushfit rod
107 translate(v=[-15,-41.5,rod_distance+bushing_xy[0]+pushrod_extra_z]) rotate(a=[-90,0,0]) pushfit_rod(pushfit_d,50);
108 // Nut trap
109 translate(v=[zmotor_delta_x,-17-zmotor_delta_y,3]) rotate ([0, 0, 45]) nut_trap ();
110 // #translate(v=[0,-17,-0.5]) cylinder(h = 4, r1=3.4, r2=2.9, $fn=25);
111 // translate(v=[0,-17,3]) rotate([0,0,30]) cylinder(h = 10, r=hex_nut_r, $fn = 6);
112 }
113
114
115 // Final prototype
116 module x_end_plain(){
117 difference(){
118 x_end_base();
119 x_end_holes();
120 }
121 }
122
123 x_end_plain();
124
125
126 module pushfit_rod(diameter,length){
127 translate([0,-0.3,0]) cylinder(h = length, r=diameter/2, $fn=30);
128 translate([0,0.3,0]) cylinder(h = length, r=diameter/2, $fn=30);
129 // difference(){
130 // translate(v=[0,-diameter/2.85,length/2]) rotate([0,0,45]) cube(size = [diameter/2,diameter/2,length], center = true);
131 // translate(v=[0,-diameter/4-diameter/2-0.4,length/2]) rotate([0,0,0]) cube(size = [diameter,diameter/2,length], center = true);
132 // }
133
134 }
135