@rulecad/gears 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +28 -1
- package/contact.mjs +1 -1
- package/core.d.mts +419 -0
- package/core.mjs +698 -0
- package/diagram.mjs +1 -1
- package/gears.d.mts +2 -420
- package/gears.mjs +5 -685
- package/package.json +4 -1
- package/planetary.d.mts +38 -2
- package/planetary.mjs +67 -6
- package/tooth.mjs +1 -1
- package/worm.mjs +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog: @rulecad/gears
|
|
2
|
+
|
|
3
|
+
What changed in each release, for someone upgrading a workspace. A **printed size** is a dimension of a part you
|
|
4
|
+
print (a gear's tip diameter, a tooth's thickness). Each release says whether any printed size moved, and why.
|
|
5
|
+
Releases before this file was started are described in their pull requests on GitHub.
|
|
6
|
+
|
|
7
|
+
## 0.3.4: the compound planetary printed in place (#162)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `compoundPlanetary({ ..., printInPlace: true, gap, helix })` (#162): a compound planetary drawn to print in one
|
|
12
|
+
piece. Every gap is the print gap (`gap`, default `DEFAULTS.printGap`, 0.3 mm, an estimate): the backlash that
|
|
13
|
+
leaves it normal to every flank, 2 gap / (cos α cos β_b), and a dedendum that leaves it under every tip; herringbone
|
|
14
|
+
teeth (`helix`, default `DEFAULTS.helix`, 30°), the sun of one hand and the planets and rings of the other; no
|
|
15
|
+
carrier. `best.printInPlace` gives what it was drawn to, and a `compound.inPlace` finding says so. A `backlash` given
|
|
16
|
+
with it is refused by name, as are `gap` and `helix` without it.
|
|
17
|
+
- `compoundPlay(teeth, backlash)` and `best.play`: how far the output ring turns with the sun and the held ring still,
|
|
18
|
+
in mm at its pitch circle and in degrees, with a `compound.play` finding. Chapter 11's 38:1: 0.65°; the 44:1 printed
|
|
19
|
+
in place: 2.92°.
|
|
20
|
+
- `DEFAULTS.printGap` and `DEFAULTS.helix`, each with its rule.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- `compoundPlanetary` laid out a planet out of phase with the output ring where its teeth put it there (#162): with
|
|
25
|
+
57/39/36/135/132 (ratio 60, step -1, 3 planets) the planet at 120° cut 0.004 mm into the output ring at the
|
|
26
|
+
default backlash, and stood 0.11 mm off it where 0.3 mm was drawn, printed in place, with no finding. Each planet
|
|
27
|
+
after the first now takes the first tooth of its first step that also meshes the output ring (there, 12 teeth on),
|
|
28
|
+
and a `compound.phase` finding fails where no tooth does. Layouts already in phase (chapter 11's 38:1, the 44:1
|
|
29
|
+
printed in place) are unchanged.
|
|
30
|
+
|
|
31
|
+
No printed size moved: a gearbox not printed in place is drawn as before. Where a planet was out of phase, it now
|
|
32
|
+
stands turned a whole number of its first step's teeth.
|
|
33
|
+
|
|
34
|
+
## 0.3.3: no import loops (#278)
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- Loaders without cycle support, such as the JSCAD web app's, now load this package. Its modules imported each other
|
|
39
|
+
in a loop (issue #278): Node links such a loop and runs it, but a loader that caches a module only once it has run
|
|
40
|
+
loads it again and again until the stack runs out (`RangeError: Maximum call stack size exceeded / failed loading
|
|
41
|
+
module ...`).
|
|
42
|
+
- The code the other modules share moved from `gears.mjs` to a new `core.mjs`, which `planetary.mjs`, `contact.mjs`,
|
|
43
|
+
`tooth.mjs`, `worm.mjs` and `diagram.mjs` import. `gears.mjs` now only re-exports. Every export keeps its name and
|
|
44
|
+
behaviour, and no printed size moved.
|
package/README.md
CHANGED
|
@@ -109,11 +109,36 @@ gives the ratio exactly, the nearest is returned and `planetary.ratio` says how
|
|
|
109
109
|
the output, each meshing its own step of a stepped planet, so a ratio of 30 to 200 fits in one stage. The ratio is
|
|
110
110
|
Willis's twice over, `(S + R1) / S / (1 − R1 P2 / (P1 R2))` (`compoundRatio`). The planets' steps differ by what the
|
|
111
111
|
rings do, so one centre distance serves both, and every tooth count is a multiple of the planets, so identical planets
|
|
112
|
-
go in evenly and in phase.
|
|
112
|
+
go in evenly and in phase. The rings are set from the first planet; each other planet takes the first tooth of its
|
|
113
|
+
first step (on the sun and the held ring) that also puts its second step in a space of the output ring, and a
|
|
114
|
+
`compound.phase` finding fails where none does. (Profile shift can't do this job alone: moving one ring by three teeth on one set of planets
|
|
113
115
|
needs a shift near two modules at the sizes that print, far past what a tooth takes.) It finds the efficiency too,
|
|
114
116
|
`compoundEfficiency`, an estimate: the rings pass power relative to the carrier many times the output's, so a high ratio is
|
|
115
117
|
well under 50%, and can't be driven backwards.
|
|
116
118
|
|
|
119
|
+
`best.play` is how far the output ring turns with the sun and the held ring still, the three meshes' backlash taken
|
|
120
|
+
up all one way (`compoundPlay`): with planets of pitch radii r1 on the sun and the held ring and r2 on the output
|
|
121
|
+
ring, and no carrier, the output ring travels j_sun |1 − r2/r1| / 2 + j_ring (1 + r2/r1) / 2 + j_ring2 at its pitch
|
|
122
|
+
circle. Chapter 11's 38:1 at the 0.15 mm backlash: 0.325 mm, 0.65°. That is play only: the teeth bending under a load
|
|
123
|
+
add to it.
|
|
124
|
+
|
|
125
|
+
### Printed in place
|
|
126
|
+
|
|
127
|
+
`compoundPlanetary({ module, ratio, planets, printInPlace: true, gap, helix })` draws the gearbox to come off the bed
|
|
128
|
+
in one piece, nothing to put together but the motor:
|
|
129
|
+
|
|
130
|
+
- **Every gap is the print gap** (`gap`, mm each side; default `DEFAULTS.printGap`, 0.3 mm, the X1C's `print_gap`, an
|
|
131
|
+
estimate). The backlash is the one that leaves that gap normal to every flank, 2 gap / (cos α cos β_b), β_b being
|
|
132
|
+
the base helix angle (0.726 mm at 0.3 mm, 20° and 30°); the dedendum leaves it under every tip (1.3 modules at
|
|
133
|
+
module 1, where ISO 53's 1.25 leaves 0.25 mm). A backlash given as well is refused: it comes from the gap.
|
|
134
|
+
- **Herringbone teeth** (`helix`, default 30°): the sun of one hand, the planets and rings of the other, so the rings
|
|
135
|
+
can't walk off the planets along the axis.
|
|
136
|
+
- **No carrier**: the two rings hold the planets.
|
|
137
|
+
|
|
138
|
+
The play grows with it: 18/21 planets on rings of 60 and 57 at 44:1 turn 1.45 mm (2.92°) at the output, about four
|
|
139
|
+
and a half times chapter 11's. The gaps between the printed parts, and whether each stands on the bed, are checked in
|
|
140
|
+
cad, on the object drawn with them (`"printInPlace": true`).
|
|
141
|
+
|
|
117
142
|
## Worms and bevel gears
|
|
118
143
|
|
|
119
144
|
A **worm** is a screw whose thread, cut along its axis, is the basic rack's tooth: `worm({ module, starts, diameter,
|
|
@@ -223,6 +248,8 @@ a point.
|
|
|
223
248
|
| Ring and pinion | at least 10 teeth apart (12 to be safe) at 20° | KHK, internal gears |
|
|
224
249
|
| Planetary ratio | (ω_s − ω_c) / (ω_r − ω_c) = −R / S; ring held, sun in: 1 + R / S | Willis; Dudley (1984), ch. 3 |
|
|
225
250
|
| Planetary assembly | R = S + 2P; (S + R) / n whole; 2a sin(π / n) > d_a,planet | KHK, planetary gears |
|
|
251
|
+
| Compound play at the output | j_s \|1 − r2/r1\| / 2 + j_r1 (1 + r2/r1) / 2 + j_r2, over the output ring's pitch radius | The three contacts' slips along their pitch circles, planets free of a carrier (this package) |
|
|
252
|
+
| Backlash for a gap normal to the flanks | j_t = 2 g / (cos α_t cos β_b), tan β_b = tan β cos α_t | ISO/TR 10064-2:1996 (j_bn = j_wt cos α_wt cos β_b) |
|
|
226
253
|
| Tooth bending (Lewis) | σ = K_v F_t / (b m Y); helical: m cos β, z / cos³β teeth | Budynas and Nisbett, Shigley's Mechanical Engineering Design, 10th ed., §14-1 and Table 14-2 |
|
|
227
254
|
| Velocity factor (Barth, cut profile) | K_v = (3.05 + V) / 3.05, V in m/s | Shigley, eq. 14-4b |
|
|
228
255
|
| Tooth by finite elements | plane stress, 32 cells a module, load F_t / cos α along the line of action at the tip | `@rulecad/fea`; AGMA 908-B89 for the geometry factor it is compared with |
|
package/contact.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// real fillets, rounds and centre distance); how far the forward meeting is from where the ratio puts it is the
|
|
4
4
|
// transmission error; outlines that cross where the ratio puts them interfere. Plain 2D geometry: the outlines'
|
|
5
5
|
// edges near the pitch point, tested for crossing.
|
|
6
|
-
import { spurProfile, internalProfile, rackProfile, gearModel, internalModel, rackModel, mesh, phase, rackPhase } from './
|
|
6
|
+
import { spurProfile, internalProfile, rackProfile, gearModel, internalModel, rackModel, mesh, phase, rackPhase } from './core.mjs';
|
|
7
7
|
|
|
8
8
|
const DEG = Math.PI / 180;
|
|
9
9
|
const fmt = (x, d = 3) => String(+x.toFixed(d));
|
package/core.d.mts
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A spur gear's numbers: its circles, tooth thickness, and the limits it was checked against. Refuses a gear whose teeth
|
|
3
|
+
* would be undercut (fewer than about 17 at 20°: give it a profile shift) or come to a point.
|
|
4
|
+
* @param {GearSpec} p
|
|
5
|
+
* @returns {GearModel}
|
|
6
|
+
*/
|
|
7
|
+
export function gearModel(p: GearSpec): GearModel;
|
|
8
|
+
/**
|
|
9
|
+
* An internal (ring) gear's numbers: the teeth point inwards, tip circle inside the pitch circle. Its spaces are shaped
|
|
10
|
+
* as an outer gear's teeth would be. `rim` is the ring's outer diameter (default: the root diameter and six modules).
|
|
11
|
+
* @param {GearSpec & { rim?: number }} p
|
|
12
|
+
* @returns {GearModel & { rim: number, space: number }}
|
|
13
|
+
*/
|
|
14
|
+
export function internalModel(p: GearSpec & {
|
|
15
|
+
rim?: number;
|
|
16
|
+
}): GearModel & {
|
|
17
|
+
rim: number;
|
|
18
|
+
space: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A rack's numbers: a gear of infinite radius, its teeth straight-flanked at the pressure angle. Its pitch line is y = 0,
|
|
22
|
+
* teeth up +y, the first space centred at x = 0. `height` is how much bar there is under the roots (default 3 modules).
|
|
23
|
+
* @param {GearSpec & { height?: number }} p
|
|
24
|
+
*/
|
|
25
|
+
export function rackModel(p: GearSpec & {
|
|
26
|
+
height?: number;
|
|
27
|
+
}): {
|
|
28
|
+
kind: string;
|
|
29
|
+
module: any;
|
|
30
|
+
teeth: any;
|
|
31
|
+
pressureAngle: any;
|
|
32
|
+
shift: number;
|
|
33
|
+
backlash: any;
|
|
34
|
+
height: any;
|
|
35
|
+
thickness: number;
|
|
36
|
+
helix: any;
|
|
37
|
+
hand: any;
|
|
38
|
+
herringbone: boolean;
|
|
39
|
+
thrust: number;
|
|
40
|
+
length: number;
|
|
41
|
+
tipLine: number;
|
|
42
|
+
rootLine: number;
|
|
43
|
+
circularPitch: number;
|
|
44
|
+
basePitch: number;
|
|
45
|
+
topLand: number;
|
|
46
|
+
rootThickness: number;
|
|
47
|
+
rack: {
|
|
48
|
+
pressureAngle: any;
|
|
49
|
+
addendum: any;
|
|
50
|
+
dedendum: any;
|
|
51
|
+
rootFillet: any;
|
|
52
|
+
tipRound: any;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A spur gear's outline in 2D, as loops of [x, y] points (the first the outside, counter-clockwise; then holes,
|
|
57
|
+
* clockwise), and the fillet and round it was drawn with (smaller than asked where the asked one didn't fit).
|
|
58
|
+
* @param {GearSpec & { bore?: number, flat?: number }} p
|
|
59
|
+
* @param {number} [grow] outwards along the outline's normal, mm (negative: inwards)
|
|
60
|
+
*/
|
|
61
|
+
export function spurProfile(p: GearSpec & {
|
|
62
|
+
bore?: number;
|
|
63
|
+
flat?: number;
|
|
64
|
+
}, grow?: number): {
|
|
65
|
+
loops: number[][][];
|
|
66
|
+
fillet: any;
|
|
67
|
+
round: any;
|
|
68
|
+
model: GearModel;
|
|
69
|
+
};
|
|
70
|
+
/** An internal gear's outline: the rim (counter-clockwise), then the teeth's inner outline (clockwise). */
|
|
71
|
+
export function internalProfile(p: any, grow?: number): {
|
|
72
|
+
loops: any[][];
|
|
73
|
+
fillet: any;
|
|
74
|
+
round: any;
|
|
75
|
+
model: GearModel & {
|
|
76
|
+
rim: number;
|
|
77
|
+
space: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/** A rack's outline: one loop, counter-clockwise, its pitch line on y = 0, teeth up +y from x = 0. */
|
|
81
|
+
export function rackProfile(p: any, grow?: number): {
|
|
82
|
+
loops: any[][];
|
|
83
|
+
fillet: any;
|
|
84
|
+
round: any;
|
|
85
|
+
model: {
|
|
86
|
+
kind: string;
|
|
87
|
+
module: any;
|
|
88
|
+
teeth: any;
|
|
89
|
+
pressureAngle: any;
|
|
90
|
+
shift: number;
|
|
91
|
+
backlash: any;
|
|
92
|
+
height: any;
|
|
93
|
+
thickness: number;
|
|
94
|
+
helix: any;
|
|
95
|
+
hand: any;
|
|
96
|
+
herringbone: boolean;
|
|
97
|
+
thrust: number;
|
|
98
|
+
length: number;
|
|
99
|
+
tipLine: number;
|
|
100
|
+
rootLine: number;
|
|
101
|
+
circularPitch: number;
|
|
102
|
+
basePitch: number;
|
|
103
|
+
topLand: number;
|
|
104
|
+
rootThickness: number;
|
|
105
|
+
rack: {
|
|
106
|
+
pressureAngle: any;
|
|
107
|
+
addendum: any;
|
|
108
|
+
dedendum: any;
|
|
109
|
+
rootFillet: any;
|
|
110
|
+
tipRound: any;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/** @typedef {{ width: number, chamfer?: number | [number, number], bore?: number, flat?: number }} Solid width up z; chamfer at the bed face (and the top); bore and flat for a shaft */
|
|
115
|
+
/**
|
|
116
|
+
* A spur gear: the profile extruded up z, its first tooth on +x, the bed face chamfered.
|
|
117
|
+
* @param {GearSpec & Solid} p
|
|
118
|
+
* @returns {object} a JSCAD geom3
|
|
119
|
+
*/
|
|
120
|
+
export function spur(p: GearSpec & Solid): object;
|
|
121
|
+
/** A helical gear: a spur gear's profile turned along its width by the helix angle. Meshes with one of the opposite hand. @param {GearSpec & Solid & { helix: number, hand?: 'right' | 'left' }} p */
|
|
122
|
+
export function helical(p: GearSpec & Solid & {
|
|
123
|
+
helix: number;
|
|
124
|
+
hand?: "right" | "left";
|
|
125
|
+
}): any;
|
|
126
|
+
/** A herringbone gear: helical one way to the middle of its width and back, so it pushes no thrust along its axis and stays on its shaft. Prints with no supports. @param {GearSpec & Solid & { helix?: number }} p */
|
|
127
|
+
export function herringbone(p: GearSpec & Solid & {
|
|
128
|
+
helix?: number;
|
|
129
|
+
}): any;
|
|
130
|
+
/** An internal (ring) gear, its rim round it. @param {GearSpec & Solid & { rim?: number }} p */
|
|
131
|
+
export function internal(p: GearSpec & Solid & {
|
|
132
|
+
rim?: number;
|
|
133
|
+
}): jscad.geometries.geom3.Geom3;
|
|
134
|
+
/** A rack along x, its teeth up +y, its width up z. @param {GearSpec & Solid & { height?: number }} p */
|
|
135
|
+
export function rack(p: GearSpec & Solid & {
|
|
136
|
+
height?: number;
|
|
137
|
+
}): jscad.geometries.geom3.Geom3;
|
|
138
|
+
/**
|
|
139
|
+
* How two gears mesh: the centre distance they need (with their profile shifts), the ratio (turns of b for one of a,
|
|
140
|
+
* negative when they turn opposite ways; for a rack, mm for one turn of the pinion), the contact ratio (how many teeth
|
|
141
|
+
* share the load on average: under 1 the drive jumps, under 1.2 it is rough), and findings. Give `centre` (mm) to have
|
|
142
|
+
* a centre distance checked: closer than needed jams the teeth, further adds backlash.
|
|
143
|
+
* @param {GearModel} a @param {GearModel} b @param {{ centre?: number }} [o]
|
|
144
|
+
*/
|
|
145
|
+
export function mesh(a: GearModel, b: GearModel, { centre, width }?: {
|
|
146
|
+
centre?: number;
|
|
147
|
+
}): any;
|
|
148
|
+
/**
|
|
149
|
+
* The phase that puts a tooth in a gap: b's angle is ratio × a's angle + phase. Both gears have their first tooth at
|
|
150
|
+
* their own angle 0; `angle` is the direction from a's centre to b's, in degrees, in the frame both angles are measured in.
|
|
151
|
+
* For a pinion in a ring, a is the pinion. Returns degrees, in [0, 360 / b's teeth).
|
|
152
|
+
* @param {GearModel} a @param {GearModel} b @param {number} [angle]
|
|
153
|
+
*/
|
|
154
|
+
export function phase(a: GearModel, b: GearModel, angle?: number): number;
|
|
155
|
+
/**
|
|
156
|
+
* Where a rack must stand so the pinion's teeth fall in its spaces: the rack's travel is (π × pitch diameter / 360) ×
|
|
157
|
+
* the pinion's angle + this, in mm. The rack lies along x with its pitch line on y = 0 and its first space at x = 0;
|
|
158
|
+
* the pinion's centre is at x = `at`, above the rack, its first tooth pointing along +x at angle 0.
|
|
159
|
+
* @param {GearModel} pinion @param {number} [at] @returns {number} mm, in [0, the circular pitch)
|
|
160
|
+
*/
|
|
161
|
+
export function rackPhase(pinion: GearModel, at?: number): number;
|
|
162
|
+
/**
|
|
163
|
+
* How a gear prints on a printer ({ line, layer, nozzle?, wall_min? }): the module against the nozzle, lines across a
|
|
164
|
+
* tooth at its root and its tip, and the width in layers. Findings in the kit's shape, each placed on the first tooth.
|
|
165
|
+
* @param {GearModel} g @param {{ line: number, layer: number, nozzle?: number, wall_min?: number }} printer @param {number} [width]
|
|
166
|
+
*/
|
|
167
|
+
export function printable(g: GearModel, printer: {
|
|
168
|
+
line: number;
|
|
169
|
+
layer: number;
|
|
170
|
+
nozzle?: number;
|
|
171
|
+
wall_min?: number;
|
|
172
|
+
}, width?: number): any[];
|
|
173
|
+
/**
|
|
174
|
+
* How much of the power a stage passes on: DEFAULTS.efficiency per mesh a tooth force goes through. A planetary's
|
|
175
|
+
* goes through two (sun to planet, planet to ring); a worm's is its own, from its lead angle and friction.
|
|
176
|
+
* @param {'spur' | 'helical' | 'herringbone' | 'rack' | 'internal' | 'bevel' | 'planetary' | 'worm'} kind
|
|
177
|
+
* @param {{ efficiency?: number, worm?: { efficiency: number } }} [o] efficiency: your measured figure per mesh
|
|
178
|
+
* @returns {number} from 0 to 1
|
|
179
|
+
*/
|
|
180
|
+
export function stageEfficiency(kind: "spur" | "helical" | "herringbone" | "rack" | "internal" | "bevel" | "planetary" | "worm", o?: {
|
|
181
|
+
efficiency?: number;
|
|
182
|
+
worm?: {
|
|
183
|
+
efficiency: number;
|
|
184
|
+
};
|
|
185
|
+
}): number;
|
|
186
|
+
/** The Lewis form factor Y for z teeth (20° full depth); Infinity for a rack. @param {number} z */
|
|
187
|
+
export function lewisFactor(z: number): number;
|
|
188
|
+
/**
|
|
189
|
+
* How strong a gear's teeth are by the Lewis equation: the bending stress at the root of a tooth carrying the whole
|
|
190
|
+
* load at its tip, σ = F_t / (b m Y), against the material's strength. Give a torque (N·mm) for the stress and safety
|
|
191
|
+
* factor at it; give a safety factor for the torque the gear carries at it. Helical teeth are read in their normal
|
|
192
|
+
* section (m cos β, z / cos³β teeth). A speed (rpm) adds Barth's velocity factor, (3.05 + V) / 3.05 for a cut (here a
|
|
193
|
+
* printed) profile. A first number: the root fillet and a tooth's neighbours help, a printed tooth's layers and
|
|
194
|
+
* voids hurt. Where it matters, measure it, or analyse the tooth (fea).
|
|
195
|
+
* @param {GearModel} g
|
|
196
|
+
* @param {{ width: number, material: { strength: number, name?: string }, torque?: number, safety?: number, speed?: number }} o
|
|
197
|
+
*/
|
|
198
|
+
export function strength(g: GearModel, o?: {
|
|
199
|
+
width: number;
|
|
200
|
+
material: {
|
|
201
|
+
strength: number;
|
|
202
|
+
name?: string;
|
|
203
|
+
};
|
|
204
|
+
torque?: number;
|
|
205
|
+
safety?: number;
|
|
206
|
+
speed?: number;
|
|
207
|
+
}): {
|
|
208
|
+
Y: number;
|
|
209
|
+
velocity: number;
|
|
210
|
+
force: number;
|
|
211
|
+
torque: number;
|
|
212
|
+
findings: any[];
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* A straight bevel gear's numbers, for a mate of `mate` teeth with the shafts at `shaftAngle` (90° by default): the
|
|
216
|
+
* pitch cone angle δ (tan δ = sin Σ / (z₂/z₁ + cos Σ)), the cone distance R (to the apex along the pitch cone), the
|
|
217
|
+
* virtual teeth z / cos δ of its back cone (Tredgold), and the face width's limit R / 3. Module and diameters at the
|
|
218
|
+
* back (large) end.
|
|
219
|
+
* @param {{ module: number, teeth: number, mate: number, shaftAngle?: number, width?: number, pressureAngle?: number, backlash?: number }} p
|
|
220
|
+
*/
|
|
221
|
+
export function bevelModel(p: {
|
|
222
|
+
module: number;
|
|
223
|
+
teeth: number;
|
|
224
|
+
mate: number;
|
|
225
|
+
shaftAngle?: number;
|
|
226
|
+
width?: number;
|
|
227
|
+
pressureAngle?: number;
|
|
228
|
+
backlash?: number;
|
|
229
|
+
}): {
|
|
230
|
+
kind: string;
|
|
231
|
+
mate: any;
|
|
232
|
+
shaftAngle: number;
|
|
233
|
+
pitchAngle: number;
|
|
234
|
+
coneDistance: number;
|
|
235
|
+
virtualTeeth: number;
|
|
236
|
+
width: any;
|
|
237
|
+
height: number;
|
|
238
|
+
smallEnd: number;
|
|
239
|
+
module: number;
|
|
240
|
+
teeth: number;
|
|
241
|
+
/**
|
|
242
|
+
* degrees
|
|
243
|
+
*/
|
|
244
|
+
pressureAngle: number;
|
|
245
|
+
/**
|
|
246
|
+
* times the module
|
|
247
|
+
*/
|
|
248
|
+
shift: number;
|
|
249
|
+
/**
|
|
250
|
+
* mm, this gear's share is half
|
|
251
|
+
*/
|
|
252
|
+
backlash: number;
|
|
253
|
+
/**
|
|
254
|
+
* pitch diameter, module × teeth
|
|
255
|
+
*/
|
|
256
|
+
pitch: number;
|
|
257
|
+
/**
|
|
258
|
+
* base circle diameter
|
|
259
|
+
*/
|
|
260
|
+
base: number;
|
|
261
|
+
/**
|
|
262
|
+
* tip diameter
|
|
263
|
+
*/
|
|
264
|
+
tip: number;
|
|
265
|
+
/**
|
|
266
|
+
* root diameter
|
|
267
|
+
*/
|
|
268
|
+
root: number;
|
|
269
|
+
/**
|
|
270
|
+
* tooth thickness on the pitch circle (an arc, mm), less half the backlash
|
|
271
|
+
*/
|
|
272
|
+
thickness: number;
|
|
273
|
+
/**
|
|
274
|
+
* π × module
|
|
275
|
+
*/
|
|
276
|
+
circularPitch: number;
|
|
277
|
+
/**
|
|
278
|
+
* π × module × cos(pressure angle)
|
|
279
|
+
*/
|
|
280
|
+
basePitch: number;
|
|
281
|
+
/**
|
|
282
|
+
* the tooth's width across its tip (mm)
|
|
283
|
+
*/
|
|
284
|
+
topLand: number;
|
|
285
|
+
/**
|
|
286
|
+
* the tooth's width where it meets the root (mm)
|
|
287
|
+
*/
|
|
288
|
+
rootThickness: number;
|
|
289
|
+
/**
|
|
290
|
+
* the basic rack it was drawn from
|
|
291
|
+
*/
|
|
292
|
+
rack: {
|
|
293
|
+
pressureAngle: number;
|
|
294
|
+
addendum: number;
|
|
295
|
+
dedendum: number;
|
|
296
|
+
rootFillet: number;
|
|
297
|
+
tipRound: number;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* A straight bevel gear: its back (large) end on the bed at z = 0, its axis up z toward the cone's apex, the spur
|
|
302
|
+
* profile of its back end scaled toward the apex up the face width, so every tooth runs straight to the apex and the
|
|
303
|
+
* pitch surface is the cone. (A printable approximation to the octoidal profile: close for teeth of 12 or more.)
|
|
304
|
+
* @param {{ module: number, teeth: number, mate: number, shaftAngle?: number, width?: number, bore?: number, chamfer?: number }} p
|
|
305
|
+
*/
|
|
306
|
+
export function bevel(p: {
|
|
307
|
+
module: number;
|
|
308
|
+
teeth: number;
|
|
309
|
+
mate: number;
|
|
310
|
+
shaftAngle?: number;
|
|
311
|
+
width?: number;
|
|
312
|
+
bore?: number;
|
|
313
|
+
chamfer?: number;
|
|
314
|
+
}): jscad.geometries.geom3.Geom3;
|
|
315
|
+
/**
|
|
316
|
+
* How two bevel gears mesh: turns of b for one of a, the cone angles (they add to the shaft angle), and the contact
|
|
317
|
+
* ratio of their back cones' equivalent spur gears (Tredgold). @param {object} a @param {object} b the gears' parameters
|
|
318
|
+
*/
|
|
319
|
+
export function bevelMesh(a: object, b: object): {
|
|
320
|
+
ratio: number;
|
|
321
|
+
pitchAngles: number[];
|
|
322
|
+
coneDistance: number;
|
|
323
|
+
contact: any;
|
|
324
|
+
findings: any[];
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* The defaults, each with the rule it comes from. Coefficients are times the module.
|
|
328
|
+
* @type {Record<string, { value: number, unit: string, rule: string, kind: string }>}
|
|
329
|
+
*/
|
|
330
|
+
export const DEFAULTS: Record<string, {
|
|
331
|
+
value: number;
|
|
332
|
+
unit: string;
|
|
333
|
+
rule: string;
|
|
334
|
+
kind: string;
|
|
335
|
+
}>;
|
|
336
|
+
/**
|
|
337
|
+
* width up z; chamfer at the bed face (and the top); bore and flat for a shaft
|
|
338
|
+
*/
|
|
339
|
+
export type Solid = {
|
|
340
|
+
width: number;
|
|
341
|
+
chamfer?: number | [number, number];
|
|
342
|
+
bore?: number;
|
|
343
|
+
flat?: number;
|
|
344
|
+
};
|
|
345
|
+
export type GearSpec = {
|
|
346
|
+
module: number;
|
|
347
|
+
teeth: number;
|
|
348
|
+
pressureAngle?: number;
|
|
349
|
+
shift?: number;
|
|
350
|
+
backlash?: number;
|
|
351
|
+
addendum?: number;
|
|
352
|
+
dedendum?: number;
|
|
353
|
+
rootFillet?: number;
|
|
354
|
+
tipRound?: number;
|
|
355
|
+
};
|
|
356
|
+
export type GearModel = {
|
|
357
|
+
kind: "external" | "internal";
|
|
358
|
+
module: number;
|
|
359
|
+
teeth: number;
|
|
360
|
+
/**
|
|
361
|
+
* degrees
|
|
362
|
+
*/
|
|
363
|
+
pressureAngle: number;
|
|
364
|
+
/**
|
|
365
|
+
* times the module
|
|
366
|
+
*/
|
|
367
|
+
shift: number;
|
|
368
|
+
/**
|
|
369
|
+
* mm, this gear's share is half
|
|
370
|
+
*/
|
|
371
|
+
backlash: number;
|
|
372
|
+
/**
|
|
373
|
+
* pitch diameter, module × teeth
|
|
374
|
+
*/
|
|
375
|
+
pitch: number;
|
|
376
|
+
/**
|
|
377
|
+
* base circle diameter
|
|
378
|
+
*/
|
|
379
|
+
base: number;
|
|
380
|
+
/**
|
|
381
|
+
* tip diameter
|
|
382
|
+
*/
|
|
383
|
+
tip: number;
|
|
384
|
+
/**
|
|
385
|
+
* root diameter
|
|
386
|
+
*/
|
|
387
|
+
root: number;
|
|
388
|
+
/**
|
|
389
|
+
* tooth thickness on the pitch circle (an arc, mm), less half the backlash
|
|
390
|
+
*/
|
|
391
|
+
thickness: number;
|
|
392
|
+
/**
|
|
393
|
+
* π × module
|
|
394
|
+
*/
|
|
395
|
+
circularPitch: number;
|
|
396
|
+
/**
|
|
397
|
+
* π × module × cos(pressure angle)
|
|
398
|
+
*/
|
|
399
|
+
basePitch: number;
|
|
400
|
+
/**
|
|
401
|
+
* the tooth's width across its tip (mm)
|
|
402
|
+
*/
|
|
403
|
+
topLand: number;
|
|
404
|
+
/**
|
|
405
|
+
* the tooth's width where it meets the root (mm)
|
|
406
|
+
*/
|
|
407
|
+
rootThickness: number;
|
|
408
|
+
/**
|
|
409
|
+
* the basic rack it was drawn from
|
|
410
|
+
*/
|
|
411
|
+
rack: {
|
|
412
|
+
pressureAngle: number;
|
|
413
|
+
addendum: number;
|
|
414
|
+
dedendum: number;
|
|
415
|
+
rootFillet: number;
|
|
416
|
+
tipRound: number;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
import jscad from '@jscad/modeling';
|