Browse Source

Initial commit. Work in progress

Thomas Buck 6 years ago
commit
6ce7c3d180

BIN
docs/corexy.com-reference.png View File


+ 330
- 0
lib/Belt_Generator.scad View File

@@ -0,0 +1,330 @@
1
+/*
2
+Parametric belting generator, including straights, loops, and spirals, by Jeff Hertzberg
3
+Derived from:
4
+http://www.thingiverse.com/thing:19758 by The DoomMeister
5
+http://www.thingiverse.com/thing:16627 by Droftarts
6
+
7
+belting
8
+ Use: Generates belting in several standard tooth profiles.
9
+ Arguements:
10
+    print_layout (required) - how the belt will be arranged on the print surface. 
11
+        Current valid values: 
12
+            straight, (straight belt segment)
13
+            loop, (closed loop with teeth on inner side of loop)
14
+            loop_inner, (same as loop)
15
+            loop_outer, (closed loop with teeth on outer side of loop)
16
+            loop_match, (closed loop with teeth mirrored on both sides of loop)
17
+            loop_offset, (closed loop with teeth on both sides of loop, offset by half a tooth)
18
+            spiral. (belt spiraling inward from maximum_diameter with teeth on the inner side)
19
+            
20
+    tooth_profile (required) - shape of tooth. Only use profiles where the tooth form module is defined.
21
+        Current valid values: 
22
+            MXL, 
23
+            T2.5, 
24
+            T5, 
25
+            T10, 
26
+            GT2_2mm, 
27
+            GT2_3mm, 
28
+            GT2_5mm, 
29
+            AT5, 
30
+            HTD_3mm, 
31
+            HTD_5mm, 
32
+            HTD_8mm, 
33
+            40DP, 
34
+            XL, 
35
+            L
36
+            
37
+    tooth_count (alternate) - total belt length measured in number of teeth. If specified, then belt_length is ignored.
38
+    belt_length (alternate) - total belt length in mm, increased to next multiple of tooth pitch if necessary.
39
+    
40
+    belting_width (optional) - Override default width for the belt in mm.
41
+    
42
+    backing_thickness (optional) - Override default mm of belt backing behind tooth profile.
43
+    
44
+    max_diameter (optional) - Maximum diameter for loops and spirals. Default is 200mm.
45
+*/
46
+
47
+// retrieved from https://www.youmagine.com/designs/parametric-timing-belt-generator
48
+
49
+$fa = 2; // Try increasing this number if rendering of curves is unusably slow.
50
+
51
+// Set maximum_diameter to the shorter of your x or y axis.
52
+// It is used to limit length of straights and diameter of loops and spirals.
53
+maximum_diameter = 200;	
54
+
55
+// Tooth profile default values chosen from belts offered in catalog pages at http://sdp-si.com
56
+// Tooth profile defaults are ordered: tooth_profile, tooth_pitch, back_thickness, belt_width
57
+tooth_profile_defaults = [
58
+	[ "belt", 2, 2, 15 ],
59
+	[ "MXL", 2.032, 0.74, 6.35 ],
60
+	[ "T2.5", 2.5, 0.6, 6 ],
61
+	[ "T5", 5, 1, 10 ],
62
+	[ "T10", 10, 2, 16 ],
63
+	[ "GT2_2mm", 2, 0.76, 6 ],
64
+	[ "GT2_3mm", 3, 1.27, 9 ],
65
+	[ "GT2_5mm", 5, 1.88, 15 ],
66
+	[ "AT5", 5, 1, 10 ],
67
+	[ "HTD_3mm", 3, 1.19, 9 ],
68
+	[ "HTD_5mm", 5, 1.73, 9 ],
69
+	[ "HTD_8mm", 8, 2.64, 30 ],
70
+	[ "40DP", 2.073, 0.74, 4.7625 ],
71
+	[ "XL", 5.08, 1.03, 7.94 ],
72
+	[ "L", 9.525, 1.66, 19.05 ]
73
+];
74
+
75
+//Examples
76
+// Rendering speeds are a function of the number and complexity of teeth, and the print layout, and they increase exponentially.
77
+// belting("spiral", "GT2_2mm", belt_length = 100);
78
+// belting("loop_match","T5", tooth_count = 40 );
79
+// belting("loop","MXL", tooth_count = 298 );
80
+// belting("straight","T10", belt_length = 150, belting_width = 25 );
81
+
82
+module belting(
83
+	print_layout = undef, 
84
+	tooth_profile = undef, 
85
+	tooth_count = undef, 
86
+	belt_length = undef, 
87
+	belting_width = undef, 
88
+	backing_thickness = undef, 
89
+	max_diameter = maximum_diameter)
90
+{
91
+	// Initalization
92
+	belt_defaults = tooth_profile_defaults[search([tooth_profile], tooth_profile_defaults)[0]];
93
+	tooth_pitch = belt_defaults[1];
94
+	belt_width = belting_width == undef ? belt_defaults[3] : belting_width;
95
+	back_thickness = backing_thickness == undef ? belt_defaults[2] : backing_thickness;
96
+	tooth_cnt = tooth_count == undef ? ceil(belt_length/tooth_pitch) : tooth_count;
97
+
98
+	// Input checking.
99
+	if ( belt_defaults == undef ) {
100
+		echo(str("ERROR: Empty or invalid tooth_profile in belting module: ", tooth_profile));
101
+	}
102
+	else if( tooth_cnt == undef || tooth_cnt <= 0 ) {
103
+		echo(str("ERROR: Invalid belt_length and/or tooth_count in belting module."));
104
+	}
105
+	else if( belt_width == undef || belt_width <= 0 ) {
106
+		echo(str("ERROR: Invalid belt_width in belting module: ", belt_width));
107
+	}
108
+	else if( back_thickness == undef || back_thickness <= 0 ) {
109
+		echo(str("ERROR: Invalid back_thickness in belting module: ", back_thickness));
110
+	}
111
+	else if( max_diameter == undef || max_diameter <= 0 ) {
112
+		echo(str("ERROR: Invalid max_diameter in belting module: ", max_diameter));
113
+	}
114
+
115
+	// Inputs validated (except for layout).
116
+	else {
117
+		echo(str("Generating a ", print_layout, " of ", tooth_profile, " belt with ", tooth_cnt, " teeth, ", 
118
+			tooth_cnt*tooth_pitch, "mm long, ", belt_width, "mm wide and ", back_thickness, "mm thick." ));
119
+	
120
+		if( print_layout == "straight") {	// Straight belt
121
+			straight_belt(tooth_cnt, tooth_pitch, back_thickness, belt_width, max_diameter)
122
+				belt_tooth(tooth_profile, belt_width);
123
+            
124
+		} else if( print_layout == "loop" ||
125
+            print_layout == "loop_inner" ||
126
+            print_layout == "loop_outer" ||
127
+            print_layout == "loop_match" ||
128
+            print_layout == "loop_offset" 
129
+        ) {	// Closed loop
130
+			loop_belt(tooth_cnt, tooth_pitch, back_thickness, belt_width, max_diameter-(back_thickness*2), print_layout)
131
+				belt_tooth(tooth_profile, belt_width);
132
+            
133
+		} else if( print_layout == "spiral") {	// Spiral belt (to fit more belt on the bed than with straight)
134
+			spiral_belt(tooth_cnt, tooth_pitch, back_thickness, belt_width, max_diameter-(back_thickness*2))
135
+				belt_tooth(tooth_profile, belt_width);
136
+		} else {
137
+			echo("ERROR: Invalid print_layout in belting module. Valid layouts are <b>straight</b>, <b>loop</b>, <b>loop_inner</b>, <b>loop_outer</b>, or <b>spiral</b>.");
138
+		}
139
+	}
140
+}
141
+
142
+module straight_belt(tooth_cnt, tooth_pitch, back_thickness, belt_width, max_diameter)
143
+{
144
+	if( tooth_pitch * tooth_cnt > max_diameter ) {
145
+		echo(str("WARNING: Straight belt is ", tooth_pitch * tooth_cnt, 
146
+			"mm long. If not be printable on your printer, try spiral." ));
147
+	}
148
+
149
+	union() {
150
+		translate([-tooth_pitch/2,-back_thickness,0])cube([tooth_pitch*tooth_cnt,back_thickness,belt_width]);
151
+		for( i = [0:tooth_cnt-1]) {
152
+			translate([tooth_pitch*i,0,0]) children(0);
153
+		}
154
+	}
155
+}
156
+
157
+module loop_belt(tooth_cnt, tooth_pitch, back_thickness, belt_width, max_diameter, print_layout)
158
+{
159
+	radius = tooth_cnt * tooth_pitch / PI / 2;
160
+	
161
+	if( (radius + back_thickness) * 2 > max_diameter ) {
162
+		echo(str("WARNING: Loop belt diameter is ", (radius + back_thickness) * 2, "mm. May not be printable." ));
163
+	}
164
+
165
+    if(print_layout == "loop" || print_layout == "loop_inner") {
166
+        union() {
167
+            render(convexity = 2) difference() {
168
+                cylinder (h = belt_width, r=radius+back_thickness);
169
+                cylinder (h = belt_width, r=radius);
170
+            }
171
+            for( i = [0:tooth_cnt-1]) {
172
+                rotate(i/tooth_cnt*360)translate([0,-radius,0]) children(0);
173
+            }
174
+        }
175
+    }
176
+
177
+    if(print_layout == "loop_outer") {
178
+        union() {
179
+            render(convexity = 2) difference() {
180
+                cylinder (h = belt_width, r=radius);
181
+                cylinder (h = belt_width, r=radius-back_thickness);
182
+            }
183
+            for( i = [0:tooth_cnt-1]) {
184
+                rotate(i/tooth_cnt*360)translate([0,-radius,0]) rotate([0,0,180]) children(0);
185
+            }
186
+        }
187
+    }
188
+
189
+    if(print_layout == "loop_match") {
190
+        union() {
191
+            render(convexity = 2) difference() {
192
+                cylinder (h = belt_width, r=radius+back_thickness);
193
+                cylinder (h = belt_width, r=radius);
194
+            }
195
+            for( i = [0:tooth_cnt-1]) {
196
+                rotate(i/tooth_cnt*360)translate([0,-radius,0]) children(0);
197
+                rotate(i/tooth_cnt*360)translate([0,-radius-back_thickness,0]) rotate([0,0,180]) children(0);
198
+            }
199
+        }
200
+    }
201
+
202
+    if(print_layout == "loop_offset") {
203
+        union() {
204
+            render(convexity = 2) difference() {
205
+                cylinder (h = belt_width, r=radius+back_thickness);
206
+                cylinder (h = belt_width, r=radius);
207
+            }
208
+            for( i = [0:tooth_cnt-1]) {
209
+                rotate(i/tooth_cnt*360) translate([0,-radius,0]) children(0);
210
+                rotate((i+0.5)/tooth_cnt*360) translate([0,-radius-back_thickness,0]) rotate([0,0,180]) children(0);
211
+            }
212
+        }
213
+    }
214
+}
215
+
216
+module spiral_belt(tooth_cnt, tooth_pitch, back_thickness, belt_width, max_diameter, rot_angle = 0)
217
+{
218
+	max_radius = max_diameter/2;
219
+	radius = sqrt(pow(max_radius,2) - (tooth_cnt * tooth_pitch * 2)); 
220
+	next_radius = sqrt(pow(max_radius,2)-((tooth_cnt - 1) * tooth_pitch * 2));
221
+	rad_diff = next_radius - radius;
222
+	angle = atan(tooth_pitch/radius);
223
+
224
+	if(tooth_cnt > 0)
225
+	{
226
+		union() {
227
+			spiral_belt((tooth_cnt-1), tooth_pitch, back_thickness, belt_width, max_diameter, angle+rot_angle) children(0);
228
+			rotate(rot_angle) translate([0,-radius,0]) {
229
+				translate([0,-rad_diff/2,0]) rotate(-atan(rad_diff/tooth_pitch)) children(0);
230
+				translate([-tooth_pitch/2,0,0]) rotate(-atan(rad_diff/tooth_pitch)) linear_extrude(belt_width)
231
+					polygon([[-rad_diff,0],[-(rad_diff*back_thickness/2),-back_thickness],[tooth_pitch+(rad_diff*back_thickness/2),-back_thickness],[tooth_pitch,0]]);
232
+			}
233
+		}
234
+	}
235
+}
236
+
237
+module belt_tooth(tooth_profile = undef, belt_width = undef)
238
+{
239
+	if( tooth_profile == "T2.5" ) {T2_5(width = belt_width);}
240
+	else if( tooth_profile == "T5" ) {T5(width = belt_width);}
241
+	else if( tooth_profile == "T10" ) {T10(width = belt_width);}
242
+	else if( tooth_profile == "MXL" ) {MXL(width = belt_width);}
243
+	else if( tooth_profile == "GT2_2mm" ) {GT2_2mm(width = belt_width);}
244
+	else if( tooth_profile == "GT2_3mm" ) {GT2_3mm(width = belt_width);}
245
+	else if( tooth_profile == "GT2_5mm" ) {GT2_5mm(width = belt_width);}
246
+	else if( tooth_profile == "AT5" ) {AT5(width = belt_width);}
247
+	else if( tooth_profile == "HTD_3mm" ) {HTD_3mm(width = belt_width);}
248
+	else if( tooth_profile == "HTD_5mm" ) {HTD_5mm(width = belt_width);}
249
+	else if( tooth_profile == "HTD_8mm" ) {HTD_8mm(width = belt_width);}
250
+	else if( tooth_profile == "40DP" ) {40DP(width = belt_width);}
251
+	else if( tooth_profile == "XL" ) {XL(width = belt_width);}
252
+	else if( tooth_profile == "L" ) {L(width = belt_width);}
253
+	else if( tooth_profile == "belt" ) {}
254
+	else echo("INTERNAL ERROR: Missing tooth_profile module detected by belt_tooth module.");
255
+}
256
+
257
+// Tooth forms taken from http://www.thingiverse.com/thing:16627
258
+// Much credit to Droftarts for deriving the tooth profile polygons.
259
+
260
+module T2_5(width = 2)
261
+{
262
+	linear_extrude(height=width) polygon([[-0.839258,-0.5],[-0.839258,0],[-0.770246,0.021652],[-0.726369,0.079022],[-0.529167,0.620889],[-0.485025,0.67826],[-0.416278,0.699911],[0.416278,0.699911],[0.484849,0.67826],[0.528814,0.620889],[0.726369,0.079022],[0.770114,0.021652],[0.839258,0],[0.839258,-0.5]]);
263
+}
264
+
265
+module T5(width = 2)
266
+{
267
+	linear_extrude(height=width) polygon([[-1.632126,-0.5],[-1.632126,0],[-1.568549,0.004939],[-1.507539,0.019367],[-1.450023,0.042686],[-1.396912,0.074224],[-1.349125,0.113379],[-1.307581,0.159508],[-1.273186,0.211991],[-1.246868,0.270192],[-1.009802,0.920362],[-0.983414,0.978433],[-0.949018,1.030788],[-0.907524,1.076798],[-0.859829,1.115847],[-0.80682,1.147314],[-0.749402,1.170562],[-0.688471,1.184956],[-0.624921,1.189895],[0.624971,1.189895],[0.688622,1.184956],[0.749607,1.170562],[0.807043,1.147314],[0.860055,1.115847],[0.907754,1.076798],[0.949269,1.030788],[0.9837,0.978433],[1.010193,0.920362],[1.246907,0.270192],[1.273295,0.211991],[1.307726,0.159508],[1.349276,0.113379],[1.397039,0.074224],[1.450111,0.042686],[1.507589,0.019367],[1.568563,0.004939],[1.632126,0],[1.632126,-0.5]]);
268
+}
269
+
270
+module T10(width = 2)
271
+{
272
+	linear_extrude(height=width) polygon([[-3.06511,-1],[-3.06511,0],[-2.971998,0.007239],[-2.882718,0.028344],[-2.79859,0.062396],[-2.720931,0.108479],[-2.651061,0.165675],[-2.590298,0.233065],[-2.539962,0.309732],[-2.501371,0.394759],[-1.879071,2.105025],[-1.840363,2.190052],[-1.789939,2.266719],[-1.729114,2.334109],[-1.659202,2.391304],[-1.581518,2.437387],[-1.497376,2.47144],[-1.408092,2.492545],[-1.314979,2.499784],[1.314979,2.499784],[1.408091,2.492545],[1.497371,2.47144],[1.581499,2.437387],[1.659158,2.391304],[1.729028,2.334109],[1.789791,2.266719],[1.840127,2.190052],[1.878718,2.105025],[2.501018,0.394759],[2.539726,0.309732],[2.59015,0.233065],[2.650975,0.165675],[2.720887,0.108479],[2.798571,0.062396],[2.882713,0.028344],[2.971997,0.007239],[3.06511,0],[3.06511,-1]]);
273
+}
274
+
275
+module MXL(width = 2)
276
+{
277
+	linear_extrude(height=width) polygon([[-0.660421,-0.5],[-0.660421,0],[-0.621898,0.006033],[-0.587714,0.023037],[-0.560056,0.049424],[-0.541182,0.083609],[-0.417357,0.424392],[-0.398413,0.458752],[-0.370649,0.48514],[-0.336324,0.502074],[-0.297744,0.508035],[0.297744,0.508035],[0.336268,0.502074],[0.370452,0.48514],[0.39811,0.458752],[0.416983,0.424392],[0.540808,0.083609],[0.559752,0.049424],[0.587516,0.023037],[0.621841,0.006033],[0.660421,0],[0.660421,-0.5]]);
278
+}
279
+
280
+module GT2_2mm(width = 2)
281
+{
282
+	linear_extrude(height=width) polygon([[0.747183,-0.5],[0.747183,0],[0.647876,0.037218],[0.598311,0.130528],[0.578556,0.238423],[0.547158,0.343077],[0.504649,0.443762],[0.451556,0.53975],[0.358229,0.636924],[0.2484,0.707276],[0.127259,0.750044],[0,0.76447],[-0.127259,0.750044],[-0.2484,0.707276],[-0.358229,0.636924],[-0.451556,0.53975],[-0.504797,0.443762],[-0.547291,0.343077],[-0.578605,0.238423],[-0.598311,0.130528],[-0.648009,0.037218],[-0.747183,0],[-0.747183,-0.5]]);
283
+}
284
+
285
+module GT2_3mm(width = 2)
286
+{
287
+	linear_extrude(height=width) polygon([[-1.155171,-0.5],[-1.155171,0],[-1.065317,0.016448],[-0.989057,0.062001],[-0.93297,0.130969],[-0.90364,0.217664],[-0.863705,0.408181],[-0.800056,0.591388],[-0.713587,0.765004],[-0.60519,0.926747],[-0.469751,1.032548],[-0.320719,1.108119],[-0.162625,1.153462],[0,1.168577],[0.162625,1.153462],[0.320719,1.108119],[0.469751,1.032548],[0.60519,0.926747],[0.713587,0.765004],[0.800056,0.591388],[0.863705,0.408181],[0.90364,0.217664],[0.932921,0.130969],[0.988924,0.062001],[1.065168,0.016448],[1.155171,0],[1.155171,-0.5]]);
288
+}
289
+
290
+module GT2_5mm(width = 2)
291
+{
292
+	linear_extrude(height=width) polygon([[-1.975908,-0.75],[-1.975908,0],[-1.797959,0.03212],[-1.646634,0.121224],[-1.534534,0.256431],[-1.474258,0.426861],[-1.446911,0.570808],[-1.411774,0.712722],[-1.368964,0.852287],[-1.318597,0.989189],[-1.260788,1.123115],[-1.195654,1.25375],[-1.12331,1.380781],[-1.043869,1.503892],[-0.935264,1.612278],[-0.817959,1.706414],[-0.693181,1.786237],[-0.562151,1.851687],[-0.426095,1.9027],[-0.286235,1.939214],[-0.143795,1.961168],[0,1.9685],[0.143796,1.961168],[0.286235,1.939214],[0.426095,1.9027],[0.562151,1.851687],[0.693181,1.786237],[0.817959,1.706414],[0.935263,1.612278],[1.043869,1.503892],[1.123207,1.380781],[1.195509,1.25375],[1.26065,1.123115],[1.318507,0.989189],[1.368956,0.852287],[1.411872,0.712722],[1.447132,0.570808],[1.474611,0.426861],[1.534583,0.256431],[1.646678,0.121223],[1.798064,0.03212],[1.975908,0],[1.975908,-0.75]]);
293
+}
294
+
295
+
296
+
297
+module AT5(width = 2)
298
+{
299
+	linear_extrude(height=width) polygon([[-2.134129,-0.75],[-2.134129,0],[-2.058023,0.005488],[-1.984595,0.021547],[-1.914806,0.047569],[-1.849614,0.082947],[-1.789978,0.127073],[-1.736857,0.179338],[-1.691211,0.239136],[-1.653999,0.305859],[-1.349199,0.959203],[-1.286933,1.054635],[-1.201914,1.127346],[-1.099961,1.173664],[-0.986896,1.18992],[0.986543,1.18992],[1.099614,1.173664],[1.201605,1.127346],[1.286729,1.054635],[1.349199,0.959203],[1.653646,0.305859],[1.690859,0.239136],[1.73651,0.179338],[1.789644,0.127073],[1.849305,0.082947],[1.914539,0.047569],[1.984392,0.021547],[2.057906,0.005488],[2.134129,0],[2.134129,-0.75]]);
300
+	}
301
+
302
+module HTD_3mm(width = 2)
303
+{
304
+	linear_extrude(height=width) polygon([[-1.135062,-0.5],[-1.135062,0],[-1.048323,0.015484],[-0.974284,0.058517],[-0.919162,0.123974],[-0.889176,0.206728],[-0.81721,0.579614],[-0.800806,0.653232],[-0.778384,0.72416],[-0.750244,0.792137],[-0.716685,0.856903],[-0.678005,0.918199],[-0.634505,0.975764],[-0.586483,1.029338],[-0.534238,1.078662],[-0.47807,1.123476],[-0.418278,1.16352],[-0.355162,1.198533],[-0.289019,1.228257],[-0.22015,1.25243],[-0.148854,1.270793],[-0.07543,1.283087],[-0.000176,1.28905],[0.075081,1.283145],[0.148515,1.270895],[0.219827,1.252561],[0.288716,1.228406],[0.354879,1.19869],[0.418018,1.163675],[0.477831,1.123623],[0.534017,1.078795],[0.586276,1.029452],[0.634307,0.975857],[0.677809,0.91827],[0.716481,0.856953],[0.750022,0.792167],[0.778133,0.724174],[0.800511,0.653236],[0.816857,0.579614],[0.888471,0.206728],[0.919014,0.123974],[0.974328,0.058517],[1.048362,0.015484],[1.135062,0],[1.135062,-0.5]]);
305
+}
306
+
307
+module HTD_5mm(width = 2)
308
+{
309
+	linear_extrude(height=width) polygon([[-1.89036,-0.75],[-1.89036,0],[-1.741168,0.02669],[-1.61387,0.100806],[-1.518984,0.21342],[-1.467026,0.3556],[-1.427162,0.960967],[-1.398568,1.089602],[-1.359437,1.213531],[-1.310296,1.332296],[-1.251672,1.445441],[-1.184092,1.552509],[-1.108081,1.653042],[-1.024167,1.746585],[-0.932877,1.832681],[-0.834736,1.910872],[-0.730271,1.980701],[-0.62001,2.041713],[-0.504478,2.09345],[-0.384202,2.135455],[-0.259708,2.167271],[-0.131524,2.188443],[-0.000176,2.198511],[0.131296,2.188504],[0.259588,2.167387],[0.384174,2.135616],[0.504527,2.093648],[0.620123,2.04194],[0.730433,1.980949],[0.834934,1.911132],[0.933097,1.832945],[1.024398,1.746846],[1.108311,1.653291],[1.184308,1.552736],[1.251865,1.445639],[1.310455,1.332457],[1.359552,1.213647],[1.39863,1.089664],[1.427162,0.960967],[1.467026,0.3556],[1.518984,0.21342],[1.61387,0.100806],[1.741168,0.02669],[1.89036,0],[1.89036,-0.75]]);
310
+}
311
+
312
+module HTD_8mm(width = 2)
313
+{
314
+	linear_extrude(height=width) polygon([[-3.301471,-1],[-3.301471,0],[-3.16611,0.012093],[-3.038062,0.047068],[-2.919646,0.10297],[-2.813182,0.177844],[-2.720989,0.269734],[-2.645387,0.376684],[-2.588694,0.496739],[-2.553229,0.627944],[-2.460801,1.470025],[-2.411413,1.691917],[-2.343887,1.905691],[-2.259126,2.110563],[-2.158035,2.30575],[-2.041518,2.490467],[-1.910478,2.66393],[-1.76582,2.825356],[-1.608446,2.973961],[-1.439261,3.10896],[-1.259169,3.22957],[-1.069074,3.335006],[-0.869878,3.424485],[-0.662487,3.497224],[-0.447804,3.552437],[-0.226732,3.589341],[-0.000176,3.607153],[0.226511,3.589461],[0.447712,3.552654],[0.66252,3.497516],[0.870027,3.424833],[1.069329,3.33539],[1.259517,3.229973],[1.439687,3.109367],[1.608931,2.974358],[1.766344,2.825731],[1.911018,2.664271],[2.042047,2.490765],[2.158526,2.305998],[2.259547,2.110755],[2.344204,1.905821],[2.411591,1.691983],[2.460801,1.470025],[2.553229,0.627944],[2.588592,0.496739],[2.645238,0.376684],[2.720834,0.269734],[2.81305,0.177844],[2.919553,0.10297],[3.038012,0.047068],[3.166095,0.012093],[3.301471,0],[3.301471,-1]]);
315
+}
316
+
317
+module 40DP(width = 2)
318
+{
319
+	linear_extrude(height=width) polygon([[-0.612775,-0.5],[-0.612775,0],[-0.574719,0.010187],[-0.546453,0.0381],[-0.355953,0.3683],[-0.327604,0.405408],[-0.291086,0.433388],[-0.248548,0.451049],[-0.202142,0.4572],[0.202494,0.4572],[0.248653,0.451049],[0.291042,0.433388],[0.327609,0.405408],[0.356306,0.3683],[0.546806,0.0381],[0.574499,0.010187],[0.612775,0],[0.612775,-0.5]]);
320
+}
321
+
322
+module XL(width = 2)
323
+{
324
+	linear_extrude(height=width) polygon([[-1.525411,-1],[-1.525411,0],[-1.41777,0.015495],[-1.320712,0.059664],[-1.239661,0.129034],[-1.180042,0.220133],[-0.793044,1.050219],[-0.733574,1.141021],[-0.652507,1.210425],[-0.555366,1.254759],[-0.447675,1.270353],[0.447675,1.270353],[0.555366,1.254759],[0.652507,1.210425],[0.733574,1.141021],[0.793044,1.050219],[1.180042,0.220133],[1.239711,0.129034],[1.320844,0.059664],[1.417919,0.015495],[1.525411,0],[1.525411,-1]]);
325
+}
326
+
327
+module L(width = 2)
328
+{
329
+	linear_extrude(height=width) polygon([[-2.6797,-1],[-2.6797,0],[-2.600907,0.006138],[-2.525342,0.024024],[-2.45412,0.052881],[-2.388351,0.091909],[-2.329145,0.140328],[-2.277614,0.197358],[-2.234875,0.262205],[-2.202032,0.334091],[-1.75224,1.57093],[-1.719538,1.642815],[-1.676883,1.707663],[-1.62542,1.764693],[-1.566256,1.813112],[-1.500512,1.85214],[-1.4293,1.880997],[-1.353742,1.898883],[-1.274949,1.905021],[1.275281,1.905021],[1.354056,1.898883],[1.429576,1.880997],[1.500731,1.85214],[1.566411,1.813112],[1.625508,1.764693],[1.676919,1.707663],[1.719531,1.642815],[1.752233,1.57093],[2.20273,0.334091],[2.235433,0.262205],[2.278045,0.197358],[2.329455,0.140328],[2.388553,0.091909],[2.454233,0.052881],[2.525384,0.024024],[2.600904,0.006138],[2.6797,0],[2.6797,-1]]);
330
+}

