FluidCAD Hub

@fluidcad/gears

1.0.0LatestPublished 0 comments

Involute spur, helical and herringbone gears, internal gears, gear teeth and racks, with gear pair, reducer, planetary and rack-drive mechanisms

@fluidcad/gears

Gear features, parts and assemblies for FluidCAD, built on the custom-features SDK (fluidcad/sdk).

npx fluidcad install @fluidcad/gears
import { gear, gearTeeth, internalGear, rack } from '@fluidcad/gears';
featureidwhat it makes
geargeara spur, helical or herringbone gear with hub and bore options
gearTeethgear-teethinvolute teeth cut into an existing shaft or bore
internalGearinternal-geara ring gear, checked against its mate for interference
rackracka straight or helical rack

Layout

The package keeps what it shares in three folders. fluidcad pack ships them and nothing else.

fluidcad.json   the package block (@fluidcad/gears)
features/       the gear features, their icons/ and option pictures (img/)
  lib/            plain ES modules the features import
    bspline.js      B-spline interpolation and adaptive fitting with measured deviation
    gear-math.js    gear geometry and standards (ISO 21771, ISO 53, ISO 54, KHK, AGMA)
    profile.js      exact 2D tooth profiles (involute, generated trochoid root, rack)
    tooth.js        the tooth values the dialogs share, and face sorting
    occ-gear.js     OpenCascade construction: toothed bodies, hub, bore, chamfers
    placement.js    the frame a feature stands on: face, edge, connector or plane
parts/          example gears, each on an `axis` connector
  mechanisms/     bases, a parametric spur gear, the reducer's shaft, the planet and carrier
assemblies/     gear mechanisms: mates plus gear / rack-and-pinion relations

These stay in the workspace and never ship: main.assembly.js (a scratch model), init.js, tests/ (vitest unit tests for features/lib), tools/ (scripts that draw the icons) and the npm files.

Geometry

Tooth flanks are B-rep curves fitted to the exact equations: the involute, the root trochoid generated by the basic rack's tip round, and so on. The fits are non-rational B-splines in OpenCascade's convention (unique knots plus multiplicities) and each one reports the deviation it reached from the exact curve (default tolerance 1e-5 mm). Lines and circles stay analytic.

Assemblies

Each mechanism is one flat assembly(): it inserts the parts, grounds one, puts every gear on a revolute mate (a rack on a slider) and couples the mates with relation() in the same body — no relation inside a sub-assembly. Every part starts where it meshes, so the file's poses set the mesh phase. Drive any joint from the Joints panel and the rest follow.

filepartsrelationsratio
gear-pair.assembly.jsbase, 18-tooth pinion, 30-tooth wheel (m 2)gear 18/30, reversed1.667 : 1
reducer.assembly.jsbase, 14-tooth input, 42/14 intermediate shaft, 42-tooth output (m 2)two gear 14/42, reversed9 : 1, same sense
internal-pair.assembly.jsbase, 60-tooth ring, 24-tooth pinion (m 2)gear 24/60, same sense2.5 : 1
planetary.assembly.js60-tooth ring (grounded), carrier, 18-tooth sun, three 21-tooth planets (m 1.5)ring–planet 60/21 ×3 reversed, carrier–sun 1 + 60/18sun : carrier 4.333 : 1
rack-drive.assembly.jsbase, 20-tooth helical pinion (mn 2, 20°), helical rackrack-and-pinion 2π r ≈ 133.73 mm/turn, reversed133.73 mm per turn

In the planetary set the carrier and the sun turn on the ring's axis and the planets on the carrier's pins. Each ring–planet mesh is written in the carrier's frame (planet = −60/21 × carrier), and the sun–planet mesh comes out as the carrier–sun relation sun = (1 + 60/18) × carrier, so the sun's joint reads its absolute angle (see the file's comments for the derivation). Every relation is held exactly, so the train can be dragged from the sun, the carrier or any planet.

Development

npm install
npm test            # unit tests
npm run typecheck   # checkJs over the workspace
npx fluidcad pack   # → fluidcad-gears-<version>.fluidpkg

To release, raise the version with npx fluidcad version patch|minor|major, pack, then npx fluidcad publish.