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