+ 288
- 0
lib/Pulley_T-MXL-XL-HTD-GT2_N-tooth.scad View File

@@ -0,0 +1,288 @@
1
+// Parametric Pulley with multiple belt profiles
2
+// by droftarts January 2012
3
+
4
+// Based on pulleys by:
5
+// http://www.thingiverse.com/thing:11256 by me!
6
+// https://github.com/prusajr/PrusaMendel by Josef Prusa
7
+// http://www.thingiverse.com/thing:3104 by GilesBathgate
8
+// http://www.thingiverse.com/thing:2079 by nophead
9
+
10
+// dxf tooth data from http://oem.cadregister.com/asp/PPOW_Entry.asp?company=915217&elementID=07807803/METRIC/URETH/WV0025/F
11
+// pulley diameter checked and modelled from data at http://www.sdp-si.com/D265/HTML/D265T016.html
12
+
13
+/**
14
+ * @name Pulley
15
+ * @category Printed
16
+ * @using 1 x m3 nut, normal or nyloc
17
+ * @using 1 x m3x10 set screw or 1 x m3x8 grub screw
18
+ */
19
+
20
+// retrieved from https://www.thingiverse.com/thing:16627
21
+
22
+// tuneable constants
23
+
24
+teeth = 20;			// Number of teeth, standard Mendel T5 belt = 8, gives Outside Diameter of 11.88mm
25
+profile = 12;		// 1=MXL 2=40DP 3=XL 4=H 5=T2.5 6=T5 7=T10 8=AT5 9=HTD_3mm 10=HTD_5mm 11=HTD_8mm 12=GT2_2mm 13=GT2_3mm 14=GT2_5mm
26
+
27
+motor_shaft = 5.2;	// NEMA17 motor shaft exact diameter = 5
28
+m3_dia = 3.2;		// 3mm hole diameter
29
+m3_nut_hex = 1;		// 1 for hex, 0 for square nut
30
+m3_nut_flats = 5.7;	// normal M3 hex nut exact width = 5.5
31
+m3_nut_depth = 2.7;	// normal M3 hex nut exact depth = 2.4, nyloc = 4
32
+
33
+retainer = 1;		// Belt retainer above teeth, 0 = No, 1 = Yes
34
+retainer_ht = 1.5;	// height of retainer flange over pulley, standard = 1.5
35
+idler = 1;			// Belt retainer below teeth, 0 = No, 1 = Yes
36
+idler_ht = 1.5;		// height of idler flange over pulley, standard = 1.5
37
+
38
+pulley_t_ht = 7.3;	// length of toothed part of pulley, standard = 12
39
+pulley_b_ht = 7;		// pulley base height, standard = 8. Set to same as idler_ht if you want an idler but no pulley.
40
+pulley_b_dia = 16;	// pulley base diameter, standard = 20
41
+no_of_nuts = 2;		// number of captive nuts required, standard = 1
42
+nut_angle = 90;		// angle between nuts, standard = 90
43
+nut_shaft_distance = 1.2;	// distance between inner face of nut and shaft, can be negative.
44
+
45
+
46
+//	********************************
47
+//	** Scaling tooth for good fit **
48
+//	********************************
49
+/*	To improve fit of belt to pulley, set the following constant. Decrease or increase by 0.1mm at a time. We are modelling the *BELT* tooth here, not the tooth on the pulley. Increasing the number will *decrease* the pulley tooth size. Increasing the tooth width will also scale proportionately the tooth depth, to maintain the shape of the tooth, and increase how far into the pulley the tooth is indented. Can be negative */
50
+
51
+additional_tooth_width = 0.2; //mm
52
+
53
+//	If you need more tooth depth than this provides, adjust the following constant. However, this will cause the shape of the tooth to change.
54
+
55
+additional_tooth_depth = 0; //mm
56
+
57
+// calculated constants
58
+
59
+nut_elevation = pulley_b_ht/2;
60
+m3_nut_points = 2*((m3_nut_flats/2)/cos(30)); // This is needed for the nut trap
61
+
62
+// The following set the pulley diameter for a given number of teeth
63
+
64
+MXL_pulley_dia = tooth_spacing (2.032,0.254);
65
+40DP_pulley_dia = tooth_spacing (2.07264,0.1778);
66
+XL_pulley_dia = tooth_spacing (5.08,0.254);
67
+H_pulley_dia = tooth_spacing (9.525,0.381);
68
+T2_5_pulley_dia = tooth_spaceing_curvefit (0.7467,0.796,1.026);
69
+T5_pulley_dia = tooth_spaceing_curvefit (0.6523,1.591,1.064);
70
+T10_pulley_dia = tooth_spacing (10,0.93);
71
+AT5_pulley_dia = tooth_spaceing_curvefit (0.6523,1.591,1.064);
72
+HTD_3mm_pulley_dia = tooth_spacing (3,0.381);
73
+HTD_5mm_pulley_dia = tooth_spacing (5,0.5715);
74
+HTD_8mm_pulley_dia = tooth_spacing (8,0.6858);
75
+GT2_2mm_pulley_dia = tooth_spacing (2,0.254);
76
+GT2_3mm_pulley_dia = tooth_spacing (3,0.381);
77
+GT2_5mm_pulley_dia = tooth_spacing (5,0.5715);
78
+
79
+// The following calls the pulley creation part, and passes the pulley diameter and tooth width to that module
80
+
81
+module gt2_pulley() {
82
+if ( profile == 1 ) { pulley ( "MXL" , MXL_pulley_dia , 0.508 , 1.321 ); }
83
+if ( profile == 2 ) { pulley ( "40 D.P." , 40DP_pulley_dia , 0.457 , 1.226 ); }
84
+if ( profile == 3 ) { pulley ( "XL" , XL_pulley_dia , 1.27, 3.051 ); }
85
+if ( profile == 4 ) { pulley ( "H" , H_pulley_dia ,1.905 , 5.359 ); }
86
+if ( profile == 5 ) { pulley ( "T2.5" , T2_5_pulley_dia , 0.7 , 1.678 ); }
87
+if ( profile == 6 ) { pulley ( "T5" , T5_pulley_dia , 1.19 , 3.264 ); }
88
+if ( profile == 7 ) { pulley ( "T10" , T10_pulley_dia , 2.5 , 6.13 ); }
89
+if ( profile == 8 ) { pulley ( "AT5" , AT5_pulley_dia , 1.19 , 4.268 ); }
90
+if ( profile == 9 ) { pulley ( "HTD 3mm" , HTD_3mm_pulley_dia , 1.289 , 2.27 ); }
91
+if ( profile == 10 ) { pulley ( "HTD 5mm" , HTD_5mm_pulley_dia , 2.199 , 3.781 ); }
92
+if ( profile == 11 ) { pulley ( "HTD 8mm" , HTD_8mm_pulley_dia , 3.607 , 6.603 ); }
93
+if ( profile == 12 ) { pulley ( "GT2 2mm" , GT2_2mm_pulley_dia , 0.764 , 1.494 ); }
94
+if ( profile == 13 ) { pulley ( "GT2 3mm" , GT2_3mm_pulley_dia , 1.169 , 2.31 ); }
95
+if ( profile == 14 ) { pulley ( "GT2 5mm" , GT2_5mm_pulley_dia , 1.969 , 3.952 ); }
96
+}
97
+
98
+//gt2_pulley();
99
+
100
+// Functions
101
+
102
+function tooth_spaceing_curvefit (b,c,d)
103
+	= ((c * pow(teeth,d)) / (b + pow(teeth,d))) * teeth ;
104
+
105
+function tooth_spacing(tooth_pitch,pitch_line_offset)
106
+	= (2*((teeth*tooth_pitch)/(3.14159265*2)-pitch_line_offset)) ;
107
+
108
+// Main Module
109
+
110
+module pulley( belt_type , pulley_OD , tooth_depth , tooth_width )
111
+	{
112
+	echo (str("Belt type = ",belt_type,"; Number of teeth = ",teeth,"; Pulley Outside Diameter = ",pulley_OD,"mm "));
113
+	tooth_distance_from_centre = sqrt( pow(pulley_OD/2,2) - pow((tooth_width+additional_tooth_width)/2,2));
114
+	tooth_width_scale = (tooth_width + additional_tooth_width ) / tooth_width;
115
+	tooth_depth_scale = ((tooth_depth + additional_tooth_depth ) / tooth_depth) ;
116
+
117
+
118
+//	************************************************************************
119
+//	*** uncomment the following line if pulley is wider than puller base ***
120
+//	************************************************************************
121
+
122
+//	translate ([0,0, pulley_b_ht + pulley_t_ht + retainer_ht ]) rotate ([0,180,0])
123
+
124
+	difference()
125
+	 {	 
126
+		union()
127
+		{
128
+			//base
129
+	
130
+			if ( pulley_b_ht < 2 ) { echo ("CAN'T DRAW PULLEY BASE, HEIGHT LESS THAN 2!!!"); } else {
131
+				rotate_extrude($fn=pulley_b_dia*2)
132
+				{
133
+						square([pulley_b_dia/2-1,pulley_b_ht]);
134
+						square([pulley_b_dia/2,pulley_b_ht-1]);
135
+						translate([pulley_b_dia/2-1,pulley_b_ht-1]) circle(1);
136
+				}
137
+			}
138
+	
139
+		difference()
140
+			{
141
+			//shaft - diameter is outside diameter of pulley
142
+			
143
+			translate([0,0,pulley_b_ht]) 
144
+			rotate ([0,0,360/(teeth*4)]) 
145
+			cylinder(r=pulley_OD/2,h=pulley_t_ht, $fn=teeth*4);
146
+	
147
+			//teeth - cut out of shaft
148
+		
149
+			for(i=[1:teeth]) 
150
+			rotate([0,0,i*(360/teeth)])
151
+			translate([0,-tooth_distance_from_centre,pulley_b_ht -1]) 
152
+			scale ([ tooth_width_scale , tooth_depth_scale , 1 ]) 
153
+			{
154
+			if ( profile == 1 ) { MXL();}
155
+			if ( profile == 2 ) { 40DP();}
156
+			if ( profile == 3 ) { XL();}
157
+			if ( profile == 4 ) { H();}
158
+			if ( profile == 5 ) { T2_5();}
159
+			if ( profile == 6 ) { T5();}
160
+			if ( profile == 7 ) { T10();}
161
+			if ( profile == 8 ) { AT5();}
162
+			if ( profile == 9 ) { HTD_3mm();}
163
+			if ( profile == 10 ) { HTD_5mm();}
164
+			if ( profile == 11 ) { HTD_8mm();}
165
+			if ( profile == 12 ) { GT2_2mm();}
166
+			if ( profile == 13 ) { GT2_3mm();}
167
+			if ( profile == 14 ) { GT2_5mm();}
168
+			}
169
+
170
+			}
171
+			
172
+		//belt retainer / idler
173
+		if ( retainer > 0 ) {translate ([0,0, pulley_b_ht + pulley_t_ht ]) 
174
+		rotate_extrude($fn=teeth*4)  
175
+		polygon([[0,0],[pulley_OD/2,0],[pulley_OD/2 + retainer_ht , retainer_ht],[0 , retainer_ht],[0,0]]);}
176
+		
177
+		if ( idler > 0 ) {translate ([0,0, pulley_b_ht - idler_ht ]) 
178
+		rotate_extrude($fn=teeth*4)  
179
+		polygon([[0,0],[pulley_OD/2 + idler_ht,0],[pulley_OD/2 , idler_ht],[0 , idler_ht],[0,0]]);}
180
+	
181
+		}
182
+	   
183
+		//hole for motor shaft
184
+		translate([0,0,-1])cylinder(r=motor_shaft/2,h=pulley_b_ht + pulley_t_ht + retainer_ht + 2,$fn=motor_shaft*4);
185
+				
186
+		//captive nut and grub screw holes
187
+	
188
+		if ( pulley_b_ht < m3_nut_flats ) { echo ("CAN'T DRAW CAPTIVE NUTS, HEIGHT LESS THAN NUT DIAMETER!!!"); } else {
189
+		if ( (pulley_b_dia - motor_shaft)/2 < m3_nut_depth + 3 ) { echo ("CAN'T DRAW CAPTIVE NUTS, DIAMETER TOO SMALL FOR NUT DEPTH!!!"); } else {
190
+	
191
+			for(j=[1:no_of_nuts]) rotate([0,0,j*nut_angle])
192
+			translate([0,0,nut_elevation])rotate([90,0,0])
193
+	
194
+			union()
195
+			{
196
+				//entrance
197
+				translate([0,-pulley_b_ht/4-0.5,motor_shaft/2+m3_nut_depth/2+nut_shaft_distance]) cube([m3_nut_flats,pulley_b_ht/2+1,m3_nut_depth],center=true);
198
+	
199
+				//nut
200
+				if ( m3_nut_hex > 0 )
201
+					{
202
+						// hex nut
203
+						translate([0,0.25,motor_shaft/2+m3_nut_depth/2+nut_shaft_distance]) rotate([0,0,30]) cylinder(r=m3_nut_points/2,h=m3_nut_depth,center=true,$fn=6);
204
+					} else {
205
+						// square nut
206
+						translate([0,0.25,motor_shaft/2+m3_nut_depth/2+nut_shaft_distance]) cube([m3_nut_flats,m3_nut_flats,m3_nut_depth],center=true);
207
+					}
208
+	
209
+				//grub screw hole
210
+				rotate([0,0,22.5])cylinder(r=m3_dia/2,h=pulley_b_dia/2+1,$fn=8);
211
+			}
212
+		}}
213
+	 }
214
+	   
215
+	}
216
+
217
+
218
+// Tooth profile modules
219
+
220
+module MXL()
221
+	{
222
+	linear_extrude(height=pulley_t_ht+2) polygon([[-0.660421,-0.5],[-0.660421,0],[-0.621898,0.006033],[-0.587714,0.023037],[-0.560056,0.049424],[-0.541182,0.083609],[-0.417357,0.424392],[-0.398413,0.458752],[-0.370649,0.48514],[-0.336324,0.502074],[-0.297744,0.508035],[0.297744,0.508035],[0.336268,0.502074],[0.370452,0.48514],[0.39811,0.458752],[0.416983,0.424392],[0.540808,0.083609],[0.559752,0.049424],[0.587516,0.023037],[0.621841,0.006033],[0.660421,0],[0.660421,-0.5]]);
223
+	}
224
+
225
+module 40DP()
226
+	{
227
+	linear_extrude(height=pulley_t_ht+2) polygon([[-0.612775,-0.5],[-0.612775,0],[-0.574719,0.010187],[-0.546453,0.0381],[-0.355953,0.3683],[-0.327604,0.405408],[-0.291086,0.433388],[-0.248548,0.451049],[-0.202142,0.4572],[0.202494,0.4572],[0.248653,0.451049],[0.291042,0.433388],[0.327609,0.405408],[0.356306,0.3683],[0.546806,0.0381],[0.574499,0.010187],[0.612775,0],[0.612775,-0.5]]);
228
+	}
229
+
230
+module XL()
231
+	{
232
+	linear_extrude(height=pulley_t_ht+2) polygon([[-1.525411,-1],[-1.525411,0],[-1.41777,0.015495],[-1.320712,0.059664],[-1.239661,0.129034],[-1.180042,0.220133],[-0.793044,1.050219],[-0.733574,1.141021],[-0.652507,1.210425],[-0.555366,1.254759],[-0.447675,1.270353],[0.447675,1.270353],[0.555366,1.254759],[0.652507,1.210425],[0.733574,1.141021],[0.793044,1.050219],[1.180042,0.220133],[1.239711,0.129034],[1.320844,0.059664],[1.417919,0.015495],[1.525411,0],[1.525411,-1]]);
233
+	}
234
+
235
+module H()
236
+	{
237
+	linear_extrude(height=pulley_t_ht+2) polygon([[-2.6797,-1],[-2.6797,0],[-2.600907,0.006138],[-2.525342,0.024024],[-2.45412,0.052881],[-2.388351,0.091909],[-2.329145,0.140328],[-2.277614,0.197358],[-2.234875,0.262205],[-2.202032,0.334091],[-1.75224,1.57093],[-1.719538,1.642815],[-1.676883,1.707663],[-1.62542,1.764693],[-1.566256,1.813112],[-1.500512,1.85214],[-1.4293,1.880997],[-1.353742,1.898883],[-1.274949,1.905021],[1.275281,1.905021],[1.354056,1.898883],[1.429576,1.880997],[1.500731,1.85214],[1.566411,1.813112],[1.625508,1.764693],[1.676919,1.707663],[1.719531,1.642815],[1.752233,1.57093],[2.20273,0.334091],[2.235433,0.262205],[2.278045,0.197358],[2.329455,0.140328],[2.388553,0.091909],[2.454233,0.052881],[2.525384,0.024024],[2.600904,0.006138],[2.6797,0],[2.6797,-1]]);
238
+	}
239
+
240
+module T2_5()
241
+	{
242
+	linear_extrude(height=pulley_t_ht+2) polygon([[-0.839258,-0.5],[-0.839258,0],[-0.770246,0.021652],[-0.726369,0.079022],[-0.529167,0.620889],[-0.485025,0.67826],[-0.416278,0.699911],[0.416278,0.699911],[0.484849,0.67826],[0.528814,0.620889],[0.726369,0.079022],[0.770114,0.021652],[0.839258,0],[0.839258,-0.5]]);
243
+	}
244
+
245
+module T5()
246
+	{
247
+	linear_extrude(height=pulley_t_ht+2) polygon([[-1.632126,-0.5],[-1.632126,0],[-1.568549,0.004939],[-1.507539,0.019367],[-1.450023,0.042686],[-1.396912,0.074224],[-1.349125,0.113379],[-1.307581,0.159508],[-1.273186,0.211991],[-1.246868,0.270192],[-1.009802,0.920362],[-0.983414,0.978433],[-0.949018,1.030788],[-0.907524,1.076798],[-0.859829,1.115847],[-0.80682,1.147314],[-0.749402,1.170562],[-0.688471,1.184956],[-0.624921,1.189895],[0.624971,1.189895],[0.688622,1.184956],[0.749607,1.170562],[0.807043,1.147314],[0.860055,1.115847],[0.907754,1.076798],[0.949269,1.030788],[0.9837,0.978433],[1.010193,0.920362],[1.246907,0.270192],[1.273295,0.211991],[1.307726,0.159508],[1.349276,0.113379],[1.397039,0.074224],[1.450111,0.042686],[1.507589,0.019367],[1.568563,0.004939],[1.632126,0],[1.632126,-0.5]]);
248
+	}
249
+
250
+module T10()
251
+	{
252
+	linear_extrude(height=pulley_t_ht+2) polygon([[-3.06511,-1],[-3.06511,0],[-2.971998,0.007239],[-2.882718,0.028344],[-2.79859,0.062396],[-2.720931,0.108479],[-2.651061,0.165675],[-2.590298,0.233065],[-2.539962,0.309732],[-2.501371,0.394759],[-1.879071,2.105025],[-1.840363,2.190052],[-1.789939,2.266719],[-1.729114,2.334109],[-1.659202,2.391304],[-1.581518,2.437387],[-1.497376,2.47144],[-1.408092,2.492545],[-1.314979,2.499784],[1.314979,2.499784],[1.408091,2.492545],[1.497371,2.47144],[1.581499,2.437387],[1.659158,2.391304],[1.729028,2.334109],[1.789791,2.266719],[1.840127,2.190052],[1.878718,2.105025],[2.501018,0.394759],[2.539726,0.309732],[2.59015,0.233065],[2.650975,0.165675],[2.720887,0.108479],[2.798571,0.062396],[2.882713,0.028344],[2.971997,0.007239],[3.06511,0],[3.06511,-1]]);
253
+	}
254
+
255
+module AT5()
256
+	{
257
+	linear_extrude(height=pulley_t_ht+2) polygon([[-2.134129,-0.75],[-2.134129,0],[-2.058023,0.005488],[-1.984595,0.021547],[-1.914806,0.047569],[-1.849614,0.082947],[-1.789978,0.127073],[-1.736857,0.179338],[-1.691211,0.239136],[-1.653999,0.305859],[-1.349199,0.959203],[-1.286933,1.054635],[-1.201914,1.127346],[-1.099961,1.173664],[-0.986896,1.18992],[0.986543,1.18992],[1.099614,1.173664],[1.201605,1.127346],[1.286729,1.054635],[1.349199,0.959203],[1.653646,0.305859],[1.690859,0.239136],[1.73651,0.179338],[1.789644,0.127073],[1.849305,0.082947],[1.914539,0.047569],[1.984392,0.021547],[2.057906,0.005488],[2.134129,0],[2.134129,-0.75]]);
258
+	}
259
+
260
+module HTD_3mm()
261
+	{
262
+	linear_extrude(height=pulley_t_ht+2) polygon([[-1.135062,-0.5],[-1.135062,0],[-1.048323,0.015484],[-0.974284,0.058517],[-0.919162,0.123974],[-0.889176,0.206728],[-0.81721,0.579614],[-0.800806,0.653232],[-0.778384,0.72416],[-0.750244,0.792137],[-0.716685,0.856903],[-0.678005,0.918199],[-0.634505,0.975764],[-0.586483,1.029338],[-0.534238,1.078662],[-0.47807,1.123476],[-0.418278,1.16352],[-0.355162,1.198533],[-0.289019,1.228257],[-0.22015,1.25243],[-0.148854,1.270793],[-0.07543,1.283087],[-0.000176,1.28905],[0.075081,1.283145],[0.148515,1.270895],[0.219827,1.252561],[0.288716,1.228406],[0.354879,1.19869],[0.418018,1.163675],[0.477831,1.123623],[0.534017,1.078795],[0.586276,1.029452],[0.634307,0.975857],[0.677809,0.91827],[0.716481,0.856953],[0.750022,0.792167],[0.778133,0.724174],[0.800511,0.653236],[0.816857,0.579614],[0.888471,0.206728],[0.919014,0.123974],[0.974328,0.058517],[1.048362,0.015484],[1.135062,0],[1.135062,-0.5]]);
263
+	}
264
+
265
+module HTD_5mm()
266
+	{
267
+	linear_extrude(height=pulley_t_ht+2) polygon([[-1.89036,-0.75],[-1.89036,0],[-1.741168,0.02669],[-1.61387,0.100806],[-1.518984,0.21342],[-1.467026,0.3556],[-1.427162,0.960967],[-1.398568,1.089602],[-1.359437,1.213531],[-1.310296,1.332296],[-1.251672,1.445441],[-1.184092,1.552509],[-1.108081,1.653042],[-1.024167,1.746585],[-0.932877,1.832681],[-0.834736,1.910872],[-0.730271,1.980701],[-0.62001,2.041713],[-0.504478,2.09345],[-0.384202,2.135455],[-0.259708,2.167271],[-0.131524,2.188443],[-0.000176,2.198511],[0.131296,2.188504],[0.259588,2.167387],[0.384174,2.135616],[0.504527,2.093648],[0.620123,2.04194],[0.730433,1.980949],[0.834934,1.911132],[0.933097,1.832945],[1.024398,1.746846],[1.108311,1.653291],[1.184308,1.552736],[1.251865,1.445639],[1.310455,1.332457],[1.359552,1.213647],[1.39863,1.089664],[1.427162,0.960967],[1.467026,0.3556],[1.518984,0.21342],[1.61387,0.100806],[1.741168,0.02669],[1.89036,0],[1.89036,-0.75]]);
268
+	}
269
+
270
+module HTD_8mm()
271
+	{
272
+	linear_extrude(height=pulley_t_ht+2) polygon([[-3.301471,-1],[-3.301471,0],[-3.16611,0.012093],[-3.038062,0.047068],[-2.919646,0.10297],[-2.813182,0.177844],[-2.720989,0.269734],[-2.645387,0.376684],[-2.588694,0.496739],[-2.553229,0.627944],[-2.460801,1.470025],[-2.411413,1.691917],[-2.343887,1.905691],[-2.259126,2.110563],[-2.158035,2.30575],[-2.041518,2.490467],[-1.910478,2.66393],[-1.76582,2.825356],[-1.608446,2.973961],[-1.439261,3.10896],[-1.259169,3.22957],[-1.069074,3.335006],[-0.869878,3.424485],[-0.662487,3.497224],[-0.447804,3.552437],[-0.226732,3.589341],[-0.000176,3.607153],[0.226511,3.589461],[0.447712,3.552654],[0.66252,3.497516],[0.870027,3.424833],[1.069329,3.33539],[1.259517,3.229973],[1.439687,3.109367],[1.608931,2.974358],[1.766344,2.825731],[1.911018,2.664271],[2.042047,2.490765],[2.158526,2.305998],[2.259547,2.110755],[2.344204,1.905821],[2.411591,1.691983],[2.460801,1.470025],[2.553229,0.627944],[2.588592,0.496739],[2.645238,0.376684],[2.720834,0.269734],[2.81305,0.177844],[2.919553,0.10297],[3.038012,0.047068],[3.166095,0.012093],[3.301471,0],[3.301471,-1]]);
273
+	}
274
+
275
+module GT2_2mm()
276
+	{
277
+	linear_extrude(height=pulley_t_ht+2) polygon([[0.747183,-0.5],[0.747183,0],[0.647876,0.037218],[0.598311,0.130528],[0.578556,0.238423],[0.547158,0.343077],[0.504649,0.443762],[0.451556,0.53975],[0.358229,0.636924],[0.2484,0.707276],[0.127259,0.750044],[0,0.76447],[-0.127259,0.750044],[-0.2484,0.707276],[-0.358229,0.636924],[-0.451556,0.53975],[-0.504797,0.443762],[-0.547291,0.343077],[-0.578605,0.238423],[-0.598311,0.130528],[-0.648009,0.037218],[-0.747183,0],[-0.747183,-0.5]]);
278
+	}
279
+
280
+module GT2_3mm()
281
+	{
282
+	linear_extrude(height=pulley_t_ht+2) polygon([[-1.155171,-0.5],[-1.155171,0],[-1.065317,0.016448],[-0.989057,0.062001],[-0.93297,0.130969],[-0.90364,0.217664],[-0.863705,0.408181],[-0.800056,0.591388],[-0.713587,0.765004],[-0.60519,0.926747],[-0.469751,1.032548],[-0.320719,1.108119],[-0.162625,1.153462],[0,1.168577],[0.162625,1.153462],[0.320719,1.108119],[0.469751,1.032548],[0.60519,0.926747],[0.713587,0.765004],[0.800056,0.591388],[0.863705,0.408181],[0.90364,0.217664],[0.932921,0.130969],[0.988924,0.062001],[1.065168,0.016448],[1.155171,0],[1.155171,-0.5]]);
283
+	}
284
+
285
+module GT2_5mm()
286
+	{
287
+	linear_extrude(height=pulley_t_ht+2) polygon([[-1.975908,-0.75],[-1.975908,0],[-1.797959,0.03212],[-1.646634,0.121224],[-1.534534,0.256431],[-1.474258,0.426861],[-1.446911,0.570808],[-1.411774,0.712722],[-1.368964,0.852287],[-1.318597,0.989189],[-1.260788,1.123115],[-1.195654,1.25375],[-1.12331,1.380781],[-1.043869,1.503892],[-0.935264,1.612278],[-0.817959,1.706414],[-0.693181,1.786237],[-0.562151,1.851687],[-0.426095,1.9027],[-0.286235,1.939214],[-0.143795,1.961168],[0,1.9685],[0.143796,1.961168],[0.286235,1.939214],[0.426095,1.9027],[0.562151,1.851687],[0.693181,1.786237],[0.817959,1.706414],[0.935263,1.612278],[1.043869,1.503892],[1.123207,1.380781],[1.195509,1.25375],[1.26065,1.123115],[1.318507,0.989189],[1.368956,0.852287],[1.411872,0.712722],[1.447132,0.570808],[1.474611,0.426861],[1.534583,0.256431],[1.646678,0.121223],[1.798064,0.03212],[1.975908,0],[1.975908,-0.75]]);
288
+	}

