z-axis: make zmotor_delta_{x,y} use local coordinate system
[clinton/prusa3.git] / box_frame / z-axis.scad
CommitLineData
2159eed1
VAH
1// PRUSA iteration3
2// Z axis
3// GNU GPL v3
4// Josef Průša <josefprusa@me.com>
5// Václav 'ax' Hůla <axtheb@gmail.com>
6// http://www.reprap.org/wiki/Prusa_Mendel
8e93419f 7// http://github.com/josefprusa/Prusa3
2159eed1 8
65a72cd5
T
9// ThingDoc entries
10/**
11 * @id zMotorHolder
12 * @name Z Axis Motor Holder
13 * @category Printed
14 */
15
16/**
17 * @id zRodHolder
18 * @name Z Axis Rod Holder
19 * @category Printed
20 */
21
3506b70b
VAH
22include <configuration.scad>
23
cec35279 24module zmotorholder(thickness=(frame_type == frame_single ? 38 : 23), bottom_thickness=5){
fb91eeba
CE
25 position_y = board_to_xz_distance + zaxis_delta_y + zmotor_delta_y;
26 position_x = board_to_xz_distance + zaxis_delta_x + zmotor_delta_x;
3506b70b
VAH
27 difference(){
28 union(){
29 // Motor holding part
30 difference(){
31 union(){
fb91eeba
CE
32 zrodholder(thickness=thickness, xlen=45 + zmotor_delta_x + zaxis_delta_x, ylen=48 + 5 + zmotor_delta_y + zaxis_delta_y, zdelta=((i_want_to_use_single_plate_dxf_and_make_my_z_weaker == 0) ? 0 : 5), bottom_x = 50 + zaxis_delta_x + zmotor_delta_x, bottom_y = 15 + zmotor_delta_y + zaxis_delta_y, am_top=0, bottom_thickness=bottom_thickness);
33 translate([position_x, position_y, 0]) {
34 nema17(places=[1, 1, 1, 1], h=bottom_thickness + layer_height, $fn=23, shadow=layer_height + 2);
3506b70b
VAH
35 }
36 }
846248f3 37 // remove any interfering walls
fb91eeba
CE
38 translate([position_x, position_y, layer_height + 2 + 21 +3]) {
39 cube([43 + zmotor_delta_x + zaxis_delta_x,43,42], center = true);
40 }
41
846248f3 42 }
d3618a65 43
3506b70b 44 // motor screw holes
cec35279
CE
45
46 // FIXME: y = board_to_xz distance looks supicious --
47 // the smooth rod is offset by a fixed amount so why
48 // would the motor mount be moved in both directions
49 // instead of just away from the frame? X-axis does
50 // not use this to offset the leadscrew hole either.
fb91eeba 51 translate([position_x, position_y, thickness]) {
5e8013bd 52 mirror([0, 0, 1]) translate([0, 0, thickness-8])
f65db3cb 53 nema17(places=[0, 1, 1, 1], holes=true, h=bottom_thickness + 1, $fn=small_hole_segments);
854f95f0 54 //shadow=-6 + layer_height);
3506b70b
VAH
55 }
56 }
57 }
58 }
d3618a65 59}
3506b70b
VAH
60
61
cec35279 62module zrodholder(thickness=(frame_type == frame_single ? 14 : 15), bottom_thickness=5, ylen=44, xlen=34, zdelta=0, bottom_y=14, bottom_x=14, am_top=1){
5cae2970 63 holder_inner_r = 9;
0f6ec51a 64 holder_inner_r2 = 2;
846248f3 65 smooth_rod_insert_radius = bushing_z[0] + 5 * single_wall_width;
3506b70b
VAH
66 difference(){
67 union(){
3506b70b 68 difference(){
cec35279 69 union() {
3506b70b 70 //piece along the flat side of a board
cec35279
CE
71 cube_fillet([bottom_x, ylen, bottom_thickness], vertical=[8, 3, 0, 0]);
72 if (frame_type == frame_alu) {
73 top_radius = am_top ? thickness : thickness / 3;
846248f3 74 cube_fillet([5, ylen, thickness], vertical=[3, 3, 0, 0], top = [top_radius, 0, 0, 5]);
cec35279
CE
75
76 if (am_top) {
77 // rear bracket
78 translate ([-board_thickness - 5, 0, 0])
79 cube_fillet([5, ylen, thickness], vertical=[3, 3, 0, 0], top = [top_radius, 5, 0, 0]);
80 translate ([-board_thickness, 5, 0])
81 cube ([board_thickness, ylen - 6, bottom_thickness/2]);
82 }
83 }
84 else {
85 cube_fillet([5, ylen, thickness], vertical=[3, 3, 0, 0], top = [thickness / 1.7, 0, 0, 5]);
86 }
87
88 //hole for Z axis is thru this
846248f3 89 cube_fillet([xlen + zaxis_delta_x, bottom_y, bottom_thickness], vertical=[3, 0, 0, 3]);
fb91eeba 90 if (bottom_x < board_to_xz_distance - z_delta + zaxis_delta_x) {
9865d15a
CE
91 translate([bottom_x, bottom_y, 0]) {
92 //large fillet that makes it stiffer by lot. Thanks to Marcus Wolschon
93 difference(){
94 cube([holder_inner_r, holder_inner_r, bottom_thickness]);
95 translate([holder_inner_r, holder_inner_r, -0.5])
96 cylinder(r=holder_inner_r, h=bottom_thickness + 1);
97 }
98 }
99 }
cec35279
CE
100 if (frame_type != frame_alu) {
101 translate([5, 5, 0]) {
102 difference(){
103 cube([holder_inner_r2, holder_inner_r2, thickness - 5.5]);
104 translate([holder_inner_r2, holder_inner_r2, -0.5])
105 cylinder(r=holder_inner_r2, h=thickness + 1, $fn=20);
106 }
107 }
0f6ec51a 108 }
0802ac49
CE
109 // leadscrew bearing hole is cut from this
110 if (am_top) {
fb91eeba
CE
111 lead_bearing_y = board_to_xz_distance + zaxis_delta_y + zmotor_delta_y;
112 lead_bearing_x = board_to_xz_distance + zaxis_delta_x + zmotor_delta_x;
113 translate ([lead_bearing_x, lead_bearing_y, 0]) cylinder (d = bearing_608[0] + 1 + 2, h = bearing_608[2] + layer_height*4);
0802ac49 114 }
3506b70b 115 //piece along cut side of the board
cec35279
CE
116 if (frame_type == frame_box) {
117 translate([-board_thickness, 0, 0])
118 cube_fillet([board_thickness + board_to_xz_distance + bushing_z[0], 5, thickness], radius=2, top = [0, 0, 0, thickness], $fn=99);
119 } else if (frame_type == frame_alu) {
846248f3 120 // split piece in front of and behind into separate pieces
cec35279 121 translate([-board_thickness, 0, 0]) {
846248f3
CE
122 cube_fillet([board_thickness, 5.0, thickness], vertical = [0, 0, 0, 0], top = [0, 0, 0, 0]);
123 }
124
51dbb82b 125 cube_fillet([am_top ? board_to_xz_distance + zaxis_delta_y - smooth_rod_insert_radius : xlen + zaxis_delta_y , 5.0, thickness], vertical = [2, 0, 0, 0], top = [0, 0, 0, thickness]);
846248f3
CE
126
127 // extra support along edge of smooth rod hole
128 radius_diff = smooth_rod_insert_radius - bushing_z[0];
129 hull () {
fb91eeba
CE
130 translate([-board_thickness/3, -zaxis_delta_y/3, 0]) {
131 cube_fillet([board_thickness/3 + board_to_xz_distance + zaxis_delta_x - bushing_z[0] , -zaxis_delta_y/3 , thickness/2], vertical = [2, 0, 4, 0], top = [0, 0, 4, thickness/2]);
846248f3
CE
132 }
133 translate([board_to_xz_distance/2, -zaxis_delta_x + radius_diff/6, 0]) {
fb91eeba 134 cube_fillet([board_to_xz_distance/2 + zaxis_delta_x + smooth_rod_insert_radius*0.75, radius_diff/3 , bottom_thickness*2], vertical = [2, 0, 4, bushing_z[0] * smooth_rod_insert_radius/bushing_z[0]], top = [0, 0, 2, thickness/4]);
846248f3 135 }
cec35279 136 }
5e8013bd 137 } else {
eb40b77a 138 translate([-board_thickness/2, 0, 0])
0f6ec51a 139 cube_fillet([board_thickness/2 + board_to_xz_distance + bushing_z[0], 5, thickness], radius=2, top = [0, 0, 0, thickness], $fn=99);
5e8013bd
VAH
140 }
141 //smooth rod insert
fb91eeba 142 translate([board_to_xz_distance - z_delta + zaxis_delta_x, 9 + zaxis_delta_y, 0])
1ebfb5d4 143 cylinder(h=bottom_thickness * (am_top ? 1.75 : 1.75), r=smooth_rod_insert_radius);
3506b70b 144 }
0802ac49
CE
145
146 // === difference ===
147
3506b70b 148 //smooth rod hole
fb91eeba 149 #translate([board_to_xz_distance - z_delta + zaxis_delta_x, 9 + zaxis_delta_y, -1]) cylinder(h=am_top ? thickness+20 : bottom_thickness, r=bushing_z[0] + single_wall_width / 4);
3506b70b 150 //inside rouned corner
cec35279
CE
151 if (frame_type != frame_alu) {
152 translate([0, 5, -1]) cylinder(r=0.8, h=100, $fn=8);
153 }
154
0802ac49
CE
155 // leadscrew hole
156 if (am_top) {
fb91eeba
CE
157 lead_bearing_y = board_to_xz_distance + zaxis_delta_y + zmotor_delta_y;
158 lead_bearing_x = board_to_xz_distance + zaxis_delta_x + zmotor_delta_x;
159 translate ([lead_bearing_x, lead_bearing_y, 0]) {
0802ac49
CE
160 difference () {
161 union () {
162 translate ([0, 0, 1]) cylinder (d = 10.8, h = bearing_608[2]*2);
163 translate ([0, 0, -1]) cylinder (d = 23, h = bearing_608[2]+1);
164 }
165 #translate ([0, 0, bearing_608[2]-layer_height]) cylinder (d = 23, h = layer_height);
166 }
167 }
168 }
169
5e8013bd 170 //front screws
cec35279
CE
171 if (frame_type == frame_single) {
172 //single plate has both screws on front
173 translate([16, 35, bottom_thickness + 4.5 + zdelta]) rotate([0, -90, 0]) {
174 plate_screw();
175 }
176 translate([16, 15, bottom_thickness + 4.5 + zdelta]) rotate([0, -90, 0]) {
177 plate_screw();
178 }
179 //motor mount has third screw
180 translate([16, 25, bottom_thickness + 4.5 + zdelta + 20]) rotate([0, -90, 0]) {
181 plate_screw();
182 }
183 } else if (frame_type == frame_alu) {
184 // three screws on front
04ddc678
CE
185 translate([18, ylen - board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, -90, 0]) plate_screw();
186 translate([18, 5 + board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, -90, 0]) plate_screw();
187 translate([18, 5 + board_thickness/2, thickness - board_thickness/2]) rotate([0, -90, 0])
cec35279
CE
188 plate_screw();
189
190 // motor mount screw for opposite extrusion
04ddc678 191 translate([18, ylen - board_thickness/2, thickness - board_thickness/2]) rotate([0, -90, 0])
cec35279
CE
192 plate_screw();
193
194 // back plate
04ddc678 195 translate([-board_thickness-18, ylen - board_thickness/2, thickness - board_thickness/2]) rotate([0, 90, 0])
cec35279 196 plate_screw();
04ddc678 197 translate([-board_thickness-18, 5 + board_thickness/2, thickness - board_thickness/2]) rotate([0, 90, 0])
cec35279 198 plate_screw();
04ddc678
CE
199 translate([-board_thickness-18, ylen - board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, 90, 0]) plate_screw();
200 #translate([-board_thickness-18, 5 + board_thickness/2, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([0, 90, 0]) plate_screw();
cec35279
CE
201
202 //side screws
04ddc678
CE
203 #translate([-board_thickness/2, -13, thickness-board_thickness/2]) rotate([-90, 0, 0]) plate_screw();
204 translate([-board_thickness/2, -13, bottom_thickness/2 + board_thickness/2 + zdelta]) rotate([-90, 0, 0]) plate_screw();
cec35279
CE
205 } else if (frame_type == frame_box) {
206 translate([16, 30, bottom_thickness+4]) rotate([0, -90, 0]) {
207 plate_screw();
208 }
5e8013bd 209 //side screw
0f6ec51a 210 translate([-board_thickness/2, -11, thickness/2]) rotate([-90, 0, 0]) plate_screw();
b32bbd0f 211 }
3506b70b
VAH
212 }
213 }
214 }
d3618a65 215}
1422dcbd
CE
216
217if (frame_type == frame_alu) {
218 // 2020 aluminum frame parts are larger
7b8e1e54
CE
219 translate([0, -60, 0]) zmotorholder(thickness=55, bottom_thickness=6);
220 translate([0, 60, 0]) mirror([0, 1, 0]) zmotorholder(thickness=55, bottom_thickness=6);
221
222 translate([110 + board_thickness, board_thickness+10, 0]) rotate([0,0,90]) zrodholder(thickness=board_thickness * 2 + 5, ylen = board_thickness * 2 + 10, bottom_x=48, bottom_thickness=6);
223 translate([110 + board_thickness, -(board_thickness+10), 0]) rotate([0, 0, -90]) mirror([0, 1, 0]) zrodholder(thickness=board_thickness * 2 + 5, ylen = board_thickness * 2 + 10, bottom_x=48, bottom_thickness=6);
224
1422dcbd
CE
225}
226else {
227 translate([10, -50, 0]) zmotorholder();
228 translate([0, 50, 0]) mirror([0, 1, 0]) zmotorholder();
229 translate([67, 14, 0]) rotate([0,0,90]) zrodholder();
230 translate([77, -14, 0]) rotate([0, 0, -90]) mirror([0, 1, 0]) zrodholder();
231}