-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgear_calculator.scad
72 lines (56 loc) · 2.84 KB
/
gear_calculator.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// spur_generator Copyright 2011 Cliff L. Biffle.
// This file is licensed Creative Commons Attribution-ShareAlike 3.0.
// http://creativecommons.org/licenses/by-sa/3.0/
// You can get this file from http://www.thingiverse.com/thing:3575
use <parametric_involute_gear_v5.0.scad>
pi=3.1415926535897932384626433832795;
// Couple handy arithmetic shortcuts
function sqr(n) = pow(n, 2);
function cube(n) = pow(n, 3);
// This was derived as follows:
// In Greg Frost's original script, the outer radius of a spur
// gear can be computed as...
function pitch_radius(teeth, circular_pitch) =
(sqr(teeth) * sqr(circular_pitch) + 64800)
/ (360 * teeth * circular_pitch);
// We can fit gears to the spacing by working it backwards.
// spacing = gear_outer_radius(teeth1, cp)
// + gear_outer_radius(teeth2, cp);
//
// I plugged this into an algebra system, assuming that spacing,
// teeth1, and teeth2 are given. By solving for circular pitch,
// we get this terrifying equation:
function fit_spur_gears(n1, n2, spacing) =
(180 * spacing * n1 * n2 + 180
* sqrt(-(2*n1*cube(n2)-(sqr(spacing)-4)*sqr(n1)*sqr(n2)+2*cube(n1)*n2)))
/ (n1*sqr(n2) + sqr(n1)*n2);
// following functions taken straight out of parametric_involute_gear_v5.0.scad
function outer_radius(teeth, circular_pitch) =
circular_pitch*(teeth/360+1/180);
// Pitch diameter: Diameter of pitch circle.
function pitch_diameter(teeth, circular_pitch) =
teeth * circular_pitch / 180;
function teeth_for_pitch_diameter(d_pitch, circular_pitch) =
d_pitch * 180 / circular_pitch;
// Base Circle
function base_radius(teeth, circular_pitch, pressure_angle=28) =
pitch_diameter(teeth, circular_pitch)*cos(pressure_angle)/2;
// Diametrial pitch: Number of teeth per unit length.
function pitch_diametrial(teeth, circular_pitch) =
teeth / pitch_diameter(teeth, circular_pitch);
// Addendum: Radial distance from pitch circle to outside circle.
function addendum(teeth, circular_pitch) =
1/pitch_diametrial(teeth, circular_pitch);
// Dedendum: Radial distance from pitch circle to root diameter
function dedendum(teeth, circular_pitch, clearance=0) =
addendum(teeth, circular_pitch) + clearance;
// Root diameter: Diameter of bottom of tooth spaces.
function root_radius(teeth, circular_pitch, clearance=0) =
pitch_radius(teeth, circular_pitch)-dedendum(teeth, circular_pitch, clearance);
function backlash_angle(teeth, circular_pitch, backlash=0) =
backlash / pitch_radius(teeth, circular_pitch) * 180 / pi;
function half_thick_angle(teeth, circular_pitch, backlash=0) =
(360 / teeth - backlash_angle(teeth, circular_pitch, backlash=0)) / 4;
// calculates the twist required to yield the provided helix angle - simple trig
function twist_for_helix_angle(helix_angle, pitch_radius, thickness) =
2*atan(0.5*thickness*tan(helix_angle)/pitch_radius);