+ 184
- 0
lib/bearing_idler.scad View File

@@ -0,0 +1,184 @@
1
+
2
+// #######################################################
3
+// ######################## Idler ########################
4
+// #######################################################
5
+
6
+// 624 bearing: 13x4x5
7
+bearing_outer = 13;
8
+bearing_inner = 4;
9
+bearing_height = 5;
10
+
11
+idler_outer_height = 7;
12
+idler_dia = 15;
13
+idler_ramp_dia = 16;
14
+belt_height = 6;
15
+dia_off = 0.1;
16
+ramp_step_size = 0.05;
17
+
18
+idler_dist = 0.1;
19
+spacer_size_add = 2;
20
+
21
+bearing_height_diff = belt_height - bearing_height;
22
+idler_ramp_add = (idler_outer_height - belt_height) / 2;
23
+
24
+spacer_height = idler_outer_height - bearing_height + idler_dist;
25
+
26
+bearing_spacer_height = (spacer_height - (idler_outer_height - bearing_height) / 2) * 2 + (idler_outer_height) * 2 + idler_dist;
27
+
28
+module bearing_624() {
29
+    $fn = 15;
30
+    difference() {
31
+        cylinder(d = bearing_outer, h = bearing_height);
32
+        translate([0, 0, -1])
33
+            cylinder(d = 4, h = bearing_height + 2);
34
+        translate([0, 0, bearing_height - 0.5])
35
+        difference() {
36
+            cylinder(d = bearing_outer - 2, h = 2);
37
+            cylinder(d = bearing_inner + 2, h = 2);
38
+        }
39
+        translate([0, 0, -1.5])
40
+        difference() {
41
+            cylinder(d = bearing_outer - 2, h = 2);
42
+            cylinder(d = bearing_inner + 2, h = 2);
43
+        }
44
+    }
45
+}
46
+
47
+module bearing_idler() {
48
+    $fn = 30;
49
+    
50
+    translate([0, 0, idler_ramp_add]) {
51
+        %translate([0, 0, bearing_height_diff / 2])
52
+            bearing_624();
53
+        
54
+        color("yellow")
55
+        difference() {
56
+            cylinder(d = idler_dia, h = belt_height);
57
+            translate([0, 0, -1])
58
+                cylinder(d = bearing_outer + dia_off, h = belt_height + 2);
59
+        }
60
+        
61
+        color("yellow")
62
+        for (i = [ramp_step_size : ramp_step_size : idler_ramp_add]) {
63
+            difference() {
64
+                union() {
65
+                    translate([0, 0, belt_height + i - ramp_step_size])
66
+                        cylinder(d = idler_dia + (i * 4 * (idler_ramp_dia - idler_dia)), h = ramp_step_size);
67
+                    translate([0, 0, ramp_step_size - i])
68
+                        cylinder(d = idler_dia + (i * 2), h = ramp_step_size);
69
+                }
70
+                translate([0, 0, -1])
71
+                    cylinder(d = bearing_outer + dia_off, h = belt_height + 2);
72
+            }
73
+        }
74
+    }
75
+}
76
+
77
+module bearing_spacer() {
78
+    $fn = 30;
79
+    difference() {
80
+        cylinder(d = bearing_inner + spacer_size_add, h = spacer_height);
81
+        translate([0, 0, -1])
82
+            cylinder(d = bearing_inner + dia_off, h = spacer_height + 2);
83
+    }
84
+}
85
+
86
+module bearing_spacer_assembly(only_outer, top) {
87
+    translate([0, 0, spacer_height - (idler_outer_height - bearing_height) / 2]) {
88
+        if ((!only_outer) || top) {
89
+            color("magenta")
90
+            translate([0, 0, -spacer_height + (idler_outer_height - bearing_height) / 2])
91
+                bearing_spacer();
92
+        }
93
+        
94
+        if (!only_outer) {
95
+            bearing_idler();
96
+
97
+            color("magenta")
98
+            translate([0, 0, idler_outer_height - (idler_outer_height - bearing_height) / 2])
99
+                bearing_spacer();
100
+
101
+            translate([0, 0, (2 * idler_outer_height) + idler_dist])
102
+                rotate([0, 180, 0])
103
+                bearing_idler();
104
+        }
105
+        
106
+        if ((!only_outer) || (!top)) {
107
+            color("magenta")
108
+            translate([0, 0, (2 * idler_outer_height) + idler_dist - (idler_outer_height - bearing_height) / 2])
109
+                bearing_spacer();
110
+        }
111
+    }
112
+    
113
+    echo(bearings_spacers_height=bearing_spacer_height);
114
+}
115
+
116
+bearing_mount_wall = 8;
117
+bearing_mount_width = 15;
118
+
119
+idler_distance = 3;
120
+idler_off_z = 0.5;
121
+
122
+module slot_mount_bracket(slot, preview) {
123
+    $fn = 15;
124
+    
125
+    color("green")
126
+    translate([0, 0, slot])
127
+    difference() {
128
+        cube([slot, bearing_mount_width, bearing_mount_wall]);
129
+        
130
+        translate([slot / 2, bearing_mount_width / 2, -1])
131
+            cylinder(d = 4.2, h = bearing_mount_wall + 2);
132
+    }
133
+    
134
+    color("green")
135
+    translate([slot, 0, 0])
136
+    difference() {
137
+        cube([bearing_mount_wall, bearing_mount_width, slot + bearing_mount_wall]);
138
+        
139
+        translate([-1, bearing_mount_width / 2, slot / 2])
140
+            rotate([0, 90, 0])
141
+            cylinder(d = 4.2, h = bearing_mount_wall + 2);
142
+    }
143
+    
144
+    difference() {
145
+        bearing_appendage(slot, preview);
146
+        
147
+        translate([slot + bearing_mount_wall + idler_ramp_dia / 2 + idler_distance, bearing_mount_width / 2, -5])
148
+            cylinder(d = 4.2, h = slot + (2 * bearing_mount_wall) + 2);
149
+    }
150
+}
151
+
152
+module bearing_appendage(slot, preview) {
153
+    color("green")
154
+    translate([slot + bearing_mount_wall, 0, slot])
155
+    hull() {
156
+        cube([1, bearing_mount_width, bearing_mount_wall]);
157
+        
158
+        translate([idler_ramp_dia / 2 + idler_distance, bearing_mount_width / 2, 0])
159
+            cylinder(d = bearing_inner + spacer_size_add, h = bearing_mount_wall);
160
+    }
161
+    
162
+    translate([slot + bearing_mount_wall + idler_ramp_dia / 2 + idler_distance, bearing_mount_width / 2, slot - bearing_spacer_height + idler_off_z]) {
163
+        bearing_spacer_assembly(true, false);
164
+        bearing_spacer_assembly(true, true);
165
+        
166
+        if (preview) {
167
+            bearing_spacer_assembly(false);
168
+        }
169
+    }
170
+    
171
+    color("green")
172
+    translate([slot + bearing_mount_wall, 0, 0]) {
173
+        hull() {
174
+            cube([1, bearing_mount_width, bearing_mount_wall]);
175
+            
176
+            translate([idler_ramp_dia / 2 + idler_distance, bearing_mount_width / 2, 0])
177
+                cylinder(d = bearing_inner + spacer_size_add, h = bearing_mount_wall);
178
+        }
179
+        translate([idler_ramp_dia / 2 + idler_distance, bearing_mount_width / 2, bearing_mount_wall])
180
+            cylinder(d = bearing_inner + spacer_size_add, h = 7);
181
+    }
182
+}
183
+
184
+//slot_mount_bracket(30, true);

