x-end/motor: position and size motor arm correctly
[clinton/prusa3.git] / box_frame / x-end-motor.scad
1 // PRUSA iteration3
2 // X end motor
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 // Alterations for reprap Wilson by Martin Rice <mrice411@gmail.com>
8
9 include <configuration.scad>
10 use <x-end.scad>
11
12 adj_block_x = 9;
13 adj_block_y = 10;
14 adj_block_z = 32;
15
16 // fixme: if we keep this, needs to adjust based on size of bushing_z
17 // to clear the side of the plate
18 offs_adjuster_y = x_base_outside() - adj_block_y/2;
19
20 motor_offs_z = 0; // todo: broken, not sure if useful -- adjust based on bearing size to keep straight belt line?
21 motor_y_offset = 0; // todo: use z_delta for y offset,
22
23 module adjustomatic() {
24 difference() {
25 translate(v=[x_base_back() - adj_block_x/2,offs_adjuster_y,x_box_height - adj_block_z/2]) cube(size=[adj_block_x,adj_block_y,adj_block_z],center=true);
26
27 // these were translated -0.5 from block in wilson
28 translate ([0, 0, -0.5]) {
29 translate(v=[x_base_back() -adj_block_x/2 - 5,offs_adjuster_y,x_box_height-adj_block_z/2-8])
30 rotate([0,-30,0]) cube(size=[adj_block_x,adj_block_y+2,adj_block_z],center=true);
31
32 translate(v=[x_base_back() -adj_block_x/2 -1,offs_adjuster_y,x_box_height-adj_block_z/2-3])
33 cube(size=[adj_block_x,adj_block_y-2,adj_block_z-2],center=true);
34
35 translate(v=[x_base_back() -adj_block_x/2,offs_adjuster_y,x_box_height-adj_block_z/2+14]) {
36 rotate([0,0,30]) #cylinder(h = 4, r = 7.0/2 , $fn = 6);
37 translate([0,0,-20]) #cylinder(h=30,r=1.6,$fn=16);
38 }
39 }
40 }
41 }
42
43 // the endstop mount will be translated by this much (negative values
44 // mean it moves away from the motor and toward the X carriage, giving
45 // more room for leads and also extra space for the auto bedleveling
46 // servo housing which is on this side of the extruder):
47 endstop_sw_offs_adjust = -0;
48
49 module pocket_endstop() // endstop holder grafted onto the side toward the rods
50 {
51 translate([-7,-45,0])
52 union() {
53 // angled wall that attaches to the endstop holder
54 translate([-1,18,0]) rotate([0,0,-30]) cube(size=[8.5,2,22]);
55 // little bit of extra support at the bottom corner
56 translate([-1.5,15.,2]) rotate([0,90,0]) cube(size=[2,3,10]);
57
58 difference() {
59 translate([-1.5,endstop_sw_offs_adjust,0]) cube(size=[9,20.5,22]);
60
61 translate([-2,endstop_sw_offs_adjust,1]) cube(size=[7,21,22]);
62 translate([0,15.5,8]) cube(size=[10,5,20]);
63
64 // screw holes for endstop switch
65 translate([-2,7+endstop_sw_offs_adjust,1.5+5.5]) rotate([0,90,0]) cylinder(r=1.5,h=15);
66 translate([-2,7+endstop_sw_offs_adjust,1.5+5.5+9.5]) rotate([0,90,0]) cylinder(r=1.5,h=15);
67 }
68 }
69 }
70
71 module x_end_motor_sr() {
72 sr_box_height = 12;
73 translate([x_base_back(), x_base_outside(),x_box_height - sr_box_height]) {
74 difference() {
75 cube(size=[8,13+motor_y_offset,sr_box_height]);
76 translate([4,12.5+motor_y_offset,sr_box_height-1]) rotate([0,90,0]) difference() {
77 cylinder(r=4.5,h=4,$fn=16,center=true);
78 translate([0,0,-1]) cylinder(r=2.5,h=7,$fn=16,center=true);
79 }
80 translate([9,11.6+motor_y_offset,sr_box_height]) rotate([0,45,90]) cube(size=[2,11,2]);
81 }
82 }
83 }
84
85 module x_end_motor_base(){
86 x_end_base();
87 // motor arm
88 translate(v=[x_base_back() + x_box_width/2,x_base_outside() + (44 + motor_y_offset)/2,26.5+motor_offs_z]) cube(size = [x_box_width,44+motor_y_offset*2,53], center = true);
89 // z stop adjuster
90 adjustomatic();
91 // x endstop holder
92 pocket_endstop();
93 }
94
95 screw_head_r = 3.5;
96
97 module x_end_motor_holes(){
98 x_end_holes();
99 // Position to place
100 translate(v=[-1,x_base_outside() + 44/2,30.25+motor_offs_z]){
101 // Belt hole
102 translate(v=[-14,1,0]) cube(size = [10,46,44/2], center = true);
103 // TODO: use built-in nema17 library to create holes
104 // FIXME: ensure these maintain bolt length as x_box_width
105 // increases (screw head holes need to be cut deeper)
106
107 translate ([0, motor_y_offset, 0]) {
108 // Motor mounting holes
109 // based on wilson x-ends, the intention here is to
110 // leave a 11.5mm shaft for the screw
111 motor_screwhead_depth = -x_base_back() - 11.5;
112 #translate(v=[20,-15.5,-15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = 70, r=1.8, $fn=30);
113 #translate(v=[1,-15.5,-15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = motor_screwhead_depth, r=screw_head_r, $fn=30);
114
115
116 translate(v=[20,-15.5,15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = 70, r=1.8, $fn=30);
117 translate(v=[1,-15.5,15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = motor_screwhead_depth, r=screw_head_r, $fn=30);
118
119
120 translate(v=[20,15.5,-15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = 70, r=1.8, $fn=30);
121 translate(v=[1,15.5,-15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = motor_screwhead_depth, r=screw_head_r, $fn=30);
122
123
124 translate(v=[20,15.5,15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = 70, r=1.8, $fn=30);
125 translate(v=[1,15.5,15.5]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = motor_screwhead_depth, r=screw_head_r, $fn=30);
126
127 // Material saving cutout
128 translate(v=[-10,12+motor_y_offset/2,10]) cube(size = [60,42 + motor_y_offset,42], center = true);
129
130 // Material saving cutout
131 // todo (maybe...): if motor_y_offset is above 10 edge
132 // becomes very sharp, but this is a pretty unrealistic
133 // situation so might not be worth caring about.
134 translate(v=[-10,40,-30]) rotate(a=[45,0,0]) cube(size = [60,43,42], center = true);
135 // Motor shaft cutout
136 translate(v=[0,0,0]) rotate(a=[0,-90,0]) rotate(a=[0,0,90]) cylinder(h = 70, r=17, $fn=6);
137 }
138 }
139 // zip tie retainer for securing end stop wiring
140 #translate([x_base_back() + x_box_width,x_base_inside() + 4.5/2,x_box_height - 8 - bushing_xy[0]*2]) difference() { cylinder(r=4.5,h=4,$fn=16);
141 translate([0,0,-1]) cylinder(r=2.5,h=7,$fn=16);
142 }
143 #translate([x_base_back() + x_box_width,-bushing_z[2]/2 - 1,x_box_height]) rotate([90,0,0]) difference() { cylinder(r=4.5,h=4,$fn=16,center=true);
144 translate([0,0,-1]) cylinder(r=2.5,h=7,$fn=16,center=true);
145 }
146 }
147
148 // Final part
149 module x_end_motor(){
150 difference(){
151 x_end_motor_base();
152 x_end_motor_holes();
153 }
154 // strain relief (zip tie point) below the motor
155 x_end_motor_sr();
156 }
157
158 rotate([0,0,180])
159 x_end_motor();