-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbearing_large.scad
199 lines (179 loc) · 5.25 KB
/
bearing_large.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// Planetary gear bearing (customizable)
// outer diameter of ring
D=150;
// thickness
T=20;
// clearance
tol=0.3;
number_of_planets=6;
number_of_teeth_on_planets=12;
approximate_number_of_teeth_on_sun=32;
// pressure angle
P=45;//[30:60]
// number of teeth to twist across
nTwist=1.5;
DR=0.5*1;// maximum depth ratio of teeth
m=round(number_of_planets);
np=round(number_of_teeth_on_planets);
ns1=approximate_number_of_teeth_on_sun;
k1=round(2/m*(ns1+np));
k= k1*m%2!=0 ? k1+1 : k1;
ns=k*m/2-np;
echo(ns);
nr=ns+2*np;
pitchD=0.9*D/(1+min(PI/(2*nr*tan(P)),PI*DR/nr));
pitch=pitchD*PI/nr;
echo(pitch);
helix_angle=atan(2*nTwist*pitch/T);
echo(helix_angle);
phi=$t*360/m;
translate([0,0,T/2]){
difference(){
cylinder(r=D/2,h=T,center=true,$fn=2400);
herringbone(nr,pitch,P,DR,-tol,helix_angle,T+0.2);
}
rotate([0,0,(np+1)*180/ns+phi*(ns+np)*2/ns])
mirror([0,1,0])
herringbone(ns,pitch,P,DR,tol,helix_angle,T);
for(i=[1:m])rotate([0,0,i*360/m+phi])translate([pitchD/2*(ns+np)/nr,0,0])
rotate([0,0,i*ns/m*360/np-phi*(ns+np)/np-phi])
herringbone(np,pitch,P,DR,tol,helix_angle,T);
}
module rack(
number_of_teeth=15,
circular_pitch=10,
pressure_angle=28,
helix_angle=0,
clearance=0,
gear_thickness=5,
flat=false){
addendum=circular_pitch/(4*tan(pressure_angle));
flat_extrude(h=gear_thickness,flat=flat)translate([0,-clearance*cos(pressure_angle)/2])
union(){
translate([0,-0.5-addendum])square([number_of_teeth*circular_pitch,1],center=true);
for(i=[1:number_of_teeth])
translate([circular_pitch*(i-number_of_teeth/2-0.5),0])
polygon(points=[[-circular_pitch/2,-addendum],[circular_pitch/2,-addendum],[0,addendum]]);
}
}
module herringbone(
number_of_teeth=15,
circular_pitch=10,
pressure_angle=28,
depth_ratio=1,
clearance=0,
helix_angle=0,
gear_thickness=5){
union(){
gear(number_of_teeth,
circular_pitch,
pressure_angle,
depth_ratio,
clearance,
helix_angle,
gear_thickness/2);
mirror([0,0,1])
gear(number_of_teeth,
circular_pitch,
pressure_angle,
depth_ratio,
clearance,
helix_angle,
gear_thickness/2);
}}
module gear (
number_of_teeth=15,
circular_pitch=10,
pressure_angle=28,
depth_ratio=1,
clearance=0,
helix_angle=0,
gear_thickness=5,
flat=false){
pitch_radius = number_of_teeth*circular_pitch/(2*PI);
twist=tan(helix_angle)*gear_thickness/pitch_radius*180/PI;
flat_extrude(h=gear_thickness,twist=twist,flat=flat)
gear2D (
number_of_teeth,
circular_pitch,
pressure_angle,
depth_ratio,
clearance);
}
module flat_extrude(h,twist,flat){
if(flat==false)
linear_extrude(height=h,twist=twist,slices=twist/2)children(0);
else
children(0);
}
module gear2D (
number_of_teeth,
circular_pitch,
pressure_angle,
depth_ratio,
clearance){
pitch_radius = number_of_teeth*circular_pitch/(2*PI);
base_radius = pitch_radius*cos(pressure_angle);
depth=circular_pitch/(2*tan(pressure_angle));
outer_radius = clearance<0 ? pitch_radius+depth/2-clearance : pitch_radius+depth/2;
root_radius1 = pitch_radius-depth/2-clearance/2;
root_radius = (clearance<0 && root_radius1<base_radius) ? base_radius : root_radius1;
backlash_angle = clearance/(pitch_radius*cos(pressure_angle)) * 180 / PI;
half_thick_angle = 90/number_of_teeth - backlash_angle/2;
pitch_point = involute (base_radius, involute_intersect_angle (base_radius, pitch_radius));
pitch_angle = atan2 (pitch_point[1], pitch_point[0]);
min_radius = max (base_radius,root_radius);
intersection(){
rotate(90/number_of_teeth)
circle($fn=number_of_teeth*6,r=pitch_radius+depth_ratio*circular_pitch/2-clearance/2);
union(){
rotate(90/number_of_teeth)
circle($fn=number_of_teeth*4,r=max(root_radius,pitch_radius-depth_ratio*circular_pitch/2-clearance/2));
for (i = [1:number_of_teeth])rotate(i*360/number_of_teeth){
halftooth (
pitch_angle,
base_radius,
min_radius,
outer_radius,
half_thick_angle);
mirror([0,1])halftooth (
pitch_angle,
base_radius,
min_radius,
outer_radius,
half_thick_angle);
}
}
}}
module halftooth (
pitch_angle,
base_radius,
min_radius,
outer_radius,
half_thick_angle){
index=[0,1,2,3,4,5];
start_angle = max(involute_intersect_angle (base_radius, min_radius)-5,0);
stop_angle = involute_intersect_angle (base_radius, outer_radius);
angle=index*(stop_angle-start_angle)/index[len(index)-1];
p=[[0,0],
involute(base_radius,angle[0]+start_angle),
involute(base_radius,angle[1]+start_angle),
involute(base_radius,angle[2]+start_angle),
involute(base_radius,angle[3]+start_angle),
involute(base_radius,angle[4]+start_angle),
involute(base_radius,angle[5]+start_angle)];
difference(){
rotate(-pitch_angle-half_thick_angle)polygon(points=p);
square(2*outer_radius);
}}
// Mathematical Functions
//===============
// Finds the angle of the involute about the base radius at the given distance (radius) from it's center.
//source: http://www.mathhelpforum.com/math-help/geometry/136011-circle-involute-solving-y-any-given-x.html
function involute_intersect_angle (base_radius, radius) = sqrt (pow (radius/base_radius, 2) - 1) * 180 / PI;
// Calculate the involute position for a given base radius and involute angle.
function involute (base_radius, involute_angle) =
[
base_radius*(cos (involute_angle) + involute_angle*PI/180*sin (involute_angle)),
base_radius*(sin (involute_angle) - involute_angle*PI/180*cos (involute_angle))
];