+ 73
- 0
lib/nema.scad View File

@@ -0,0 +1,73 @@
1
+
2
+// #######################################################
3
+// #################### NEMA Steppers ####################
4
+// #######################################################
5
+
6
+$fn = 15;
7
+
8
+nema17_size = 42.3;
9
+nema17_hole_off = 30.1 / 2;
10
+nema17_hole_size = 3.2;
11
+nema17_shaft_size = 5.0;
12
+nema17_shaft_length = 24.0;
13
+nema17_center_size = 22.0;
14
+nema17_center_height = 2.0;
15
+
16
+nema17_mount_wall = 8.0;
17
+nema17_mount_hole_size = 3.4;
18
+
19
+module nema17_holes_face(height, length, hole) {
20
+    translate([nema17_size / 2, nema17_size / 2, height - 4.5]) {
21
+            translate([nema17_hole_off, nema17_hole_off, 0])
22
+                cylinder(d = hole, h = length);
23
+            translate([-nema17_hole_off, nema17_hole_off, 0])
24
+                cylinder(d = hole, h = length);
25
+            translate([nema17_hole_off, -nema17_hole_off, 0])
26
+                cylinder(d = hole, h = length);
27
+            translate([-nema17_hole_off, -nema17_hole_off, 0])
28
+                cylinder(d = hole, h = length);
29
+        }
30
+}
31
+
32
+module nema17(length) {
33
+    difference() {
34
+        cube([nema17_size, nema17_size, length]);
35
+        nema17_holes_face(length, 5.0, nema17_hole_size);
36
+    }
37
+    
38
+    translate([nema17_size / 2, nema17_size / 2, length]) {
39
+        cylinder(d = nema17_center_size, h = nema17_center_height);
40
+        cylinder(d = nema17_shaft_size, h = nema17_shaft_length);
41
+    }
42
+}
43
+
44
+// TODO use not M4 with 2020 extrusion?
45
+module nema17_mount(slot) {
46
+    // motor faceplate
47
+    difference() {
48
+        cube([nema17_size, nema17_size, nema17_mount_wall]);
49
+        nema17_holes_face(4, nema17_mount_wall + 1, nema17_mount_hole_size);
50
+        
51
+        translate([nema17_size / 2, nema17_size / 2, -1])
52
+            cylinder(d = 24.0, h = nema17_mount_wall + 2);
53
+    }
54
+    
55
+    // mount on side
56
+    translate([nema17_size, 0, 0])
57
+    difference() {
58
+        cube([nema17_mount_wall, nema17_size, nema17_mount_wall + (2 * slot)]);
59
+        
60
+        hole_off_add = 3.5;
61
+        
62
+        for (i = [0, 1]) {
63
+            translate([nema17_mount_wall + 1, nema17_size / 3 - hole_off_add, nema17_mount_wall + (slot / 2) + (i * slot)]) {
64
+                    rotate([0, -90, 0])
65
+                        cylinder(d = 4.4, h = nema17_mount_wall + 2);
66
+            
67
+                    translate([0, nema17_size / 3 + (2 * hole_off_add), 0])
68
+                        rotate([0, -90, 0])
69
+                        cylinder(d = 4.4, h = nema17_mount_wall + 2);
70
+            }
71
+        }
72
+    }
73
+}

