@bitbybit-dev/base 1.5.0-rc.0 → 1.6.0-rc.0
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/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/bearings/ansi-bearings.constants.d.ts +2 -0
- package/lib/api/bearings/ansi-bearings.constants.js +26 -0
- package/lib/api/bearings/ansi-bearings.d.ts +4 -0
- package/lib/api/bearings/ansi-bearings.js +14 -0
- package/lib/api/bearings/bearing-types.d.ts +25 -0
- package/lib/api/bearings/bearing-types.js +1 -0
- package/lib/api/bearings/bearings.constants.d.ts +1 -0
- package/lib/api/bearings/bearings.constants.js +1 -0
- package/lib/api/bearings/iso-bearings.constants.d.ts +2 -0
- package/lib/api/bearings/iso-bearings.constants.js +30 -0
- package/lib/api/bearings/iso-bearings.d.ts +4 -0
- package/lib/api/bearings/iso-bearings.js +14 -0
- package/lib/api/color-space.d.ts +2 -0
- package/lib/api/color-space.js +5 -8
- package/lib/api/fasteners/ansi-fasteners.constants.d.ts +16 -0
- package/lib/api/fasteners/ansi-fasteners.constants.js +118 -0
- package/lib/api/fasteners/ansi-fasteners.d.ts +8 -0
- package/lib/api/fasteners/ansi-fasteners.js +64 -0
- package/lib/api/fasteners/fastener-types.d.ts +161 -0
- package/lib/api/fasteners/fastener-types.js +1 -0
- package/lib/api/fasteners/fasteners.constants.d.ts +5 -0
- package/lib/api/fasteners/fasteners.constants.js +5 -0
- package/lib/api/fasteners/fasteners.d.ts +2 -0
- package/lib/api/fasteners/fasteners.js +9 -0
- package/lib/api/fasteners/iso-fasteners.constants.d.ts +23 -0
- package/lib/api/fasteners/iso-fasteners.constants.js +110 -0
- package/lib/api/fasteners/iso-fasteners.d.ts +9 -0
- package/lib/api/fasteners/iso-fasteners.js +61 -0
- package/lib/api/gears/bevel-gears.d.ts +6 -0
- package/lib/api/gears/bevel-gears.js +69 -0
- package/lib/api/gears/gear-checks.d.ts +8 -0
- package/lib/api/gears/gear-checks.js +69 -0
- package/lib/api/gears/gear-pairs.d.ts +4 -0
- package/lib/api/gears/gear-pairs.js +140 -0
- package/lib/api/gears/gear-types.d.ts +425 -0
- package/lib/api/gears/gear-types.js +1 -0
- package/lib/api/gears/gears.constants.d.ts +19 -0
- package/lib/api/gears/gears.constants.js +19 -0
- package/lib/api/gears/gears.d.ts +10 -0
- package/lib/api/gears/gears.js +156 -0
- package/lib/api/gears/helical-gears.d.ts +5 -0
- package/lib/api/gears/helical-gears.js +33 -0
- package/lib/api/gears/involute-flank.d.ts +26 -0
- package/lib/api/gears/involute-flank.js +158 -0
- package/lib/api/gears/racks.d.ts +3 -0
- package/lib/api/gears/racks.js +64 -0
- package/lib/api/index.d.ts +10 -1
- package/lib/api/index.js +0 -1
- package/lib/api/inputs/base-inputs.d.ts +450 -3
- package/lib/api/inputs/base-inputs.js +12 -0
- package/lib/api/inputs/color-inputs.d.ts +14 -0
- package/lib/api/inputs/color-inputs.js +19 -0
- package/lib/api/inputs/engineering-inputs.d.ts +1539 -0
- package/lib/api/inputs/engineering-inputs.js +2181 -0
- package/lib/api/inputs/index.d.ts +2 -0
- package/lib/api/inputs/index.js +2 -0
- package/lib/api/inputs/io-inputs.d.ts +8 -1
- package/lib/api/inputs/io-inputs.js +4 -1
- package/lib/api/inputs/math-inputs.d.ts +61 -0
- package/lib/api/inputs/math-inputs.js +85 -0
- package/lib/api/inputs/mesh-inputs.d.ts +170 -0
- package/lib/api/inputs/mesh-inputs.js +206 -0
- package/lib/api/inputs/point-inputs.d.ts +4 -4
- package/lib/api/inputs/polyline-inputs.d.ts +144 -0
- package/lib/api/inputs/polyline-inputs.js +151 -0
- package/lib/api/inputs/recipes-inputs.d.ts +76 -0
- package/lib/api/inputs/recipes-inputs.js +74 -0
- package/lib/api/inputs/transforms-inputs.d.ts +34 -0
- package/lib/api/inputs/transforms-inputs.js +35 -0
- package/lib/api/keys/ansi-keys.constants.d.ts +3 -0
- package/lib/api/keys/ansi-keys.constants.js +16 -0
- package/lib/api/keys/ansi-keys.d.ts +3 -0
- package/lib/api/keys/ansi-keys.js +14 -0
- package/lib/api/keys/din-keys.constants.d.ts +3 -0
- package/lib/api/keys/din-keys.constants.js +14 -0
- package/lib/api/keys/din-keys.d.ts +3 -0
- package/lib/api/keys/din-keys.js +13 -0
- package/lib/api/keys/key-types.d.ts +17 -0
- package/lib/api/keys/key-types.js +1 -0
- package/lib/api/keys/keys.constants.d.ts +1 -0
- package/lib/api/keys/keys.constants.js +1 -0
- package/lib/api/knurls/ansi-knurls.constants.d.ts +4 -0
- package/lib/api/knurls/ansi-knurls.constants.js +8 -0
- package/lib/api/knurls/ansi-knurls.d.ts +3 -0
- package/lib/api/knurls/ansi-knurls.js +20 -0
- package/lib/api/knurls/din-knurls.constants.d.ts +2 -0
- package/lib/api/knurls/din-knurls.constants.js +2 -0
- package/lib/api/knurls/din-knurls.d.ts +3 -0
- package/lib/api/knurls/din-knurls.js +19 -0
- package/lib/api/knurls/knurl-types.d.ts +24 -0
- package/lib/api/knurls/knurl-types.js +1 -0
- package/lib/api/knurls/knurls.constants.d.ts +1 -0
- package/lib/api/knurls/knurls.constants.js +1 -0
- package/lib/api/knurls/knurls.d.ts +2 -0
- package/lib/api/knurls/knurls.js +9 -0
- package/lib/api/recipes/checks.d.ts +15 -0
- package/lib/api/recipes/checks.js +85 -0
- package/lib/api/recipes/limits.constants.d.ts +4 -0
- package/lib/api/recipes/limits.constants.js +4 -0
- package/lib/api/recipes/sources.d.ts +0 -13
- package/lib/api/recipes/sources.js +3 -15
- package/lib/api/recipes/surface-mesh.d.ts +0 -14
- package/lib/api/recipes/surface-mesh.js +8 -21
- package/lib/api/recipes/validate-brep.d.ts +2 -0
- package/lib/api/recipes/validate-brep.js +330 -0
- package/lib/api/recipes/validate.d.ts +0 -31
- package/lib/api/recipes/validate.js +7 -115
- package/lib/api/resolved-inputs/index.d.ts +80 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.constants.d.ts +4 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.constants.js +93 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.d.ts +4 -0
- package/lib/api/retaining-rings/ansi-retaining-rings.js +20 -0
- package/lib/api/retaining-rings/din-retaining-rings.constants.d.ts +3 -0
- package/lib/api/retaining-rings/din-retaining-rings.constants.js +115 -0
- package/lib/api/retaining-rings/din-retaining-rings.d.ts +4 -0
- package/lib/api/retaining-rings/din-retaining-rings.js +20 -0
- package/lib/api/retaining-rings/retaining-ring-types.d.ts +30 -0
- package/lib/api/retaining-rings/retaining-ring-types.js +1 -0
- package/lib/api/retaining-rings/retaining-rings.constants.d.ts +1 -0
- package/lib/api/retaining-rings/retaining-rings.constants.js +1 -0
- package/lib/api/retaining-rings/retaining-rings.d.ts +2 -0
- package/lib/api/retaining-rings/retaining-rings.js +9 -0
- package/lib/api/services/base-bitbybit.d.ts +42 -0
- package/lib/api/services/base-bitbybit.js +43 -0
- package/lib/api/services/color.d.ts +35 -2
- package/lib/api/services/color.js +48 -12
- package/lib/api/services/engineering/engineering.d.ts +12 -0
- package/lib/api/services/engineering/engineering.js +13 -0
- package/lib/api/services/engineering/index.d.ts +2 -0
- package/lib/api/services/engineering/index.js +2 -0
- package/lib/api/services/engineering/mechanical/bearings-ansi.d.ts +40 -0
- package/lib/api/services/engineering/mechanical/bearings-ansi.js +47 -0
- package/lib/api/services/engineering/mechanical/bearings-iso.d.ts +39 -0
- package/lib/api/services/engineering/mechanical/bearings-iso.js +46 -0
- package/lib/api/services/engineering/mechanical/bearings.d.ts +14 -0
- package/lib/api/services/engineering/mechanical/bearings.js +15 -0
- package/lib/api/services/engineering/mechanical/fasteners-ansi.d.ts +109 -0
- package/lib/api/services/engineering/mechanical/fasteners-ansi.js +133 -0
- package/lib/api/services/engineering/mechanical/fasteners-iso.d.ts +123 -0
- package/lib/api/services/engineering/mechanical/fasteners-iso.js +151 -0
- package/lib/api/services/engineering/mechanical/fasteners.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/fasteners.js +14 -0
- package/lib/api/services/engineering/mechanical/gears.d.ts +267 -0
- package/lib/api/services/engineering/mechanical/gears.js +318 -0
- package/lib/api/services/engineering/mechanical/index.d.ts +24 -0
- package/lib/api/services/engineering/mechanical/index.js +24 -0
- package/lib/api/services/engineering/mechanical/keys-ansi.d.ts +27 -0
- package/lib/api/services/engineering/mechanical/keys-ansi.js +32 -0
- package/lib/api/services/engineering/mechanical/keys-din.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/keys-din.js +31 -0
- package/lib/api/services/engineering/mechanical/keys.d.ts +14 -0
- package/lib/api/services/engineering/mechanical/keys.js +15 -0
- package/lib/api/services/engineering/mechanical/knurls-ansi.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/knurls-ansi.js +31 -0
- package/lib/api/services/engineering/mechanical/knurls-din.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/knurls-din.js +31 -0
- package/lib/api/services/engineering/mechanical/knurls.d.ts +14 -0
- package/lib/api/services/engineering/mechanical/knurls.js +15 -0
- package/lib/api/services/engineering/mechanical/mechanical.d.ts +29 -0
- package/lib/api/services/engineering/mechanical/mechanical.js +30 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-ansi.d.ts +43 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-ansi.js +51 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-din.d.ts +43 -0
- package/lib/api/services/engineering/mechanical/retaining-rings-din.js +51 -0
- package/lib/api/services/engineering/mechanical/retaining-rings.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/retaining-rings.js +14 -0
- package/lib/api/services/engineering/mechanical/splines-ansi.d.ts +27 -0
- package/lib/api/services/engineering/mechanical/splines-ansi.js +32 -0
- package/lib/api/services/engineering/mechanical/splines-din.d.ts +26 -0
- package/lib/api/services/engineering/mechanical/splines-din.js +31 -0
- package/lib/api/services/engineering/mechanical/splines.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/splines.js +14 -0
- package/lib/api/services/engineering/mechanical/springs.d.ts +27 -0
- package/lib/api/services/engineering/mechanical/springs.js +31 -0
- package/lib/api/services/engineering/mechanical/threads-ansi.d.ts +40 -0
- package/lib/api/services/engineering/mechanical/threads-ansi.js +48 -0
- package/lib/api/services/engineering/mechanical/threads-iso.d.ts +40 -0
- package/lib/api/services/engineering/mechanical/threads-iso.js +48 -0
- package/lib/api/services/engineering/mechanical/threads.d.ts +13 -0
- package/lib/api/services/engineering/mechanical/threads.js +14 -0
- package/lib/api/services/frame.js +3 -3
- package/lib/api/services/geometry-helper.js +8 -111
- package/lib/api/services/helpers/color/color-space.d.ts +2 -0
- package/lib/api/services/helpers/color/color-space.js +12 -0
- package/lib/api/services/helpers/{nurbs.d.ts → curves/nurbs.d.ts} +1 -1
- package/lib/api/services/helpers/{surface-triangulation.d.ts → curves/surface-triangulation.d.ts} +2 -2
- package/lib/api/services/helpers/{surface-triangulation.js → curves/surface-triangulation.js} +14 -8
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.d.ts +2 -1
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.js +19 -5
- package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +4 -0
- package/lib/api/services/helpers/files/dxf/dxf.constants.js +4 -0
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf.d.ts +1 -1
- package/lib/api/services/helpers/{dxf → files/dxf}/dxf.js +2 -2
- package/lib/api/services/helpers/files/glb.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/glb.constants.js +11 -0
- package/lib/api/services/helpers/files/glb.d.ts +1 -0
- package/lib/api/services/helpers/files/glb.js +69 -0
- package/lib/api/services/helpers/files/gzip.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/gzip.constants.js +11 -0
- package/lib/api/services/helpers/files/gzip.d.ts +2 -0
- package/lib/api/services/helpers/files/gzip.js +52 -0
- package/lib/api/services/helpers/{inflate.constants.d.ts → files/inflate.constants.d.ts} +1 -0
- package/lib/api/services/helpers/{inflate.constants.js → files/inflate.constants.js} +1 -0
- package/lib/api/services/helpers/{inflate.d.ts → files/inflate.d.ts} +1 -1
- package/lib/api/services/helpers/{inflate.js → files/inflate.js} +5 -4
- package/lib/api/services/helpers/{zip.d.ts → files/zip.d.ts} +1 -1
- package/lib/api/services/helpers/geometry/arcs.d.ts +9 -0
- package/lib/api/services/helpers/{arcs.js → geometry/arcs.js} +7 -0
- package/lib/api/services/helpers/{frame-axes.d.ts → geometry/frame-axes.d.ts} +8 -5
- package/lib/api/services/helpers/{frame-axes.js → geometry/frame-axes.js} +21 -9
- package/lib/api/services/helpers/geometry/lengths.constants.d.ts +4 -0
- package/lib/api/services/helpers/geometry/lengths.constants.js +3 -0
- package/lib/api/services/helpers/geometry/lengths.d.ts +7 -0
- package/lib/api/services/helpers/geometry/lengths.js +20 -0
- package/lib/api/services/helpers/geometry/matrices.constants.d.ts +8 -0
- package/lib/api/services/helpers/geometry/matrices.constants.js +7 -0
- package/lib/api/services/helpers/geometry/matrices.d.ts +17 -0
- package/lib/api/services/helpers/{matrices.js → geometry/matrices.js} +28 -17
- package/lib/api/services/helpers/{paths.d.ts → geometry/paths.d.ts} +2 -1
- package/lib/api/services/helpers/{paths.js → geometry/paths.js} +36 -30
- package/lib/api/services/helpers/{polygons.d.ts → geometry/polygons.d.ts} +1 -1
- package/lib/api/services/helpers/geometry/polygons.js +111 -0
- package/lib/api/services/helpers/geometry/scalars.d.ts +9 -0
- package/lib/api/services/helpers/geometry/scalars.js +34 -0
- package/lib/api/services/helpers/{triangulation.js → geometry/triangulation.js} +11 -6
- package/lib/api/services/helpers/geometry/vector-grid.d.ts +12 -0
- package/lib/api/services/helpers/geometry/vector-grid.js +149 -0
- package/lib/api/services/helpers/{vectors.d.ts → geometry/vectors.d.ts} +8 -1
- package/lib/api/services/helpers/geometry/vectors.js +43 -0
- package/lib/api/services/helpers/helper-types.d.ts +57 -0
- package/lib/api/services/helpers/mesh/mesh-normals.d.ts +21 -0
- package/lib/api/services/helpers/{mesh-normals.js → mesh/mesh-normals.js} +54 -65
- package/lib/api/services/helpers/mesh/mesh-orientation.d.ts +24 -0
- package/lib/api/services/helpers/mesh/mesh-orientation.js +104 -0
- package/lib/api/services/helpers/{mesh-primitives.d.ts → mesh/mesh-primitives.d.ts} +1 -1
- package/lib/api/services/helpers/{mesh-primitives.js → mesh/mesh-primitives.js} +6 -5
- package/lib/api/services/helpers/mesh/mesh-proximity.constants.d.ts +7 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.constants.js +11 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.d.ts +11 -0
- package/lib/api/services/helpers/mesh/mesh-proximity.js +382 -0
- package/lib/api/services/index.d.ts +3 -0
- package/lib/api/services/index.js +3 -0
- package/lib/api/services/io.d.ts +1 -1
- package/lib/api/services/io.js +1 -1
- package/lib/api/services/line.js +2 -3
- package/lib/api/services/math.d.ts +47 -0
- package/lib/api/services/math.js +77 -10
- package/lib/api/services/mesh.d.ts +174 -2
- package/lib/api/services/mesh.js +305 -7
- package/lib/api/services/point.js +4 -10
- package/lib/api/services/polyline-types.d.ts +6 -0
- package/lib/api/services/polyline-types.js +1 -0
- package/lib/api/services/polyline.d.ts +163 -1
- package/lib/api/services/polyline.js +270 -13
- package/lib/api/services/recipes.d.ts +80 -0
- package/lib/api/services/recipes.js +107 -0
- package/lib/api/services/transforms.d.ts +74 -2
- package/lib/api/services/transforms.js +100 -3
- package/lib/api/services/vector.d.ts +4 -3
- package/lib/api/services/vector.js +14 -14
- package/lib/api/splines/ansi-splines.constants.d.ts +9 -0
- package/lib/api/splines/ansi-splines.constants.js +9 -0
- package/lib/api/splines/ansi-splines.d.ts +3 -0
- package/lib/api/splines/ansi-splines.js +28 -0
- package/lib/api/splines/din-splines.constants.d.ts +12 -0
- package/lib/api/splines/din-splines.constants.js +12 -0
- package/lib/api/splines/din-splines.d.ts +3 -0
- package/lib/api/splines/din-splines.js +38 -0
- package/lib/api/splines/spline-types.d.ts +32 -0
- package/lib/api/splines/spline-types.js +1 -0
- package/lib/api/splines/splines.constants.d.ts +1 -0
- package/lib/api/splines/splines.constants.js +1 -0
- package/lib/api/springs/spring-types.d.ts +26 -0
- package/lib/api/springs/spring-types.js +1 -0
- package/lib/api/springs/springs.constants.d.ts +9 -0
- package/lib/api/springs/springs.constants.js +9 -0
- package/lib/api/springs/springs.d.ts +2 -0
- package/lib/api/springs/springs.js +50 -0
- package/lib/api/threads/ansi-threads.constants.d.ts +6 -0
- package/lib/api/threads/ansi-threads.constants.js +27 -0
- package/lib/api/threads/ansi-threads.d.ts +4 -0
- package/lib/api/threads/ansi-threads.js +50 -0
- package/lib/api/threads/iso-threads.constants.d.ts +5 -0
- package/lib/api/threads/iso-threads.constants.js +20 -0
- package/lib/api/threads/iso-threads.d.ts +4 -0
- package/lib/api/threads/iso-threads.js +32 -0
- package/lib/api/threads/thread-profile.constants.d.ts +3 -0
- package/lib/api/threads/thread-profile.constants.js +3 -0
- package/lib/api/threads/thread-types.d.ts +66 -0
- package/lib/api/threads/thread-types.js +1 -0
- package/package.json +1 -1
- package/lib/api/recipes/index.d.ts +0 -4
- package/lib/api/recipes/index.js +0 -3
- package/lib/api/services/helpers/arcs.d.ts +0 -6
- package/lib/api/services/helpers/matrices.constants.d.ts +0 -2
- package/lib/api/services/helpers/matrices.constants.js +0 -2
- package/lib/api/services/helpers/matrices.d.ts +0 -25
- package/lib/api/services/helpers/mesh-normals.d.ts +0 -11
- package/lib/api/services/helpers/polygons.js +0 -59
- package/lib/api/services/helpers/vectors.js +0 -17
- /package/lib/api/services/helpers/{nurbs.js → curves/nurbs.js} +0 -0
- /package/lib/api/services/helpers/{crc32.d.ts → files/crc32.d.ts} +0 -0
- /package/lib/api/services/helpers/{crc32.js → files/crc32.js} +0 -0
- /package/lib/api/services/helpers/{zip.constants.d.ts → files/zip.constants.d.ts} +0 -0
- /package/lib/api/services/helpers/{zip.constants.js → files/zip.constants.js} +0 -0
- /package/lib/api/services/helpers/{zip.js → files/zip.js} +0 -0
- /package/lib/api/services/helpers/{triangulation.d.ts → geometry/triangulation.d.ts} +0 -0
- /package/lib/api/services/helpers/{mesh-measures.d.ts → mesh/mesh-measures.d.ts} +0 -0
- /package/lib/api/services/helpers/{mesh-measures.js → mesh/mesh-measures.js} +0 -0
- /package/lib/api/services/helpers/{mesh-primitives.constants.d.ts → mesh/mesh-primitives.constants.d.ts} +0 -0
- /package/lib/api/services/helpers/{mesh-primitives.constants.js → mesh/mesh-primitives.constants.js} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IsoThreadSize } from "../threads/thread-types";
|
|
2
|
+
import type { ClearanceRow, HexRow, IsoSetScrewRow, ScrewHeadRow, WasherSizes } from "./fastener-types";
|
|
3
|
+
export declare const CLEARANCE_HOLES: Readonly<Record<IsoThreadSize, ClearanceRow>>;
|
|
4
|
+
export declare const SOCKET_HEAD_CAP_SCREWS: Readonly<Record<IsoThreadSize, ScrewHeadRow>>;
|
|
5
|
+
export declare const HEX_BOLT_HEADS: Readonly<Record<IsoThreadSize, HexRow>>;
|
|
6
|
+
export declare const HEX_NUTS: Readonly<Record<IsoThreadSize, HexRow>>;
|
|
7
|
+
export declare const PLAIN_WASHERS: Readonly<Record<IsoThreadSize, WasherSizes>>;
|
|
8
|
+
export declare const SET_SCREWS: Readonly<Partial<Record<IsoThreadSize, IsoSetScrewRow>>>;
|
|
9
|
+
export declare const SCREW_THREAD_EXTRA = 12;
|
|
10
|
+
export declare const COUNTERBORE_SINK = 0.5;
|
|
11
|
+
export declare const BOLT_THREAD_EXTRA_SHORT = 6;
|
|
12
|
+
export declare const BOLT_THREAD_EXTRA_MEDIUM = 12;
|
|
13
|
+
export declare const BOLT_THREAD_EXTRA_LONG = 25;
|
|
14
|
+
export declare const BOLT_LENGTH_SHORT = 125;
|
|
15
|
+
export declare const BOLT_LENGTH_MEDIUM = 200;
|
|
16
|
+
export declare const POINT_CHAMFER_ANGLE = 90;
|
|
17
|
+
export declare const CONE_SHORT_ANGLE = 120;
|
|
18
|
+
export declare const CONE_LONG_ANGLE = 90;
|
|
19
|
+
export declare const CUP_ANGLE = 120;
|
|
20
|
+
export declare const WASHER_CHAMFER_SHARE = 0.25;
|
|
21
|
+
export declare const WASHER_CHAMFER_ANGLE = 30;
|
|
22
|
+
export declare const SMALLEST_CHAMFERED_WASHER = 5;
|
|
23
|
+
export declare const CHAMFERED_WASHER_LENGTHS: readonly ["innerDiameter", "outerDiameter", "thickness", "chamferHeight", "chamferWidth"];
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export const CLEARANCE_HOLES = {
|
|
2
|
+
"M1.6": { close: 1.7, normal: 1.8, loose: 2 },
|
|
3
|
+
"M2": { close: 2.2, normal: 2.4, loose: 2.6 },
|
|
4
|
+
"M2.5": { close: 2.7, normal: 2.9, loose: 3.1 },
|
|
5
|
+
"M3": { close: 3.2, normal: 3.4, loose: 3.6 },
|
|
6
|
+
"M4": { close: 4.3, normal: 4.5, loose: 4.8 },
|
|
7
|
+
"M5": { close: 5.3, normal: 5.5, loose: 5.8 },
|
|
8
|
+
"M6": { close: 6.4, normal: 6.6, loose: 7 },
|
|
9
|
+
"M8": { close: 8.4, normal: 9, loose: 10 },
|
|
10
|
+
"M10": { close: 10.5, normal: 11, loose: 12 },
|
|
11
|
+
"M12": { close: 13, normal: 13.5, loose: 14.5 },
|
|
12
|
+
"M14": { close: 15, normal: 15.5, loose: 16.5 },
|
|
13
|
+
"M16": { close: 17, normal: 17.5, loose: 18.5 },
|
|
14
|
+
"M20": { close: 21, normal: 22, loose: 24 },
|
|
15
|
+
"M24": { close: 25, normal: 26, loose: 28 },
|
|
16
|
+
};
|
|
17
|
+
export const SOCKET_HEAD_CAP_SCREWS = {
|
|
18
|
+
"M1.6": { headDiameter: 3, headHeight: 1.6, socketSize: 1.5, socketDepth: 0.7, counterboreDiameter: 3.5 },
|
|
19
|
+
"M2": { headDiameter: 3.8, headHeight: 2, socketSize: 1.5, socketDepth: 1, counterboreDiameter: 4.4 },
|
|
20
|
+
"M2.5": { headDiameter: 4.5, headHeight: 2.5, socketSize: 2, socketDepth: 1.1, counterboreDiameter: 5.5 },
|
|
21
|
+
"M3": { headDiameter: 5.5, headHeight: 3, socketSize: 2.5, socketDepth: 1.3, counterboreDiameter: 6.5 },
|
|
22
|
+
"M4": { headDiameter: 7, headHeight: 4, socketSize: 3, socketDepth: 2, counterboreDiameter: 8 },
|
|
23
|
+
"M5": { headDiameter: 8.5, headHeight: 5, socketSize: 4, socketDepth: 2.5, counterboreDiameter: 10 },
|
|
24
|
+
"M6": { headDiameter: 10, headHeight: 6, socketSize: 5, socketDepth: 3, counterboreDiameter: 11 },
|
|
25
|
+
"M8": { headDiameter: 13, headHeight: 8, socketSize: 6, socketDepth: 4, counterboreDiameter: 15 },
|
|
26
|
+
"M10": { headDiameter: 16, headHeight: 10, socketSize: 8, socketDepth: 5, counterboreDiameter: 18 },
|
|
27
|
+
"M12": { headDiameter: 18, headHeight: 12, socketSize: 10, socketDepth: 6, counterboreDiameter: 20 },
|
|
28
|
+
"M14": { headDiameter: 21, headHeight: 14, socketSize: 12, socketDepth: 7, counterboreDiameter: 24 },
|
|
29
|
+
"M16": { headDiameter: 24, headHeight: 16, socketSize: 14, socketDepth: 8, counterboreDiameter: 26 },
|
|
30
|
+
"M20": { headDiameter: 30, headHeight: 20, socketSize: 17, socketDepth: 10, counterboreDiameter: 33 },
|
|
31
|
+
"M24": { headDiameter: 36, headHeight: 24, socketSize: 19, socketDepth: 12, counterboreDiameter: 40 },
|
|
32
|
+
};
|
|
33
|
+
export const HEX_BOLT_HEADS = {
|
|
34
|
+
"M1.6": { acrossFlats: 3.2, height: 1.1 },
|
|
35
|
+
"M2": { acrossFlats: 4, height: 1.4 },
|
|
36
|
+
"M2.5": { acrossFlats: 5, height: 1.7 },
|
|
37
|
+
"M3": { acrossFlats: 5.5, height: 2 },
|
|
38
|
+
"M4": { acrossFlats: 7, height: 2.8 },
|
|
39
|
+
"M5": { acrossFlats: 8, height: 3.5 },
|
|
40
|
+
"M6": { acrossFlats: 10, height: 4 },
|
|
41
|
+
"M8": { acrossFlats: 13, height: 5.3 },
|
|
42
|
+
"M10": { acrossFlats: 16, height: 6.4 },
|
|
43
|
+
"M12": { acrossFlats: 18, height: 7.5 },
|
|
44
|
+
"M14": { acrossFlats: 21, height: 8.8 },
|
|
45
|
+
"M16": { acrossFlats: 24, height: 10 },
|
|
46
|
+
"M20": { acrossFlats: 30, height: 12.5 },
|
|
47
|
+
"M24": { acrossFlats: 36, height: 15 },
|
|
48
|
+
};
|
|
49
|
+
export const HEX_NUTS = {
|
|
50
|
+
"M1.6": { acrossFlats: 3.2, height: 1.3 },
|
|
51
|
+
"M2": { acrossFlats: 4, height: 1.6 },
|
|
52
|
+
"M2.5": { acrossFlats: 5, height: 2 },
|
|
53
|
+
"M3": { acrossFlats: 5.5, height: 2.4 },
|
|
54
|
+
"M4": { acrossFlats: 7, height: 3.2 },
|
|
55
|
+
"M5": { acrossFlats: 8, height: 4.7 },
|
|
56
|
+
"M6": { acrossFlats: 10, height: 5.2 },
|
|
57
|
+
"M8": { acrossFlats: 13, height: 6.8 },
|
|
58
|
+
"M10": { acrossFlats: 16, height: 8.4 },
|
|
59
|
+
"M12": { acrossFlats: 18, height: 10.8 },
|
|
60
|
+
"M14": { acrossFlats: 21, height: 12.8 },
|
|
61
|
+
"M16": { acrossFlats: 24, height: 14.8 },
|
|
62
|
+
"M20": { acrossFlats: 30, height: 18 },
|
|
63
|
+
"M24": { acrossFlats: 36, height: 21.5 },
|
|
64
|
+
};
|
|
65
|
+
export const PLAIN_WASHERS = {
|
|
66
|
+
"M1.6": { innerDiameter: 1.7, outerDiameter: 4, thickness: 0.3 },
|
|
67
|
+
"M2": { innerDiameter: 2.2, outerDiameter: 5, thickness: 0.3 },
|
|
68
|
+
"M2.5": { innerDiameter: 2.7, outerDiameter: 6, thickness: 0.5 },
|
|
69
|
+
"M3": { innerDiameter: 3.2, outerDiameter: 7, thickness: 0.5 },
|
|
70
|
+
"M4": { innerDiameter: 4.3, outerDiameter: 9, thickness: 0.8 },
|
|
71
|
+
"M5": { innerDiameter: 5.3, outerDiameter: 10, thickness: 1 },
|
|
72
|
+
"M6": { innerDiameter: 6.4, outerDiameter: 12, thickness: 1.6 },
|
|
73
|
+
"M8": { innerDiameter: 8.4, outerDiameter: 16, thickness: 1.6 },
|
|
74
|
+
"M10": { innerDiameter: 10.5, outerDiameter: 20, thickness: 2 },
|
|
75
|
+
"M12": { innerDiameter: 13, outerDiameter: 24, thickness: 2.5 },
|
|
76
|
+
"M14": { innerDiameter: 15, outerDiameter: 28, thickness: 2.5 },
|
|
77
|
+
"M16": { innerDiameter: 17, outerDiameter: 30, thickness: 3 },
|
|
78
|
+
"M20": { innerDiameter: 21, outerDiameter: 37, thickness: 3 },
|
|
79
|
+
"M24": { innerDiameter: 25, outerDiameter: 44, thickness: 4 },
|
|
80
|
+
};
|
|
81
|
+
export const SET_SCREWS = {
|
|
82
|
+
"M1.6": { key: 0.7, depthShort: 0.7, depthLong: 1.5, flat: { diameter: 0.8, shortUpTo: 2 }, cone: { diameter: 0.4, shortUpTo: 2.5 }, dog: { diameter: 0.8, shortUpTo: 2.5, lengthShort: 0.4, lengthLong: 0.8 }, cup: { diameter: 0.8, shortUpTo: 2 } },
|
|
83
|
+
"M2": { key: 0.9, depthShort: 0.8, depthLong: 1.7, flat: { diameter: 1, shortUpTo: 3 }, cone: { diameter: 0.5, shortUpTo: 3 }, dog: { diameter: 1, shortUpTo: 3, lengthShort: 0.5, lengthLong: 1 }, cup: { diameter: 1, shortUpTo: 2.5 } },
|
|
84
|
+
"M2.5": { key: 1.3, depthShort: 1.2, depthLong: 2, flat: { diameter: 1.5, shortUpTo: 3 }, cone: { diameter: 0.65, shortUpTo: 3 }, dog: { diameter: 1.5, shortUpTo: 4, lengthShort: 0.63, lengthLong: 1.25 }, cup: { diameter: 1.2, shortUpTo: 3 } },
|
|
85
|
+
"M3": { key: 1.5, depthShort: 1.2, depthLong: 2, flat: { diameter: 2, shortUpTo: 3 }, cone: { diameter: 0.75, shortUpTo: 4 }, dog: { diameter: 2, shortUpTo: 5, lengthShort: 0.75, lengthLong: 1.5 }, cup: { diameter: 1.4, shortUpTo: 4 } },
|
|
86
|
+
"M4": { key: 2, depthShort: 1.5, depthLong: 2.5, flat: { diameter: 2.5, shortUpTo: 4 }, cone: { diameter: 1, shortUpTo: 5 }, dog: { diameter: 2.5, shortUpTo: 6, lengthShort: 1, lengthLong: 2 }, cup: { diameter: 2, shortUpTo: 5 } },
|
|
87
|
+
"M5": { key: 2.5, depthShort: 2, depthLong: 3, flat: { diameter: 3.5, shortUpTo: 5 }, cone: { diameter: 1.25, shortUpTo: 6 }, dog: { diameter: 3.5, shortUpTo: 6, lengthShort: 1.25, lengthLong: 2.5 }, cup: { diameter: 2.5, shortUpTo: 5 } },
|
|
88
|
+
"M6": { key: 3, depthShort: 2, depthLong: 3.5, flat: { diameter: 4, shortUpTo: 6 }, cone: { diameter: 1.5, shortUpTo: 6 }, dog: { diameter: 4, shortUpTo: 8, lengthShort: 1.5, lengthLong: 3 }, cup: { diameter: 3, shortUpTo: 6 } },
|
|
89
|
+
"M8": { key: 4, depthShort: 3, depthLong: 5, flat: { diameter: 5.5, shortUpTo: 8 }, cone: { diameter: 2, shortUpTo: 8 }, dog: { diameter: 5.5, shortUpTo: 10, lengthShort: 2, lengthLong: 4 }, cup: { diameter: 5, shortUpTo: 8 } },
|
|
90
|
+
"M10": { key: 5, depthShort: 4, depthLong: 6, flat: { diameter: 7, shortUpTo: 10 }, cone: { diameter: 2.5, shortUpTo: 10 }, dog: { diameter: 7, shortUpTo: 12, lengthShort: 2.5, lengthLong: 5 }, cup: { diameter: 6, shortUpTo: 10 } },
|
|
91
|
+
"M12": { key: 6, depthShort: 4.8, depthLong: 8, flat: { diameter: 8.5, shortUpTo: 12 }, cone: { diameter: 3, shortUpTo: 12 }, dog: { diameter: 8.5, shortUpTo: 16, lengthShort: 3, lengthLong: 6 }, cup: { diameter: 8, shortUpTo: 12 } },
|
|
92
|
+
"M16": { key: 8, depthShort: 6.4, depthLong: 10, flat: { diameter: 12, shortUpTo: 16 }, cone: { diameter: 4, shortUpTo: 16 }, dog: { diameter: 12, shortUpTo: 20, lengthShort: 4, lengthLong: 8 }, cup: { diameter: 10, shortUpTo: 16 } },
|
|
93
|
+
"M20": { key: 10, depthShort: 8, depthLong: 12, flat: { diameter: 15, shortUpTo: 20 }, cone: { diameter: 5, shortUpTo: 20 }, dog: { diameter: 15, shortUpTo: 25, lengthShort: 5, lengthLong: 10 }, cup: { diameter: 14, shortUpTo: 20 } },
|
|
94
|
+
"M24": { key: 12, depthShort: 10, depthLong: 15, flat: { diameter: 18, shortUpTo: 25 }, cone: { diameter: 6, shortUpTo: 25 }, dog: { diameter: 18, shortUpTo: 30, lengthShort: 6, lengthLong: 12 }, cup: { diameter: 16, shortUpTo: 25 } },
|
|
95
|
+
};
|
|
96
|
+
export const SCREW_THREAD_EXTRA = 12;
|
|
97
|
+
export const COUNTERBORE_SINK = 0.5;
|
|
98
|
+
export const BOLT_THREAD_EXTRA_SHORT = 6;
|
|
99
|
+
export const BOLT_THREAD_EXTRA_MEDIUM = 12;
|
|
100
|
+
export const BOLT_THREAD_EXTRA_LONG = 25;
|
|
101
|
+
export const BOLT_LENGTH_SHORT = 125;
|
|
102
|
+
export const BOLT_LENGTH_MEDIUM = 200;
|
|
103
|
+
export const POINT_CHAMFER_ANGLE = 90;
|
|
104
|
+
export const CONE_SHORT_ANGLE = 120;
|
|
105
|
+
export const CONE_LONG_ANGLE = 90;
|
|
106
|
+
export const CUP_ANGLE = 120;
|
|
107
|
+
export const WASHER_CHAMFER_SHARE = 0.25;
|
|
108
|
+
export const WASHER_CHAMFER_ANGLE = 30;
|
|
109
|
+
export const SMALLEST_CHAMFERED_WASHER = 5;
|
|
110
|
+
export const CHAMFERED_WASHER_LENGTHS = ["innerDiameter", "outerDiameter", "thickness", "chamferHeight", "chamferWidth"];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IsoThreadSize } from "../threads/thread-types";
|
|
2
|
+
import type { ChamferedWasherSizes, ClearanceFit, HexBoltSizes, HexNutSizes, IsoSetScrewPoint, SetScrewSizes, SocketHeadCapScrewSizes, WasherSizes } from "./fastener-types";
|
|
3
|
+
export declare function isoClearanceHoleDiameter(size: IsoThreadSize, fit: ClearanceFit): number;
|
|
4
|
+
export declare function isoSocketHeadCapScrewSizes(size: IsoThreadSize): SocketHeadCapScrewSizes;
|
|
5
|
+
export declare function isoHexBoltSizes(size: IsoThreadSize, length: number): HexBoltSizes;
|
|
6
|
+
export declare function isoHexNutSizes(size: IsoThreadSize): HexNutSizes;
|
|
7
|
+
export declare function isoWasherSizes(size: IsoThreadSize): WasherSizes;
|
|
8
|
+
export declare function isoSetScrewSizes(size: IsoThreadSize, point: IsoSetScrewPoint, length?: number): SetScrewSizes;
|
|
9
|
+
export declare function isoChamferedWasherSizes(size: IsoThreadSize): ChamferedWasherSizes;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as Inputs from "../inputs";
|
|
2
|
+
import { radiansOf, roundedToMillionths } from "../services/helpers/geometry/scalars";
|
|
3
|
+
import { InputError } from "../kernel-calls/errors";
|
|
4
|
+
import { checkedIsoSize, isoThread } from "../threads/iso-threads";
|
|
5
|
+
import { COARSE_THREADS } from "../threads/iso-threads.constants";
|
|
6
|
+
import { checkedFit } from "./fasteners";
|
|
7
|
+
import { BOLT_LENGTH_MEDIUM, BOLT_LENGTH_SHORT, BOLT_THREAD_EXTRA_LONG, BOLT_THREAD_EXTRA_MEDIUM, BOLT_THREAD_EXTRA_SHORT, CLEARANCE_HOLES, CONE_LONG_ANGLE, CONE_SHORT_ANGLE, COUNTERBORE_SINK, CUP_ANGLE, HEX_BOLT_HEADS, HEX_NUTS, PLAIN_WASHERS, POINT_CHAMFER_ANGLE, SCREW_THREAD_EXTRA, SET_SCREWS, SMALLEST_CHAMFERED_WASHER, SOCKET_HEAD_CAP_SCREWS, WASHER_CHAMFER_ANGLE, WASHER_CHAMFER_SHARE, } from "./iso-fasteners.constants";
|
|
8
|
+
const POINTS = Object.values(Inputs.Engineering.isoSetScrewPointEnum);
|
|
9
|
+
export function isoClearanceHoleDiameter(size, fit) {
|
|
10
|
+
return CLEARANCE_HOLES[checkedIsoSize(size)][checkedFit(fit)];
|
|
11
|
+
}
|
|
12
|
+
export function isoSocketHeadCapScrewSizes(size) {
|
|
13
|
+
const row = SOCKET_HEAD_CAP_SCREWS[checkedIsoSize(size)];
|
|
14
|
+
return Object.assign(Object.assign({}, row), { threadLength: Math.round(2 * COARSE_THREADS[size].diameter + SCREW_THREAD_EXTRA), counterboreDepth: roundedToMillionths(row.headHeight + COUNTERBORE_SINK) });
|
|
15
|
+
}
|
|
16
|
+
export function isoHexBoltSizes(size, length) {
|
|
17
|
+
const row = HEX_BOLT_HEADS[checkedIsoSize(size)];
|
|
18
|
+
if (!(length > 0)) {
|
|
19
|
+
throw new InputError("`length` is not more than 0.", "length");
|
|
20
|
+
}
|
|
21
|
+
const extra = length <= BOLT_LENGTH_SHORT ? BOLT_THREAD_EXTRA_SHORT : length <= BOLT_LENGTH_MEDIUM ? BOLT_THREAD_EXTRA_MEDIUM : BOLT_THREAD_EXTRA_LONG;
|
|
22
|
+
return { acrossFlats: row.acrossFlats, headHeight: row.height, threadLength: 2 * COARSE_THREADS[size].diameter + extra };
|
|
23
|
+
}
|
|
24
|
+
export function isoHexNutSizes(size) {
|
|
25
|
+
const row = HEX_NUTS[checkedIsoSize(size)];
|
|
26
|
+
return { acrossFlats: row.acrossFlats, height: row.height };
|
|
27
|
+
}
|
|
28
|
+
export function isoWasherSizes(size) {
|
|
29
|
+
return Object.assign({}, PLAIN_WASHERS[checkedIsoSize(size)]);
|
|
30
|
+
}
|
|
31
|
+
export function isoSetScrewSizes(size, point, length = Infinity) {
|
|
32
|
+
const row = SET_SCREWS[checkedIsoSize(size)];
|
|
33
|
+
if (row === undefined) {
|
|
34
|
+
throw new InputError(`\`size\` is ${size}, which ISO 4026 to 4029 give no set screw for.`, "size");
|
|
35
|
+
}
|
|
36
|
+
if (!POINTS.includes(point)) {
|
|
37
|
+
throw new InputError(`\`point\` is not one of ${POINTS.join(", ")}.`, "point");
|
|
38
|
+
}
|
|
39
|
+
const minorDiameter = isoThread(size).minorDiameter;
|
|
40
|
+
const shape = row[point];
|
|
41
|
+
const short = length <= shape.shortUpTo;
|
|
42
|
+
const socket = { socketSize: row.key, socketDepth: short ? row.depthShort : row.depthLong, pointDiameter: shape.diameter, shortUpTo: shape.shortUpTo };
|
|
43
|
+
const chamfer = (minorDiameter - shape.diameter) / 2;
|
|
44
|
+
if (point === "cone") {
|
|
45
|
+
const angle = short ? CONE_SHORT_ANGLE : CONE_LONG_ANGLE;
|
|
46
|
+
return Object.assign(Object.assign({}, socket), { pointLength: roundedToMillionths(chamfer / Math.tan(radiansOf(angle / 2))), pointAngle: angle, pointRadius: 0 });
|
|
47
|
+
}
|
|
48
|
+
if (point === "cup") {
|
|
49
|
+
return Object.assign(Object.assign({}, socket), { pointLength: roundedToMillionths(shape.diameter / 2 / Math.tan(radiansOf(CUP_ANGLE / 2))), pointAngle: CUP_ANGLE, pointRadius: 0 });
|
|
50
|
+
}
|
|
51
|
+
const dog = point === "dog" ? (short ? row.dog.lengthShort : row.dog.lengthLong) : 0;
|
|
52
|
+
return Object.assign(Object.assign({}, socket), { pointLength: roundedToMillionths(chamfer + dog), pointAngle: POINT_CHAMFER_ANGLE, pointRadius: 0 });
|
|
53
|
+
}
|
|
54
|
+
export function isoChamferedWasherSizes(size) {
|
|
55
|
+
const washer = isoWasherSizes(size);
|
|
56
|
+
if (COARSE_THREADS[size].diameter < SMALLEST_CHAMFERED_WASHER) {
|
|
57
|
+
throw new InputError(`\`size\` is ${size}; ISO 7090 starts at M${String(SMALLEST_CHAMFERED_WASHER)}.`, "size");
|
|
58
|
+
}
|
|
59
|
+
const chamferHeight = washer.thickness * WASHER_CHAMFER_SHARE;
|
|
60
|
+
return Object.assign(Object.assign({}, washer), { chamferHeight, chamferWidth: roundedToMillionths(chamferHeight * Math.tan(radiansOf(WASHER_CHAMFER_ANGLE))) });
|
|
61
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as Inputs from "../inputs";
|
|
2
|
+
import type { BevelGearSizes, BevelGearSpec, GearOutline } from "./gear-types";
|
|
3
|
+
type Point2 = Inputs.Base.Point2;
|
|
4
|
+
export declare function bevelGearSizes(spec: BevelGearSpec): BevelGearSizes;
|
|
5
|
+
export declare function bevelGearOutline(spec: BevelGearSpec, centre?: Point2, rotation?: number): GearOutline;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { InputError } from "../kernel-calls/errors";
|
|
2
|
+
import { HALF_TURN_DEGREES, HERMITE_STEP, TIP_CONE_SLACK } from "./gears.constants";
|
|
3
|
+
import { degreesOf, radiansOf } from "../services/helpers/geometry/scalars";
|
|
4
|
+
import { spurFlankPieces, spurSizesOf } from "./gears";
|
|
5
|
+
import { checkedTeeth, checkedThickness, checkedToothCount } from "./gear-checks";
|
|
6
|
+
import { angleOf, mappedPiece, toothedOutline } from "./involute-flank";
|
|
7
|
+
import { add2, length2, polar2, scale2, subtract2 } from "../services/helpers/geometry/vectors";
|
|
8
|
+
const backConeProjection = (pitchRadius, cone) => {
|
|
9
|
+
const height = pitchRadius / Math.tan(cone);
|
|
10
|
+
const depth = pitchRadius * Math.tan(cone);
|
|
11
|
+
return point => {
|
|
12
|
+
const slant = length2(point);
|
|
13
|
+
return polar2(slant * Math.cos(cone) * height / (height + depth - slant * Math.sin(cone)), angleOf(point) / Math.cos(cone));
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const pushed = (map, at, toward) => {
|
|
17
|
+
const delta = scale2(subtract2(toward, at), HERMITE_STEP);
|
|
18
|
+
const ahead = map(add2(at, delta));
|
|
19
|
+
const behind = map(subtract2(at, delta));
|
|
20
|
+
return add2(map(at), scale2(subtract2(ahead, behind), 1 / (2 * HERMITE_STEP)));
|
|
21
|
+
};
|
|
22
|
+
const projected = (piece, map) => piece.kind === "cubic"
|
|
23
|
+
? { kind: "cubic", from: map(piece.from), control1: pushed(map, piece.from, piece.control1), control2: pushed(map, piece.to, piece.control2), to: map(piece.to), part: piece.part }
|
|
24
|
+
: mappedPiece(piece, map);
|
|
25
|
+
export function bevelGearSizes(spec) {
|
|
26
|
+
checkedTeeth(spec);
|
|
27
|
+
checkedToothCount(spec.mateTeeth, "mateTeeth");
|
|
28
|
+
checkedThickness(spec.module * Math.PI / 2, spec.backlash);
|
|
29
|
+
if (!(spec.shaftAngle > 0 && spec.shaftAngle < HALF_TURN_DEGREES)) {
|
|
30
|
+
throw new InputError(`\`shaftAngle\` is not between 0 and ${String(HALF_TURN_DEGREES)} degrees.`, "shaftAngle");
|
|
31
|
+
}
|
|
32
|
+
const shaft = radiansOf(spec.shaftAngle);
|
|
33
|
+
if (!(spec.mateTeeth / spec.teeth + Math.cos(shaft) > 0)) {
|
|
34
|
+
throw new InputError("The pitch cone opens flat or wider, a crown or internal bevel gear: lower the `shaftAngle` or give the mate more teeth.", "shaftAngle");
|
|
35
|
+
}
|
|
36
|
+
const cone = Math.atan2(Math.sin(shaft), spec.mateTeeth / spec.teeth + Math.cos(shaft));
|
|
37
|
+
const pitchRadius = spec.module * spec.teeth / 2;
|
|
38
|
+
const coneDistance = pitchRadius / Math.sin(cone);
|
|
39
|
+
const tip = spec.module * spec.addendum;
|
|
40
|
+
const root = spec.module * spec.dedendum;
|
|
41
|
+
const rootCone = cone - Math.atan(root / coneDistance);
|
|
42
|
+
if (!(rootCone > 0)) {
|
|
43
|
+
throw new InputError("The gaps reach past the axis: give the gear more `teeth` or a smaller `dedendum`.", "dedendum");
|
|
44
|
+
}
|
|
45
|
+
const tipCone = cone + Math.atan(tip / coneDistance);
|
|
46
|
+
if (!(tipCone < Math.PI / 2 - TIP_CONE_SLACK)) {
|
|
47
|
+
throw new InputError("The tips of the teeth reach the plane square to the axis, where the back cone seen from the apex has no outline to draw: lower the `shaftAngle`, or give the gear more `teeth` or a smaller `addendum`.", "shaftAngle");
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
pitchRadius,
|
|
51
|
+
tipRadius: pitchRadius + tip * Math.cos(cone),
|
|
52
|
+
rootRadius: pitchRadius - root * Math.cos(cone),
|
|
53
|
+
pitchConeAngle: degreesOf(cone),
|
|
54
|
+
tipConeAngle: degreesOf(tipCone),
|
|
55
|
+
rootConeAngle: degreesOf(rootCone),
|
|
56
|
+
coneDistance,
|
|
57
|
+
apexDistance: coneDistance * Math.cos(cone),
|
|
58
|
+
virtualTeeth: spec.teeth / Math.cos(cone),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function bevelGearOutline(spec, centre = [0, 0], rotation = 0) {
|
|
62
|
+
const sizes = bevelGearSizes(spec);
|
|
63
|
+
const virtual = Object.assign(Object.assign({}, spec), { teeth: sizes.virtualTeeth, profileShift: 0 });
|
|
64
|
+
const virtualSizes = spurSizesOf(virtual);
|
|
65
|
+
const map = backConeProjection(sizes.pitchRadius, radiansOf(sizes.pitchConeAngle));
|
|
66
|
+
const upper = spurFlankPieces(virtual, virtualSizes).map(piece => projected(piece, map));
|
|
67
|
+
const circles = { top: map([virtualSizes.tipRadius, 0])[0], topPart: "tip", gap: map([virtualSizes.rootRadius, 0])[0], gapPart: "root" };
|
|
68
|
+
return toothedOutline(upper, circles, spec.teeth, centre, radiansOf(rotation));
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GearSharedSpec, GearTeeth, RackSpec } from "./gear-types";
|
|
2
|
+
export declare const checkedDedendum: (dedendum: number) => void;
|
|
3
|
+
export declare const checkedToothCount: (teeth: number, name: string, least?: number) => void;
|
|
4
|
+
export declare const checkedShared: (spec: GearSharedSpec) => void;
|
|
5
|
+
export declare const checkedTeeth: (spec: GearTeeth, least?: number) => void;
|
|
6
|
+
export declare const checkedThickness: (unloosened: number, backlash: number) => void;
|
|
7
|
+
export declare const checkedRack: (spec: RackSpec) => void;
|
|
8
|
+
export declare const checkedRingTips: (ringTeeth: number, spec: GearSharedSpec, property: string, remedy: string) => void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { InputError } from "../kernel-calls/errors";
|
|
2
|
+
import { MAX_PRESSURE_ANGLE, MIN_TEETH } from "./gears.constants";
|
|
3
|
+
import { radiansOf } from "../services/helpers/geometry/scalars";
|
|
4
|
+
const checkedFinite = (value, name) => {
|
|
5
|
+
if (!Number.isFinite(value)) {
|
|
6
|
+
throw new InputError(`\`${name}\` is not a finite number.`, name);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const checkedPositive = (value, name) => {
|
|
10
|
+
if (!(value > 0)) {
|
|
11
|
+
throw new InputError(`\`${name}\` is not more than 0.`, name);
|
|
12
|
+
}
|
|
13
|
+
checkedFinite(value, name);
|
|
14
|
+
};
|
|
15
|
+
const checkedPressureAngle = (pressureAngle) => {
|
|
16
|
+
if (!(pressureAngle > 0 && pressureAngle < MAX_PRESSURE_ANGLE)) {
|
|
17
|
+
throw new InputError(`\`pressureAngle\` is not between 0 and ${String(MAX_PRESSURE_ANGLE)} degrees.`, "pressureAngle");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const checkedToothForm = (spec) => {
|
|
21
|
+
checkedDedendum(spec.dedendum);
|
|
22
|
+
if (!(spec.rootFillet >= 0)) {
|
|
23
|
+
throw new InputError("`rootFillet` is less than 0.", "rootFillet");
|
|
24
|
+
}
|
|
25
|
+
checkedFinite(spec.rootFillet, "rootFillet");
|
|
26
|
+
if (!(spec.backlash >= 0)) {
|
|
27
|
+
throw new InputError("`backlash` is less than 0.", "backlash");
|
|
28
|
+
}
|
|
29
|
+
checkedFinite(spec.backlash, "backlash");
|
|
30
|
+
};
|
|
31
|
+
export const checkedDedendum = (dedendum) => checkedPositive(dedendum, "dedendum");
|
|
32
|
+
export const checkedToothCount = (teeth, name, least = MIN_TEETH) => {
|
|
33
|
+
if (!Number.isInteger(teeth) || teeth < least) {
|
|
34
|
+
throw new InputError(`\`${name}\` is not a whole number of at least ${String(least)}.`, name);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export const checkedShared = (spec) => {
|
|
38
|
+
checkedPositive(spec.module, "module");
|
|
39
|
+
checkedPressureAngle(spec.pressureAngle);
|
|
40
|
+
checkedPositive(spec.addendum, "addendum");
|
|
41
|
+
};
|
|
42
|
+
export const checkedTeeth = (spec, least = MIN_TEETH) => {
|
|
43
|
+
checkedPositive(spec.module, "module");
|
|
44
|
+
checkedToothCount(spec.teeth, "teeth", least);
|
|
45
|
+
checkedPressureAngle(spec.pressureAngle);
|
|
46
|
+
checkedPositive(spec.addendum, "addendum");
|
|
47
|
+
checkedToothForm(spec);
|
|
48
|
+
};
|
|
49
|
+
export const checkedThickness = (unloosened, backlash) => {
|
|
50
|
+
if (!(unloosened > 0)) {
|
|
51
|
+
throw new InputError("`profileShift` thins the teeth to nothing at the pitch circle: make it larger.", "profileShift");
|
|
52
|
+
}
|
|
53
|
+
if (!(unloosened > backlash)) {
|
|
54
|
+
throw new InputError("`backlash` takes the whole tooth away.", "backlash");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export const checkedRack = (spec) => {
|
|
58
|
+
checkedTeeth(spec, 1);
|
|
59
|
+
if (!(spec.height > spec.dedendum * spec.module)) {
|
|
60
|
+
throw new InputError("`height` does not reach below the gaps: make it more than the dedendum times the module.", "height");
|
|
61
|
+
}
|
|
62
|
+
checkedFinite(spec.height, "height");
|
|
63
|
+
};
|
|
64
|
+
export const checkedRingTips = (ringTeeth, spec, property, remedy) => {
|
|
65
|
+
const pitchRadius = spec.module * ringTeeth / 2;
|
|
66
|
+
if (!(pitchRadius - spec.module * spec.addendum >= pitchRadius * Math.cos(radiansOf(spec.pressureAngle)))) {
|
|
67
|
+
throw new InputError(`The tips of the ring's ${String(ringTeeth)} teeth reach inside its base circle, where no involute runs: ${remedy}.`, property);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GearPairSizes, GearPairSpec, InternalGearPairSizes, InternalGearPairSpec, PlanetarySet, PlanetarySetSpec } from "./gear-types";
|
|
2
|
+
export declare function gearPair(spec: GearPairSpec): GearPairSizes;
|
|
3
|
+
export declare function internalGearPair(spec: InternalGearPairSpec): InternalGearPairSizes;
|
|
4
|
+
export declare function planetarySet(spec: PlanetarySetSpec): PlanetarySet;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { InputError } from "../kernel-calls/errors";
|
|
2
|
+
import { involute } from "./involute-flank";
|
|
3
|
+
import { checkedDedendum, checkedRingTips, checkedShared, checkedToothCount } from "./gear-checks";
|
|
4
|
+
import { FULL_TURN_DEGREES, HALF_TURN_DEGREES, INVOLUTE_SERIES_DIVISOR, MAX_PRESSURE_ANGLE, NEWTON_STEPS, PHASE_TOLERANCE } from "./gears.constants";
|
|
5
|
+
import { polar2 } from "../services/helpers/geometry/vectors";
|
|
6
|
+
import { degreesOf, fractionOf, radiansOf } from "../services/helpers/geometry/scalars";
|
|
7
|
+
const inverseInvolute = (value) => {
|
|
8
|
+
let low = 0;
|
|
9
|
+
let high = Math.PI / 2;
|
|
10
|
+
let angle = Math.min(Math.cbrt(INVOLUTE_SERIES_DIVISOR * value), high / 2);
|
|
11
|
+
for (let step = 0; step < NEWTON_STEPS; step++) {
|
|
12
|
+
const error = involute(angle) - value;
|
|
13
|
+
if (error > 0) {
|
|
14
|
+
high = angle;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
low = angle;
|
|
18
|
+
}
|
|
19
|
+
const next = angle - error / Math.pow(Math.tan(angle), 2);
|
|
20
|
+
angle = next > low && next < high ? next : (low + high) / 2;
|
|
21
|
+
}
|
|
22
|
+
return angle;
|
|
23
|
+
};
|
|
24
|
+
const rollOf = (tipRadius, baseRadius) => Math.sqrt(tipRadius * tipRadius - baseRadius * baseRadius);
|
|
25
|
+
const checkedTip = (tipRadius, baseRadius, gear, teeth, shift) => {
|
|
26
|
+
if (!(tipRadius >= baseRadius)) {
|
|
27
|
+
throw new InputError(`The tips of the ${gear} gear's teeth reach inside its base circle, where no involute runs: give it more \`${teeth}\` or a larger \`${shift}\`.`, shift);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const externalMesh = (module, teethA, teethB, alpha, working, tipA, tipB) => {
|
|
31
|
+
const centreDistance = module * (teethA + teethB) / 2 * (Math.cos(alpha) / Math.cos(working));
|
|
32
|
+
const line = centreDistance * Math.sin(working);
|
|
33
|
+
const rollA = rollOf(tipA, module * teethA / 2 * Math.cos(alpha));
|
|
34
|
+
const rollB = rollOf(tipB, module * teethB / 2 * Math.cos(alpha));
|
|
35
|
+
const contact = Math.min(rollA, line) + Math.min(rollB, line) - line;
|
|
36
|
+
return { centreDistance, contactRatio: Math.max(0, contact) / (Math.PI * module * Math.cos(alpha)), interferes: rollA > line || rollB > line };
|
|
37
|
+
};
|
|
38
|
+
const internalMesh = (module, pinionTeeth, ringTeeth, alpha, addendum) => {
|
|
39
|
+
const centreDistance = module * (ringTeeth - pinionTeeth) / 2;
|
|
40
|
+
const pinionTip = module * (pinionTeeth / 2 + addendum);
|
|
41
|
+
const ringTip = module * (ringTeeth / 2 - addendum);
|
|
42
|
+
const pinionBase = module * pinionTeeth / 2 * Math.cos(alpha);
|
|
43
|
+
const ringBase = module * ringTeeth / 2 * Math.cos(alpha);
|
|
44
|
+
const line = centreDistance * Math.sin(alpha);
|
|
45
|
+
const ringRoll = rollOf(ringTip, ringBase);
|
|
46
|
+
const contact = rollOf(pinionTip, pinionBase) - Math.max(ringRoll, line) + line;
|
|
47
|
+
const pinionTipAngle = Math.acos(pinionBase / pinionTip);
|
|
48
|
+
const ringTipAngle = Math.acos(ringBase / ringTip);
|
|
49
|
+
const pinionTurn = Math.acos((ringTip * ringTip - pinionTip * pinionTip - centreDistance * centreDistance) / (2 * centreDistance * pinionTip)) + involute(pinionTipAngle) - involute(alpha);
|
|
50
|
+
const ringTurn = Math.acos((centreDistance * centreDistance + ringTip * ringTip - pinionTip * pinionTip) / (2 * centreDistance * ringTip));
|
|
51
|
+
const tipsClear = pinionTurn * pinionTeeth / ringTeeth + involute(alpha) - involute(ringTipAngle) >= ringTurn;
|
|
52
|
+
return { centreDistance, contactRatio: Math.max(0, contact) / (Math.PI * module * Math.cos(alpha)), interferes: ringRoll < line || !tipsClear };
|
|
53
|
+
};
|
|
54
|
+
export function gearPair(spec) {
|
|
55
|
+
checkedShared(spec);
|
|
56
|
+
checkedDedendum(spec.dedendum);
|
|
57
|
+
checkedToothCount(spec.teethA, "teethA");
|
|
58
|
+
checkedToothCount(spec.teethB, "teethB");
|
|
59
|
+
if (!Number.isFinite(spec.profileShiftA) || !Number.isFinite(spec.profileShiftB)) {
|
|
60
|
+
throw new InputError("A profile shift is not a number.", Number.isFinite(spec.profileShiftA) ? "profileShiftB" : "profileShiftA");
|
|
61
|
+
}
|
|
62
|
+
const { module, teethA, teethB } = spec;
|
|
63
|
+
const alpha = radiansOf(spec.pressureAngle);
|
|
64
|
+
const shift = spec.profileShiftA + spec.profileShiftB;
|
|
65
|
+
const workingInvolute = 2 * Math.tan(alpha) * shift / (teethA + teethB) + involute(alpha);
|
|
66
|
+
if (!(workingInvolute > 0)) {
|
|
67
|
+
throw new InputError(`The profile shifts add up to ${String(shift)}, which leaves the pair no working pressure angle: their sum must be more than ${String(-(teethA + teethB) * involute(alpha) / (2 * Math.tan(alpha)))}.`, "profileShiftA");
|
|
68
|
+
}
|
|
69
|
+
if (!(workingInvolute <= involute(radiansOf(MAX_PRESSURE_ANGLE)))) {
|
|
70
|
+
throw new InputError(`The profile shifts add up to ${String(shift)}, which would have the pair work at a pressure angle above ${String(MAX_PRESSURE_ANGLE)} degrees: lower \`profileShiftA\` or \`profileShiftB\`.`, "profileShiftA");
|
|
71
|
+
}
|
|
72
|
+
const tipA = module * (teethA / 2 + spec.addendum + spec.profileShiftA);
|
|
73
|
+
const tipB = module * (teethB / 2 + spec.addendum + spec.profileShiftB);
|
|
74
|
+
checkedTip(tipA, module * teethA / 2 * Math.cos(alpha), "first", "teethA", "profileShiftA");
|
|
75
|
+
checkedTip(tipB, module * teethB / 2 * Math.cos(alpha), "second", "teethB", "profileShiftB");
|
|
76
|
+
const working = shift === 0 ? alpha : inverseInvolute(workingInvolute);
|
|
77
|
+
const mesh = externalMesh(module, teethA, teethB, alpha, working, tipA, tipB);
|
|
78
|
+
const shortening = shift - (mesh.centreDistance - module * (teethA + teethB) / 2) / module;
|
|
79
|
+
return {
|
|
80
|
+
centreDistance: mesh.centreDistance,
|
|
81
|
+
workingPressureAngle: degreesOf(working),
|
|
82
|
+
contactRatio: mesh.contactRatio,
|
|
83
|
+
ratio: teethB / teethA,
|
|
84
|
+
interferes: mesh.interferes,
|
|
85
|
+
tipShortening: module * Math.max(0, shortening),
|
|
86
|
+
clearance: mesh.centreDistance - tipA - module * (teethB / 2 - spec.dedendum + spec.profileShiftB),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function internalGearPair(spec) {
|
|
90
|
+
checkedShared(spec);
|
|
91
|
+
checkedToothCount(spec.pinionTeeth, "pinionTeeth");
|
|
92
|
+
checkedToothCount(spec.ringTeeth, "ringTeeth");
|
|
93
|
+
if (!(spec.ringTeeth > spec.pinionTeeth)) {
|
|
94
|
+
throw new InputError("`ringTeeth` is not more than `pinionTeeth`, so the gear cannot fit inside the ring.", "ringTeeth");
|
|
95
|
+
}
|
|
96
|
+
checkedRingTips(spec.ringTeeth, spec, "ringTeeth", "give the ring more `ringTeeth` or a smaller `addendum`");
|
|
97
|
+
const mesh = internalMesh(spec.module, spec.pinionTeeth, spec.ringTeeth, radiansOf(spec.pressureAngle), spec.addendum);
|
|
98
|
+
return { centreDistance: mesh.centreDistance, contactRatio: mesh.contactRatio, ratio: spec.ringTeeth / spec.pinionTeeth, interferes: mesh.interferes };
|
|
99
|
+
}
|
|
100
|
+
export function planetarySet(spec) {
|
|
101
|
+
checkedShared(spec);
|
|
102
|
+
checkedToothCount(spec.sunTeeth, "sunTeeth");
|
|
103
|
+
checkedToothCount(spec.planetTeeth, "planetTeeth");
|
|
104
|
+
if (!Number.isInteger(spec.planets) || spec.planets < 1) {
|
|
105
|
+
throw new InputError("`planets` is not a whole number of at least 1.", "planets");
|
|
106
|
+
}
|
|
107
|
+
const { module, sunTeeth, planetTeeth, planets } = spec;
|
|
108
|
+
const ringTeeth = sunTeeth + 2 * planetTeeth;
|
|
109
|
+
checkedRingTips(ringTeeth, spec, "planetTeeth", "give the sun or the planets more teeth, or a smaller `addendum`");
|
|
110
|
+
const centreDistance = module * (sunTeeth + planetTeeth) / 2;
|
|
111
|
+
const angles = Array.from({ length: planets }, (_, index) => FULL_TURN_DEGREES * index / planets);
|
|
112
|
+
const planetRotations = angles.map(angle => {
|
|
113
|
+
const sunPhase = fractionOf(angle * sunTeeth / FULL_TURN_DEGREES);
|
|
114
|
+
const turned = angle + HALF_TURN_DEGREES - FULL_TURN_DEGREES / planetTeeth * fractionOf(1 / 2 - sunPhase);
|
|
115
|
+
return turned - FULL_TURN_DEGREES / planetTeeth * Math.floor(turned * planetTeeth / FULL_TURN_DEGREES);
|
|
116
|
+
});
|
|
117
|
+
const planetPhase = (index) => fractionOf((angles[index] - planetRotations[index]) * planetTeeth / FULL_TURN_DEGREES);
|
|
118
|
+
const ringRotation = FULL_TURN_DEGREES / ringTeeth * fractionOf(1 / 2 - planetPhase(0));
|
|
119
|
+
const meshes = angles.every((angle, index) => {
|
|
120
|
+
const ringPhase = fractionOf((angle - ringRotation) * ringTeeth / FULL_TURN_DEGREES);
|
|
121
|
+
const offset = fractionOf(planetPhase(index) - ringPhase);
|
|
122
|
+
return Math.abs(offset - 1 / 2) < PHASE_TOLERANCE;
|
|
123
|
+
});
|
|
124
|
+
const planetTip = module * (planetTeeth / 2 + spec.addendum);
|
|
125
|
+
const alpha = radiansOf(spec.pressureAngle);
|
|
126
|
+
const sunMesh = externalMesh(module, sunTeeth, planetTeeth, alpha, alpha, module * (sunTeeth / 2 + spec.addendum), planetTip);
|
|
127
|
+
const ringMesh = internalMesh(module, planetTeeth, ringTeeth, alpha, spec.addendum);
|
|
128
|
+
const planetCentres = angles.map((angle) => [...polar2(centreDistance, radiansOf(angle)), 0]);
|
|
129
|
+
return {
|
|
130
|
+
ringTeeth,
|
|
131
|
+
centreDistance,
|
|
132
|
+
ratio: 1 + ringTeeth / sunTeeth,
|
|
133
|
+
assemblable: meshes,
|
|
134
|
+
planetsClear: planets < 2 || 2 * centreDistance * Math.sin(Math.PI / planets) > 2 * planetTip,
|
|
135
|
+
interferes: sunMesh.interferes || ringMesh.interferes,
|
|
136
|
+
planetCentres,
|
|
137
|
+
planetRotations,
|
|
138
|
+
ringRotation,
|
|
139
|
+
};
|
|
140
|
+
}
|