1//////////////////////////////////////////////////////////////////////////////////////////////
  2// LibFile: involute_gears.scad
  3//   Involute Spur Gears and Racks
  4//   
  5//   by Leemon Baird, 2011, Leemon@Leemon.com
  6//   http://www.thingiverse.com/thing:5505
  7//   
  8//   Additional fixes and improvements by Revar Desmera, 2017-2019, revarbat@gmail.com
  9//   
 10//   This file is public domain.  Use it for any purpose, including commercial
 11//   applications.  Attribution would be nice, but is not required.  There is
 12//   no warranty of any kind, including its correctness, usefulness, or safety.
 13//   
 14//   This is parameterized involute spur (or helical) gear.  It is much simpler
 15//   and less powerful than others on Thingiverse.  But it is public domain.  I
 16//   implemented it from scratch from the descriptions and equations on Wikipedia
 17//   and the web, using Mathematica for calculations and testing, and I now
 18//   release it into the public domain.
 19//   
 20//   To use, add the following line to the beginning of your file:
 21//   ```
 22//   include <BOSL/constants.scad>
 23//   use <BOSL/involute_gears.scad>
 24//   ```
 25//////////////////////////////////////////////////////////////////////////////////////////////
 26
 27
 28use <transforms.scad>
 29use <math.scad>
 30include <constants.scad>
 31
 32
 33// Section: Terminology
 34//   The outline of a gear is a smooth circle (the "pitch circle") which has
 35//   mountains and valleys added so it is toothed.  There is an inner
 36//   circle (the "root circle") that touches the base of all the teeth, an
 37//   outer circle that touches the tips of all the teeth, and the invisible
 38//   pitch circle in between them.  There is also a "base circle", which can
 39//   be smaller than all three of the others, which controls the shape of
 40//   the teeth.  The side of each tooth lies on the path that the end of a
 41//   string would follow if it were wrapped tightly around the base circle,
 42//   then slowly unwound.  That shape is an "involute", which gives this
 43//   type of gear its name.
 44
 45
 46// Section: Functions
 47//   These functions let the user find the derived dimensions of the gear.
 48//   A gear fits within a circle of radius outer_radius, and two gears should have
 49//   their centers separated by the sum of their pitch_radius.
 50
 51
 52// Function: circular_pitch()
 53// Description: Get tooth density expressed as "circular pitch".
 54// Arguments:
 55//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
 56function circular_pitch(mm_per_tooth=5) = mm_per_tooth;
 57
 58
 59// Function: diametral_pitch()
 60// Description: Get tooth density expressed as "diametral pitch".
 61// Arguments:
 62//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
 63function diametral_pitch(mm_per_tooth=5) = PI / mm_per_tooth;
 64
 65
 66// Function: module_value()
 67// Description: Get tooth density expressed as "module" or "modulus" in millimeters
 68// Arguments:
 69//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
 70function module_value(mm_per_tooth=5) = mm_per_tooth / PI;
 71
 72
 73// Function: adendum()
 74// Description: The height of the gear tooth above the pitch radius.
 75// Arguments:
 76//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
 77function adendum(mm_per_tooth=5) = module_value(mm_per_tooth);
 78
 79
 80// Function: dedendum()
 81// Description: The depth of the gear tooth valley, below the pitch radius.
 82// Arguments:
 83//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
 84//   clearance = If given, sets the clearance between meshing teeth.
 85function dedendum(mm_per_tooth=5, clearance=undef) =
 86	(clearance==undef)? (1.25 * module_value(mm_per_tooth)) : (module_value(mm_per_tooth) + clearance);
 87
 88
 89// Function: pitch_radius()
 90// Description: Calculates the pitch radius for the gear.
 91// Arguments:
 92//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
 93//   number of teeth = The number of teeth on the gear.
 94function pitch_radius(mm_per_tooth=5, number_of_teeth=11) =
 95	mm_per_tooth * number_of_teeth / PI / 2;
 96
 97
 98// Function: outer_radius()
 99// Description:
100//   Calculates the outer radius for the gear. The gear fits entirely within a cylinder of this radius.
101// Arguments:
102//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
103//   number of teeth = The number of teeth on the gear.
104//   clearance = If given, sets the clearance between meshing teeth.
105//   interior = If true, calculate for an interior gear.
106function outer_radius(mm_per_tooth=5, number_of_teeth=11, clearance=undef, interior=false) =
107	pitch_radius(mm_per_tooth, number_of_teeth) +
108	(interior? dedendum(mm_per_tooth, clearance) : adendum(mm_per_tooth));
109
110
111// Function: root_radius()
112// Description:
113//   Calculates the root radius for the gear, at the base of the dedendum.
114// Arguments:
115//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
116//   number of teeth = The number of teeth on the gear.
117//   clearance = If given, sets the clearance between meshing teeth.
118//   interior = If true, calculate for an interior gear.
119function root_radius(mm_per_tooth=5, number_of_teeth=11, clearance=undef, interior=false)
120	= pitch_radius(mm_per_tooth, number_of_teeth) -
121	(interior? adendum(mm_per_tooth) : dedendum(mm_per_tooth, clearance));
122
123
124// Function: base_radius()
125// Description: Get the base circle for involute teeth.
126// Arguments:
127//   mm_per_tooth = Distance between teeth around the pitch circle, in mm.
128//   number_of_teeth = The number of teeth on the gear.
129//   pressure_angle = Pressure angle in degrees.  Controls how straight or bulged the tooth sides are.
130function base_radius(mm_per_tooth=5, number_of_teeth=11, pressure_angle=28)
131	= pitch_radius(mm_per_tooth, number_of_teeth) * cos(pressure_angle);
132
133
134
135// Section: Modules
136
137
138// Module: gear_tooth_profile()
139// Description:
140//   Creates the 2D profile for an individual gear tooth.
141// Arguments:
142//   mm_per_tooth  = This is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
143//   number_of_teeth = Total number of teeth along the rack
144//   pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
145//   backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
146//   bevelang = Angle of beveled gear face.
147//   clearance = Gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
148//   interior = If true, create a mask for difference()ing from something else.
149//   valleys = If true, adds valley extentions to the base of the gear tooth.  Default: true
150// Example(2D):
151//   gear_tooth_profile(mm_per_tooth=5, number_of_teeth=20, pressure_angle=20);
152function _gear_polar(r,theta)   = r*[sin(theta), cos(theta)];                      //convert polar to cartesian coordinates
153function _gear_iang(r1,r2)      = sqrt((r2/r1)*(r2/r1) - 1)/PI*180 - acos(r1/r2);  //unwind a string this many degrees to go from radius r1 to radius r2
154function _gear_q7(f,r,b,r2,t,s) = _gear_q6(b,s,t,(1-f)*max(b,r)+f*r2);                   //radius a fraction f up the curved side of the tooth
155function _gear_q6(b,s,t,d)      = _gear_polar(d,s*(_gear_iang(b,d)+t));                        //point at radius d on the involute curve
156function gear_tooth_profile(
157	mm_per_tooth    = 3,     //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
158	number_of_teeth = 11,    //total number of teeth around the entire perimeter
159	pressure_angle  = 28,    //Controls how straight or bulged the tooth sides are. In degrees.
160	backlash        = 0.0,   //gap between two meshing teeth, in the direction along the circumference of the pitch circle
161	bevelang        = 0.0,   //Gear face angle for bevelled gears.
162	clearance       = undef, //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
163	interior        = false,
164	valleys         = true
165) = let(
166		p = pitch_radius(mm_per_tooth, number_of_teeth),
167		c = outer_radius(mm_per_tooth, number_of_teeth, clearance, interior),
168		r = root_radius(mm_per_tooth, number_of_teeth, clearance, interior),
169		b = base_radius(mm_per_tooth, number_of_teeth, pressure_angle),
170		t  = mm_per_tooth/2-backlash/2,               //tooth thickness at pitch circle
171		k  = -_gear_iang(b, p) - t/2/p/PI*180,              //angle to where involute meets base circle on each side of tooth
172		mat = matrix3_scale([1,1/cos(bevelang), 1]) * matrix3_translate([0,-r,0]),
173		points=[
174			if(valleys) _gear_polar(r, -181/number_of_teeth),
175			_gear_polar(r, r<b ? k : -180/number_of_teeth),
176			_gear_q7(0/5,r,b,c,k, 1), _gear_q7(1/5,r,b,c,k, 1), _gear_q7(2/5,r,b,c,k, 1), _gear_q7(3/5,r,b,c,k, 1), _gear_q7(4/5,r,b,c,k, 1), _gear_q7(5/5,r,b,c,k, 1),
177			_gear_q7(5/5,r,b,c,k,-1), _gear_q7(4/5,r,b,c,k,-1), _gear_q7(3/5,r,b,c,k,-1), _gear_q7(2/5,r,b,c,k,-1), _gear_q7(1/5,r,b,c,k,-1), _gear_q7(0/5,r,b,c,k,-1),
178			_gear_polar(r, r<b ? -k : 180/number_of_teeth),
179			if(valleys) _gear_polar(r, 181/number_of_teeth),
180		]
181	) matrix3_apply(points, [mat]);
182
183
184module gear_tooth_profile(
185	mm_per_tooth    = 3,     //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
186	number_of_teeth = 11,    //total number of teeth around the entire perimeter
187	pressure_angle  = 28,    //Controls how straight or bulged the tooth sides are. In degrees.
188	backlash        = 0.0,   //gap between two meshing teeth, in the direction along the circumference of the pitch circle
189	bevelang        = 0.0,   //Gear face angle for bevelled gears.
190	clearance       = undef, //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
191	interior        = false,
192	valleys         = true
193) {
194	path = gear_tooth_profile(
195		mm_per_tooth    = mm_per_tooth,
196		number_of_teeth = number_of_teeth,
197		pressure_angle  = pressure_angle,
198		backlash        = backlash,
199		bevelang        = bevelang,
200		clearance       = clearance,
201		interior        = interior,
202		valleys         = valleys
203	);
204	polygon(path);
205}
206
207
208// Module: gear2d()
209// Description:
210//   Creates a 2D involute spur gear, with reasonable defaults for all the parameters.
211//   Normally, you should just specify the first 2 parameters, and let the rest be default values.
212//   Meshing gears must match in mm_per_tooth, pressure_angle, and twist,
213//   and be separated by the sum of their pitch radii, which can be found with pitch_radius().
214// Arguments:
215//   mm_per_tooth  = This is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
216//   number_of_teeth = Total number of teeth along the rack
217//   teeth_to_hide = Number of teeth to delete to make this only a fraction of a circle
218//   pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
219//   clearance = Gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
220//   backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
221//   bevelang = Angle of beveled gear face.
222//   interior = If true, create a mask for difference()ing from something else.
223// Example(2D): Typical Gear Shape
224//   gear2d(mm_per_tooth=5, number_of_teeth=20);
225// Example(2D): Lower Pressure Angle
226//   gear2d(mm_per_tooth=5, number_of_teeth=20, pressure_angle=20);
227// Example(2D): Partial Gear
228//   gear2d(mm_per_tooth=5, number_of_teeth=20, teeth_to_hide=15, pressure_angle=20);
229function gear2d(
230	mm_per_tooth    = 3,     //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
231	number_of_teeth = 11,    //total number of teeth around the entire perimeter
232	teeth_to_hide   = 0,     //number of teeth to delete to make this only a fraction of a circle
233	pressure_angle  = 28,    //Controls how straight or bulged the tooth sides are. In degrees.
234	clearance       = undef, //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
235	backlash        = 0.0,   //gap between two meshing teeth, in the direction along the circumference of the pitch circle
236	bevelang        = 0.0,
237	interior        = false
238) = let(
239		r = root_radius(mm_per_tooth, number_of_teeth, clearance, interior),
240		ang = 360/number_of_teeth/2,
241		pts = [
242			for (i = [0:1:number_of_teeth-teeth_to_hide-1] ) let(
243				mat = matrix3_zrot(-i*360/number_of_teeth) * matrix3_translate([0,r,0])
244			) each matrix3_apply(
245				gear_tooth_profile(
246					mm_per_tooth    = mm_per_tooth,
247					number_of_teeth = number_of_teeth,
248					pressure_angle  = pressure_angle,
249					clearance       = clearance,
250					backlash        = backlash,
251					bevelang        = bevelang,
252					interior        = interior,
253					valleys         = false
254				), [mat]
255			),
256			if (teeth_to_hide>0) [0,0]
257		]
258	) pts;
259
260
261module gear2d(
262	mm_per_tooth    = 3,     //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
263	number_of_teeth = 11,    //total number of teeth around the entire perimeter
264	teeth_to_hide   = 0,     //number of teeth to delete to make this only a fraction of a circle
265	pressure_angle  = 28,    //Controls how straight or bulged the tooth sides are. In degrees.
266	clearance       = undef, //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
267	backlash        = 0.0,   //gap between two meshing teeth, in the direction along the circumference of the pitch circle
268	bevelang        = 0.0,
269	interior        = false
270) {
271	path = gear2d(
272		mm_per_tooth    = mm_per_tooth,
273		number_of_teeth = number_of_teeth,
274		teeth_to_hide   = teeth_to_hide,
275		pressure_angle  = pressure_angle,
276		clearance       = clearance,
277		backlash        = backlash,
278		bevelang        = bevelang,
279		interior        = interior
280	);
281	polygon(path);
282}
283
284
285// Module: gear()
286// Description:
287//   Creates a (potentially helical) involute spur gear.
288//   The module `gear()` gives an involute spur gear, with reasonable
289//   defaults for all the parameters.  Normally, you should just choose
290//   the first 4 parameters, and let the rest be default values.  The
291//   module `gear()` gives a gear in the XY plane, centered on the origin,
292//   with one tooth centered on the positive Y axis.  The various functions
293//   below it take the same parameters, and return various measurements
294//   for the gear.  The most important is `pitch_radius()`, which tells
295//   how far apart to space gears that are meshing, and `outer_radius()`,
296//   which gives the size of the region filled by the gear.  A gear has
297//   a "pitch circle", which is an invisible circle that cuts through
298//   the middle of each tooth (though not the exact center). In order
299//   for two gears to mesh, their pitch circles should just touch.  So
300//   the distance between their centers should be `pitch_radius()` for
301//   one, plus `pitch_radius()` for the other, which gives the radii of
302//   their pitch circles.
303//   In order for two gears to mesh, they must have the same `mm_per_tooth`
304//   and `pressure_angle` parameters.  `mm_per_tooth` gives the number
305//   of millimeters of arc around the pitch circle covered by one tooth
306//   and one space between teeth.  The `pressure_angle` controls how flat or
307//   bulged the sides of the teeth are.  Common values include 14.5
308//   degrees and 20 degrees, and occasionally 25.  Though I've seen 28
309//   recommended for plastic gears. Larger numbers bulge out more, giving
310//   stronger teeth, so 28 degrees is the default here.
311//   The ratio of `number_of_teeth` for two meshing gears gives how many
312//   times one will make a full revolution when the the other makes one
313//   full revolution.  If the two numbers are coprime (i.e.  are not
314//   both divisible by the same number greater than 1), then every tooth
315//   on one gear will meet every tooth on the other, for more even wear.
316//   So coprime numbers of teeth are good.
317// Arguments:
318//   mm_per_tooth = This is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
319//   number_of_teeth = Total number of teeth around the entire perimeter
320//   thickness = Thickness of gear in mm
321//   hole_diameter = Diameter of the hole in the center, in mm
322//   teeth_to_hide = Number of teeth to delete to make this only a fraction of a circle
323//   pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
324//   clearance = Clearance gap at the bottom of the inter-tooth valleys.
325//   backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
326//   bevelang = Angle of beveled gear face.
327//   twist = Teeth rotate this many degrees from bottom of gear to top.  360 makes the gear a screw with each thread going around once.
328//   slices = Number of vertical layers to divide gear into.  Useful for refining gears with `twist`.
329//   scale = Scale of top of gear compared to bottom.  Useful for making crown gears.
330//   interior = If true, create a mask for difference()ing from something else.
331//   orient = Orientation of the gear.  Use the `ORIENT_` constants from `constants.scad`.  Default: `ORIENT_Z`.
332//   align = Alignment of the gear.  Use the `V_` constants from `constants.scad`.  Default: `V_CENTER`.
333// Example: Spur Gear
334//   gear(mm_per_tooth=5, number_of_teeth=20, thickness=8, hole_diameter=5);
335// Example: Beveled Gear
336//   gear(mm_per_tooth=5, number_of_teeth=20, thickness=10*cos(45), hole_diameter=5, twist=-30, bevelang=45, slices=12, $fa=1, $fs=1);
337module gear(
338	mm_per_tooth    = 3,     //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
339	number_of_teeth = 11,    //total number of teeth around the entire perimeter
340	thickness       = 6,     //thickness of gear in mm
341	hole_diameter   = 3,     //diameter of the hole in the center, in mm
342	teeth_to_hide   = 0,     //number of teeth to delete to make this only a fraction of a circle
343	pressure_angle  = 28,    //Controls how straight or bulged the tooth sides are. In degrees.
344	clearance       = undef, //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
345	backlash        = 0.0,   //gap between two meshing teeth, in the direction along the circumference of the pitch circle
346	bevelang        = 0.0,   //angle of bevelled gear face.
347	twist           = undef, //teeth rotate this many degrees from bottom of gear to top.  360 makes the gear a screw with each thread going around once
348	slices          = undef, //Number of slices to divide gear into.  Useful for refining gears with `twist`.
349	interior        = false,
350	orient          = ORIENT_Z,
351	align           = V_CENTER
352) {
353	p = pitch_radius(mm_per_tooth, number_of_teeth);
354	c = outer_radius(mm_per_tooth, number_of_teeth, clearance, interior);
355	r = root_radius(mm_per_tooth, number_of_teeth, clearance, interior);
356	p2 = p - (thickness*tan(bevelang));
357	orient_and_align([p, p, thickness], orient, align) {
358		difference() {
359			linear_extrude(height=thickness, center=true, convexity=10, twist=twist, scale=p2/p, slices=slices) {
360				gear2d(
361					mm_per_tooth    = mm_per_tooth,
362					number_of_teeth = number_of_teeth,
363					teeth_to_hide   = teeth_to_hide,
364					pressure_angle  = pressure_angle,
365					clearance       = clearance,
366					backlash        = backlash,
367					bevelang        = bevelang,
368					interior        = interior
369				);
370			}
371			if (hole_diameter > 0) {
372				cylinder(h=2*thickness+1, r=hole_diameter/2, center=true);
373			}
374			if (bevelang != 0) {
375				h = (c-r)*sin(bevelang);
376				translate([0,0,-thickness/2]) {
377					difference() {
378						cube([2*c/cos(bevelang),2*c/cos(bevelang),2*h], center=true);
379						cylinder(h=h, r1=r, r2=c, center=false);
380					}
381				}
382			}
383		}
384	}
385}
386
387
388// Module: rack()
389// Description:
390//   The module `rack()` gives a rack, which is a bar with teeth.  A
391//   rack can mesh with any gear that has the same `mm_per_tooth` and
392//   `pressure_angle`.
393// Arguments:
394//   mm_per_tooth  = This is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
395//   number_of_teeth = Total number of teeth along the rack
396//   thickness = Thickness of rack in mm (affects each tooth)
397//   height = Height of rack in mm, from tooth top to back of rack.
398//   pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
399//   backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
400//   orient = Orientation of the rack.  Use the `ORIENT_` constants from `constants.scad`.  Default: `ORIENT_X`.
401//   align = Alignment of the rack.  Use the `V_` constants from `constants.scad`.  Default: `V_RIGHT`.
402// Example:
403//   rack(mm_per_tooth=5, number_of_teeth=10, thickness=5, height=5, pressure_angle=20);
404module rack(
405	mm_per_tooth    = 5,    //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
406	number_of_teeth = 20,   //total number of teeth along the rack
407	thickness       = 5,    //thickness of rack in mm (affects each tooth)
408	height          = 10,   //height of rack in mm, from tooth top to back of rack.
409	pressure_angle  = 28,   //Controls how straight or bulged the tooth sides are. In degrees.
410	backlash        = 0.0,  //gap between two meshing teeth, in the direction along the circumference of the pitch circle
411	clearance       = undef,
412	orient          = ORIENT_X,
413	align           = V_RIGHT
414) {
415	a = adendum(mm_per_tooth);
416	d = dedendum(mm_per_tooth, clearance);
417	xa = a * sin(pressure_angle);
418	xd = d * sin(pressure_angle);
419	orient_and_align([(number_of_teeth-1)*mm_per_tooth, height, thickness], orient, align, orig_orient=ORIENT_X) {
420		left((number_of_teeth-1)*mm_per_tooth/2) {
421			linear_extrude(height = thickness, center = true, convexity = 10) {
422				for (i = [0:number_of_teeth-1] ) {
423					translate([i*mm_per_tooth,0,0]) {
424						polygon(
425							points=[
426								[-1/2 * mm_per_tooth - 0.01,          a-height],
427								[-1/2 * mm_per_tooth,                 -d],
428								[-1/4 * mm_per_tooth + backlash - xd, -d],
429								[-1/4 * mm_per_tooth + backlash + xa,  a],
430								[ 1/4 * mm_per_tooth - backlash - xa,  a],
431								[ 1/4 * mm_per_tooth - backlash + xd, -d],
432								[ 1/2 * mm_per_tooth,                 -d],
433								[ 1/2 * mm_per_tooth + 0.01,          a-height],
434							]
435						);
436					}
437				}
438			}
439		}
440	}
441}
442
443
444//////////////////////////////////////////////////////////////////////////////////////////////
445//example gear train.
446//Try it with OpenSCAD View/Animate command with 20 steps and 24 FPS.
447//The gears will continue to be rotated to mesh correctly if you change the number of teeth.
448
449/*
450n1 = 11; //red gear number of teeth
451n2 = 20; //green gear
452n3 = 5;  //blue gear
453n4 = 20; //orange gear
454n5 = 8;  //gray rack
455mm_per_tooth = 9; //all meshing gears need the same mm_per_tooth (and the same pressure_angle)
456thickness    = 6;
457hole         = 3;
458height       = 12;
459
460d1 =pitch_radius(mm_per_tooth,n1);
461d12=pitch_radius(mm_per_tooth,n1) + pitch_radius(mm_per_tooth,n2);
462d13=pitch_radius(mm_per_tooth,n1) + pitch_radius(mm_per_tooth,n3);
463d14=pitch_radius(mm_per_tooth,n1) + pitch_radius(mm_per_tooth,n4);
464
465translate([ 0,    0, 0]) rotate([0,0, $t*360/n1])                 color([1.00,0.75,0.75]) gear(mm_per_tooth,n1,thickness,hole);
466translate([ 0,  d12, 0]) rotate([0,0,-($t+n2/2-0*n1+1/2)*360/n2]) color([0.75,1.00,0.75]) gear(mm_per_tooth,n2,thickness,hole);
467translate([ d13,  0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(mm_per_tooth,n3,thickness,hole);
468translate([-d14,  0, 0]) rotate([0,0,-($t-n4/4-n1/4+1/2-floor(n4/4)-3)*360/n4]) color([1.00,0.75,0.50]) gear(mm_per_tooth,n4,thickness,hole,teeth_to_hide=n4-3);
469translate([(-floor(n5/2)-floor(n1/2)+$t+n1/2-1/2)*9, -d1+0.0, 0]) rotate([0,0,0]) color([0.75,0.75,0.75]) rack(mm_per_tooth,n5,thickness,height);
470*/
471
472
473// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
474