+ 67
- 0
lib/rail_mount.scad View File

@@ -0,0 +1,67 @@
1
+
2
+// #######################################################
3
+// ###################### Mechanics ######################
4
+// #######################################################
5
+
6
+rail_mount_wall = 5;
7
+rail_mount_len = 10;
8
+rail_mount_block = 22;
9
+rail_mount_height = 11;
10
+
11
+rail_dia = 8;
12
+rail_y_off_1 = 5;
13
+
14
+cutout_width = 0.5;
15
+
16
+module rail_mount(slot) {
17
+    $fn = 20;
18
+    
19
+    difference() {
20
+        union() {
21
+            // main body
22
+            cube([rail_mount_wall, rail_mount_len, 2 * slot]);
23
+            
24
+            // rail clamp
25
+            translate([rail_mount_wall, 0, ((2 * slot) - rail_mount_block ) / 2])
26
+                cube([rail_mount_height, rail_mount_len, rail_mount_block]);
27
+        }
28
+
29
+        // M4 slot mounting holes
30
+        translate([-1, rail_mount_len / 2, slot / 2])
31
+            rotate([0, 90, 0])
32
+            cylinder(d = 4.2, h = rail_mount_wall + 2);
33
+        translate([-1, rail_mount_len / 2, slot * 3 / 2])
34
+            rotate([0, 90, 0])
35
+            cylinder(d = 4.2, h = rail_mount_wall + 2);
36
+        
37
+        translate([rail_dia / 2 + rail_y_off_1, -1, slot])
38
+            rotate([-90, 0, 0])
39
+            cylinder(d = rail_dia + 0.1, h = rail_mount_len + 2);
40
+        
41
+        // clamping cutout
42
+        translate([rail_y_off_1 + (rail_dia - cutout_width) / 2, -1, ((2 * slot) - (rail_mount_block + 2)) / 2])
43
+            cube([cutout_width, rail_mount_len + 2, rail_mount_block + 2]);
44
+        
45
+        translate([-1, rail_mount_len / 2, slot + rail_mount_block / 3])
46
+        rotate([0, 90, 0]) {
47
+            cylinder(d = 3.2, h = rail_mount_height + rail_mount_wall + 2);
48
+            
49
+            cylinder(d = 6.1, h = 3.8, $fn = 6);
50
+            
51
+            translate([0, 0, rail_mount_height + rail_mount_wall -2.5])
52
+                cylinder(d = 6.1, h = 3.8);
53
+        }
54
+        
55
+        translate([-1, rail_mount_len / 2, slot - rail_mount_block / 3])
56
+        rotate([0, 90, 0]) {
57
+            cylinder(d = 3.2, h = rail_mount_height + rail_mount_wall + 2);
58
+            
59
+            cylinder(d = 6.1, h = 3.8, $fn = 6);
60
+            
61
+            translate([0, 0, rail_mount_height + rail_mount_wall -2.5])
62
+                cylinder(d = 6.1, h = 3.8);
63
+        }
64
+    }
65
+}
66
+
67
+//rail_mount(30);

+ 59
- 0
lib/tslot.scad View File

@@ -0,0 +1,59 @@
1
+//(C) Nathan Zadoks 2011
2
+//CC-BY-SA or GPLv2, pick your poison.
3
+
4
+// retrieved from https://www.thingiverse.com/thing:11142
5
+
6
+module tslot(
7
+	size=10,	//size of each side
8
+	length=10,	//length. descriptive enough, no?
9
+	thickness=3,	//thickness of the 'sheet'
10
+	gap=0,		//gap, thickness of the lower part of the 'T'
11
+	center=false,	//somewhat vague. todo.
12
+	nut=false,	//set to true to make a fitting T-slot nut
13
+){
14
+	start=thickness/sqrt(2);
15
+	if(nut){
16
+		linear_extrude(height=10)
17
+		intersection(){
18
+			polygon([[size/2-gap/2,0],[size/2-gap/2,thickness],[thickness+start,thickness],[size/2,size/2-2],[size-thickness-start,thickness],[size/2+gap/2,thickness],[size/2+gap/2,0]]);
19
+			square([size,size/2-(gap+thickness)/2]);
20
+		}
21
+	}	
22
+	else{
23
+		color([0.5,0.5,0.5])
24
+		linear_extrude(height=length,center=center)
25
+		translate([15,15])
26
+		difference(){
27
+			union(){
28
+				for(d=[0:3]) rotate([0,0,d*90]) polygon(points=[
29
+					[0,0],
30
+					[0,start],[size/2-thickness-start,size/2-thickness],[gap/2,size/2-thickness],[gap/2,size/2],
31
+					[size/2,size/2],[size/2,gap/2],[size/2-thickness,gap/2],[size/2-thickness,size/2-thickness-start],[start,0]
32
+				]);
33
+				square(gap+thickness,center=true);
34
+			}
35
+			circle(r=gap/2,center=true);
36
+		}
37
+	}
38
+}
39
+module tslot20(length,nut){
40
+	tslot(size=20,gap=5.26,thickness=1.5,length=length,nut=nut);
41
+}
42
+module tslot30(length,nut){
43
+	tslot(size=30,gap=8.13,thickness=2.55,length=length,nut=nut);
44
+}
45
+
46
+module tslot20_2040(length,nut){
47
+	union(){
48
+		tslot20(length,nut);
49
+		translate([0,20,0])
50
+		tslot20(length,nut);
51
+	}
52
+}
53
+module tslot30_3060(length,nut){
54
+	union(){
55
+		tslot30(length,nut);
56
+		translate([0,30,0])
57
+		tslot30(length,nut);
58
+	}
59
+}

+ 75
- 0
lib/tslot_xy.scad View File

@@ -0,0 +1,75 @@
1
+
2
+// #######################################################
3
+// ####################### T-Slots #######################
4
+// #######################################################
5
+
6
+include <tslot.scad>
7
+module tslot_x(slot, length) {
8
+    color("white")
9
+    if (slot == 30) {
10
+        translate([0, 0, slot])
11
+            rotate([0, 90, 0])
12
+            tslot30(length, false);
13
+    } else {
14
+        translate([0, -5, slot + 5])
15
+            rotate([0, 90, 0])
16
+            tslot20(length, false);
17
+    }
18
+}
19
+module tslot_y(slot, length) {
20
+    color("white")
21
+    if (slot == 30) {
22
+        translate([0, 0, slot])
23
+            rotate([-90, 0, 0])
24
+            tslot30(length, false);
25
+    } else {
26
+        translate([-5, 0, slot + 5])
27
+            rotate([-90, 0, 0])
28
+            tslot20(length, false);
29
+    }
30
+}
31
+module tslot_z(slot, length) {
32
+    color("white")
33
+    if (slot == 30) {
34
+        translate([0, 0, 0])
35
+            tslot30(length, false);
36
+    } else {
37
+        translate([-5, -5, 0])
38
+            tslot20(length, false);
39
+    }
40
+}
41
+
42
+module tslot_2_x(slot, length) {
43
+    color("white")
44
+    if (slot == 30) {
45
+        translate([0, 0, slot])
46
+            rotate([0, 90, 0])
47
+            tslot30_3060(length, false);
48
+    } else {
49
+        translate([0, -5, slot + 5])
50
+            rotate([0, 90, 0])
51
+            tslot20_2040(length, false);
52
+    }
53
+}
54
+module tslot_2_y(slot, length) {
55
+    color("white")
56
+    if (slot == 30) {
57
+        translate([0, 0, slot])
58
+            rotate([-90, 0, 0])
59
+            tslot30_3060(length, false);
60
+    } else {
61
+        translate([-5, 0, slot + 5])
62
+            rotate([-90, 0, 0])
63
+            tslot20_2040(length, false);
64
+    }
65
+}
66
+module tslot_2_z(slot, length) {
67
+    color("white")
68
+    if (slot == 30) {
69
+        translate([0, 0, 0])
70
+            tslot30_3060(length, false);
71
+    } else {
72
+        translate([-5, -5, 0])
73
+            tslot20_2040(length, false);
74
+    }
75
+}

+ 360
- 0
xyRepRap.scad View File

@@ -0,0 +1,360 @@
1
+
2
+// #######################################################
3
+// ################## Config Parameters ##################
4
+// #######################################################
5
+
6
+slot = 30; // or 20
7
+slot_off = 1; // distance between adjacent slots
8
+
9
+// print area / volume
10
+heatbed_width = 400;
11
+heatbed_length = 400;
12
+
13
+heatbed_height = 6;
14
+
15
+// distance between heatbed edge and inner t-slot frame edge
16
+frame_off_x = 20;
17
+frame_off_y = 20;
18
+
19
+outer_width = heatbed_width + (2 * (slot + frame_off_x));
20
+outer_length = heatbed_length + (2 * (slot + frame_off_y));
21
+
22
+// TODO depend on print area height
23
+outer_height = 500;
24
+
25
+// display heatbed centered in print volume
26
+bed_draw_height = (outer_height - heatbed_height) / 2;
27
+
28
+// #######################################################
29
+// ###################### Libraries ######################
30
+// #######################################################
31
+
32
+include <lib/tslot_xy.scad>
33
+include <lib/nema.scad>
34
+include <lib/Belt_Generator.scad>
35
+include <lib/Pulley_T-MXL-XL-HTD-GT2_N-tooth.scad>
36
+include <lib/bearing_idler.scad>
37
+include <lib/rail_mount.scad>
38
+
39
+module gt2_belt(length) {
40
+    difference() {
41
+        belting("straight", "GT2_2mm", belt_length = length);
42
+        translate([-5, -5, 6])
43
+            cube([length + 10, 10, 10]);
44
+    }
45
+}
46
+
47
+// #######################################################
48
+// ######################## Frame ########################
49
+// #######################################################
50
+
51
+module slot_angle_connector() {
52
+    color("gray")
53
+    translate([slot, 0, 0])
54
+    rotate([0, -90, 0])
55
+    difference() {
56
+        cube([slot, slot, slot]);
57
+        translate([0, -5, 0])
58
+            rotate([0, 45, 0])
59
+            cube([2 * slot, 2 * slot, 2 * slot]);
60
+    }
61
+}
62
+
63
+module foot() {
64
+    color("yellow")
65
+    translate([0, 0, 10])
66
+        cylinder(d = 6, h = 20);
67
+    
68
+    color("yellow")
69
+    difference() {
70
+        sphere(d = 20);
71
+        translate([-15, -15, -30])
72
+            cube([30, 30, 30]);
73
+    }
74
+}
75
+
76
+module lower_frame(double) {
77
+    // bottom frame
78
+    translate([slot + slot_off, 0, 0])
79
+        tslot_x(slot, outer_width - (2 * (slot + slot_off)));
80
+    
81
+    if (double) {
82
+        translate([slot + slot_off, outer_length - slot, slot])
83
+            rotate([-90, 0, 0])
84
+            tslot_2_x(slot, outer_width - (2 * (slot + slot_off)));
85
+        
86
+        translate([0, slot + slot_off, 0])
87
+            tslot_2_y(slot, outer_width - (2 * (slot + slot_off)));
88
+        translate([outer_width - slot, slot + slot_off, 0])
89
+            tslot_2_y(slot, outer_width - (2 * (slot + slot_off)));
90
+    } else {
91
+        translate([slot + slot_off, outer_length - slot, 0])
92
+            tslot_x(slot, outer_width - (2 * (slot + slot_off)));
93
+        
94
+        translate([0, slot + slot_off, 0])
95
+            tslot_y(slot, outer_width - (2 * (slot + slot_off)));
96
+        translate([outer_width - slot, slot + slot_off, 0])
97
+            tslot_y(slot, outer_width - (2 * (slot + slot_off)));
98
+    }
99
+}
100
+
101
+module frame() {
102
+    // outer corner pillars
103
+    tslot_z(slot, outer_height);
104
+    translate([outer_width - slot, 0, 0])
105
+        tslot_z(slot, outer_height);
106
+    translate([0, outer_length - slot, 0])
107
+        tslot_z(slot, outer_height);
108
+    translate([outer_width - slot, outer_length - slot, 0])
109
+        tslot_z(slot, outer_height);
110
+
111
+    lower_frame(false);
112
+    
113
+    // top frame
114
+    translate([0, 0, outer_height - slot])
115
+        lower_frame(true);
116
+    
117
+    // end caps
118
+    color("black")
119
+    translate([0, 0, outer_height]) {
120
+        cube([slot, slot, 2]);
121
+        translate([outer_width - slot, 0, 0])
122
+            cube([slot, slot, 2]);
123
+        translate([0, outer_length - slot, 0])
124
+            cube([slot, slot, 2]);
125
+        translate([outer_width - slot, outer_length - slot, 0])
126
+            cube([slot, slot, 2]);
127
+    }
128
+    
129
+    // feet
130
+    translate([slot / 2, slot / 2, -30])
131
+        foot();
132
+    translate([outer_width - slot / 2, slot / 2, -30])
133
+        foot();
134
+    translate([slot / 2, outer_length - slot / 2, -30])
135
+        foot();
136
+    translate([outer_width - slot / 2, outer_length - slot / 2, -30])
137
+        foot();
138
+    
139
+    // connecting elements
140
+    translate([slot + slot_off, 0, slot + slot_off])
141
+        slot_angle_connector();
142
+    translate([slot + slot_off, outer_length - slot, slot + slot_off])
143
+        slot_angle_connector();
144
+    translate([slot + slot_off, 0, outer_height - slot - slot_off])
145
+        rotate([0, 90, 0])
146
+        slot_angle_connector();
147
+    translate([slot + slot_off, outer_length - slot, outer_height - slot - slot_off - slot])
148
+        rotate([0, 90, 0])
149
+        slot_angle_connector();
150
+    translate([outer_width - slot - slot_off, 0, slot + slot_off])
151
+        rotate([0, -90, 0])
152
+        slot_angle_connector();
153
+    translate([outer_width - slot - slot_off, outer_length - slot, slot + slot_off])
154
+        rotate([0, -90, 0])
155
+        slot_angle_connector();
156
+    translate([outer_width - slot - slot_off, 0, outer_height - slot - slot_off])
157
+        rotate([0, 180, 0])
158
+        slot_angle_connector();
159
+    translate([outer_width - slot - slot_off, outer_length - slot, outer_height - slot - slot_off - slot])
160
+        rotate([0, 180, 0])
161
+        slot_angle_connector();
162
+    translate([slot, slot + slot_off, slot + slot_off])
163
+        rotate([0, 0, 90])
164
+        slot_angle_connector();
165
+    translate([slot, slot + slot_off, outer_height - slot - slot_off - slot])
166
+        rotate([0, 90, 90])
167
+        slot_angle_connector();
168
+    translate([0, outer_length - slot - slot_off, slot + slot_off])
169
+        rotate([0, 0, -90])
170
+        slot_angle_connector();
171
+    translate([0, outer_length - slot - slot_off, outer_height - slot - slot_off - slot])
172
+        rotate([0, 90, -90])
173
+        slot_angle_connector();
174
+    translate([outer_width, slot + slot_off, slot + slot_off])
175
+        rotate([0, 0, 90])
176
+        slot_angle_connector();
177
+    translate([outer_width, slot + slot_off, outer_height - slot - slot_off - slot])
178
+        rotate([0, 90, 90])
179
+        slot_angle_connector();
180
+    translate([outer_width - slot, outer_length - slot - slot_off, slot + slot_off])
181
+        rotate([0, 0, -90])
182
+        slot_angle_connector();
183
+    translate([outer_width - slot, outer_length - slot - slot_off, outer_height - slot - slot_off - slot])
184
+        rotate([0, 90, -90])
185
+        slot_angle_connector();
186
+    translate([slot + slot_off, slot + slot_off, slot])
187
+        rotate([-90, 0, 0])
188
+        slot_angle_connector();
189
+    translate([outer_width - slot - slot_off, slot + slot_off, slot])
190
+        rotate([-90, 0, 90])
191
+        slot_angle_connector();
192
+    translate([slot + slot_off, outer_length - slot - slot_off, 0])
193
+        rotate([90, 0, 0])
194
+        slot_angle_connector();
195
+    translate([outer_width - slot - slot_off, outer_length - slot - slot_off, 0])
196
+        rotate([90, 0, -90])
197
+        slot_angle_connector();
198
+    /*
199
+    translate([slot + slot_off, slot + slot_off, outer_height])
200
+        rotate([-90, 0, 0])
201
+        slot_angle_connector();
202
+    translate([outer_width - slot - slot_off, slot + slot_off, outer_height])
203
+        rotate([-90, 0, 90])
204
+        slot_angle_connector();
205
+    translate([slot + slot_off, outer_length - slot - slot_off, outer_height - slot])
206
+        rotate([90, 0, 0])
207
+        slot_angle_connector();
208
+    translate([outer_width - slot - slot_off, outer_length - slot - slot_off, outer_height - slot])
209
+        rotate([90, 0, -90])
210
+        slot_angle_connector();
211
+    */
212
+}
213
+
214
+// #######################################################
215
+// ###################### Mechanics ######################
216
+// #######################################################
217
+
218
+rail_mount_dist = 10;
219
+
220
+module y_rails() {
221
+    // y smooth rail on blue side
222
+    color("cyan")
223
+    translate([rail_dia / 2 + rail_y_off_1, 18, -30])
224
+        rotate([-90, 0, 0])
225
+        cylinder(d = rail_dia, h = outer_length - (2 * slot) - nema17_size - rail_mount_dist);
226
+    
227
+    // rail mounts for blue side
228
+    color("green")
229
+    translate([0, 2 * rail_mount_dist, -2 * slot])
230
+        rail_mount(slot);
231
+    color("green")
232
+    translate([0, outer_length - (2 * slot) - nema17_size - rail_mount_dist + 5, -2 * slot])
233
+        rail_mount(slot);
234
+    
235
+    // y smooth rail on red side
236
+    color("cyan")
237
+    translate([outer_width - (2 * slot) - rail_dia / 2 - rail_y_off_1, 18, -30])
238
+        rotate([-90, 0, 0])
239
+        cylinder(d = rail_dia, h = outer_length - (2 * slot) - nema17_size - rail_mount_dist);
240
+}
241
+
242
+x_rail_dist = 50;
243
+
244
+module x_rails() {
245
+    translate([30, 200, 15])
246
+        rotate([0, 90, 0])
247
+        cylinder(d = rail_dia, h = outer_length - (4 * slot));
248
+    translate([30, 200 + x_rail_dist, 15])
249
+        rotate([0, 90, 0])
250
+        cylinder(d = rail_dia, h = outer_length - (4 * slot));
251
+}
252
+
253
+module motion_xy() {
254
+    translate([slot, slot, outer_height])
255
+        y_rails();
256
+    
257
+    //color("cyan")
258
+    //translate([slot, slot, outer_height - (1.5 * slot)])
259
+    //    x_rails();
260
+
261
+    // left ("blue") motor
262
+    translate([slot, outer_length - slot - nema17_size - nema17_mount_wall, outer_height + nema17_mount_wall])
263
+    rotate([180, 0, 90]) {
264
+        color("blue")
265
+        translate([0, 0, -65])
266
+            nema17(65);
267
+        
268
+        color("green")
269
+        nema17_mount(slot);
270
+        
271
+        // blue motor pulley
272
+        color("magenta")
273
+        translate([nema17_size / 2, nema17_size / 2, 22.4])
274
+            rotate([180, 0, 0])
275
+            gt2_pulley();
276
+        
277
+        // blue gt2 belt at motor
278
+        color("blue")
279
+        translate([nema17_size / 2, nema17_size / 2 + 6.5, nema17_mount_wall + 1])
280
+        rotate([0, 0, 180])
281
+            gt2_belt(200);
282
+        color("blue")
283
+        translate([-outer_length + (3 * slot) + 10 + nema17_size / 2, nema17_size / 2 - 6.5, nema17_mount_wall + 1])
284
+            gt2_belt(outer_length - (3 * slot) - 10);
285
+    }
286
+    
287
+    // right ("red") motor
288
+    translate([outer_width - slot - nema17_size, outer_length - slot - nema17_size - nema17_mount_wall, outer_height + nema17_mount_wall])
289
+    rotate([180, 0, 90]) {
290
+        color("red")
291
+        translate([0, 0, -65])
292
+            nema17(65);
293
+        
294
+        color("green")
295
+        nema17_mount(slot);
296
+        
297
+        // red motor pulley
298
+        color("cyan")
299
+        translate([nema17_size / 2, nema17_size / 2, 8.2])
300
+            gt2_pulley();
301
+        
302
+        // red gt2 belt at motor
303
+        color("red")
304
+        translate([nema17_size / 2, nema17_size / 2 + 6.5, nema17_mount_wall + 8])
305
+        rotate([0, 0, 180])
306
+            gt2_belt(outer_length - (3 * slot) - 10);
307
+        color("red")
308
+        translate([-200 + nema17_size / 2, nema17_size / 2 - 6.5, nema17_mount_wall + 8])
309
+            gt2_belt(200);
310
+    }
311
+    
312
+    // long back belts
313
+    color("blue")
314
+    translate([slot + 15, slot + 10, outer_height - 7])
315
+        gt2_belt(outer_width - nema17_size - (2 * slot) + 13);
316
+    color("red")
317
+    translate([slot + 15, slot + 10, outer_height - 14])
318
+        gt2_belt(outer_width - nema17_size - (2 * slot) + 13);
319
+    
320
+    // blue belt on red side
321
+    color("blue")
322
+    translate([outer_width - slot - 15, slot + 10, outer_height - 7])
323
+        rotate([0, 0, 90])
324
+        gt2_belt(200);
325
+    
326
+    // red belt on blue side
327
+    color("red")
328
+    translate([slot + 15, slot + 209, outer_height - 14])
329
+        rotate([0, 0, -90])
330
+        gt2_belt(200);
331
+    
332
+    // idler on blue side
333
+    translate([slot + bearing_mount_width + 15, 0, outer_height - slot])
334
+        rotate([0, 0, 90])
335
+        slot_mount_bracket(slot, true);
336
+        
337
+    // idler on red side
338
+    translate([outer_width - slot - 15, 0, outer_height - slot])
339
+        rotate([0, 0, 90])
340
+        slot_mount_bracket(slot, true);
341
+}
342
+
343
+// #######################################################
344
+// ####################### Heatbed #######################
345
+// #######################################################
346
+
347
+module heatbed() {
348
+    color("yellow")
349
+    translate([slot + frame_off_x, slot + frame_off_y, bed_draw_height])
350
+        cube([heatbed_width, heatbed_length, heatbed_height]);
351
+}
352
+
353
+// ########################################################
354
+// ####################### Assembly #######################
355
+// ########################################################
356
+
357
+frame();
358
+motion_xy();
359
+heatbed();
360
+

Loading…
Cancel
Save