Cardan Universal Joint

A 1310 series universal joint of a propeller shaft: a cross with four needle bearing cups, seals and snap rings between a flange yoke and a tube yoke, with one ear cut open. The cup diameter, the span over the cups and the mass of the cross kit are published figures. The turn angle moves both yokes by the Cardan law, and the kernel measures the mass of the kit from its volumes. The trunnions, the needles, the seals and the yokes are a display model.
Code
This is the full program. The playground runs it in your browser without a change.
ts
import { box, cutAll, cylinder, extrude, fuseAll, intersect, measureVolume, polygon, revolve, rotate, unwrap } from 'brepjs/quick';
import { color } from 'brepjs/playground';
// Cardan universal joint of a propeller shaft, 1310 series: a cross, four needle bearing cups and two yokes.
// The cup diameter, the span over the cups and the kit mass are published figures. The trunnions, the
// needles, the seals and the yokes are a display model. Units are millimetres.
interface JointParams {
bend?: number; // degrees between the two shafts (0 to 30)
turn?: number; // degrees of the flange yoke. The tube yoke follows by the Cardan law.
open?: boolean; // cut one ear and its cup open to show the needles
}
type P2 = [number, number]; // [r, z]
type P3 = [number, number, number];
type Shape = ReturnType<typeof cylinder>;
// Kernel shapes live in WASM memory. Every temporary goes through own(). freeing() runs a build and then frees them all.
const owned: { delete(): void }[] = [];
const own = <T extends { delete(): void }>(s: T): T => {
owned.push(s);
return s;
};
const freeing = <T,>(build: () => T): T => { try { return build(); } finally { owned.splice(0).forEach((s) => s.delete()); } }; // also when the build throws
// ---- published figures (1310 series, outside snap rings)
const CUP = 1.062 * 25.4; // bearing cup diameter
const SPAN = 3.219 * 25.4; // over the ends of two opposite cups
const CATALOGUE_G = 1.01 * 453.6; // cross, four cups and the grease fitting
const DENSITY = { steel: 7.85e-3, rubber: 1.2e-3 }; // grams per cubic millimetre
// ---- display model
const TRUNNION = 8.25; // radius
const NEEDLE = { radius: 1.2, count: 24 };
const CUP_LENGTH = 17;
const FLOOR = 3; // end wall of a cup
const SHOULDER = { radius: 10.5, end: 21.5 };
const EAR = { inner: 28, outer: 44.5, radius: 21 }; // one ear of a yoke, along its bore
const BACK = 62; // from the joint centre to the back of the fork
const RING = { radius: 14.6, thick: 1.5 }; // snap ring and its groove
const WINDOW = 100; // degrees of the open ear
const X: P3 = [1, 0, 0];
const Y: P3 = [0, 1, 0];
const Z: P3 = [0, 0, 1];
const RAD = Math.PI / 180;
const turned = (s: Shape, deg: number, axis: P3): Shape => own(rotate(s, deg, { axis }) as Shape);
const volume = (s: Shape): number => unwrap(measureVolume(s));
const cross3 = (a: P3, b: P3): P3 => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
const dot = (a: P3, b: P3): number => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
// A closed profile in the (r, z) half-plane, revolved about Z. A gap leaves a sector free, centred on +X.
const lathe = (pts: P2[], gap = 0): Shape => {
const profile = own(unwrap(polygon(pts.map(([r, z]): P3 => [r, 0, z]))));
if (gap === 0) return own(unwrap(revolve(profile, { axis: Z }))) as Shape;
return turned(own(unwrap(revolve(profile, { axis: Z, angle: (360 - gap) * RAD }))) as Shape, gap / 2, Z);
};
// A yoke in its own frame: the ear bores are on Z, the joint centre is the origin, the shaft goes to -X.
function yoke(end: Shape[], holes: Shape[], open: boolean): Shape {
const outline: P3[] = [
...Array.from({ length: 25 }, (_, i): P3 => [EAR.radius * Math.cos((i * 7.5 - 90) * RAD), EAR.radius * Math.sin((i * 7.5 - 90) * RAD), EAR.inner]),
[-BACK, EAR.radius, EAR.inner], [-BACK, -EAR.radius, EAR.inner],
];
const ear = own(unwrap(extrude(own(unwrap(polygon(outline))), EAR.outer - EAR.inner))) as Shape;
const bridge = own(box(24, 2 * EAR.radius, 2 * EAR.outer, { at: [-BACK + 12, 0, 0], centered: true }));
const fork = own(unwrap(fuseAll([ear, turned(ear, 180, X), bridge]))) as Shape;
const round = own(unwrap(revolve(own(unwrap(polygon([[-BACK, 0, 0], [22, 0, 0], [22, 47, 0], [-BACK + 16, 47, 0], [-BACK, 34, 0]]))), { axis: X }))); // turned outside of the ears
const body = own(unwrap(fuseAll([own(unwrap(intersect(fork, round))) as Shape, ...end]))) as Shape;
const half = SPAN / 2;
const window = open ? [turned(own(unwrap(revolve(own(unwrap(polygon([[0, 0, EAR.inner - 2], [30, 0, EAR.inner - 2], [30, 0, 50], [0, 0, 50]]))), { axis: Z, angle: WINDOW * RAD }))) as Shape, -WINDOW / 2, Z)] : [];
return unwrap(cutAll(body, [
own(cylinder(CUP / 2, 100, { at: [0, 0, -50] })),
own(cylinder(EAR.inner, 60, { at: [EAR.inner - BACK + 12, -30, 0], axis: Y })), // round throat
own(cylinder(RING.radius, RING.thick, { at: [0, 0, half] })),
own(cylinder(RING.radius, RING.thick, { at: [0, 0, -half - RING.thick] })),
...holes, ...window,
])) as Shape;
}
function joint({ bend = 22, turn = 170, open = true }: JointParams = {}) {
const angle = Math.min(Math.max(bend, 0), 30);
const beta = angle * RAD;
const half = SPAN / 2;
const mouth = half - CUP_LENGTH;
// ---- kinematics. The flange yoke turns about X. The tube shaft is on b, in the XY plane.
const b: P3 = [Math.cos(beta), Math.sin(beta), 0];
const u1: P3 = [0, -Math.sin(turn * RAD), Math.cos(turn * RAD)]; // bores of the flange yoke
const n = cross3(b, u1);
const len = Math.hypot(n[0], n[1], n[2]);
const u2: P3 = [n[0] / len, n[1] / len, n[2] / len]; // bores of the tube yoke: square to u1 and to b
const e1 = cross3(b, Z);
const out = Math.atan2(dot(u2, cross3(b, e1)), dot(u2, e1)) / RAD; // angle of the tube yoke about b
const y1: P3 = [0, Math.cos(turn * RAD), Math.sin(turn * RAD)]; // second trunnion before the cross tilts
let tilt = Math.atan2(dot(cross3(y1, u2), u1), dot(y1, u2)) / RAD;
if (tilt > 90) tilt -= 180;
if (tilt < -90) tilt += 180;
const up = (s: Shape): Shape => rotate(s, -90, { axis: Y }) as Shape; // stand the joint on its flange
const onFlange = (s: Shape): Shape => up(turned(s, turn, X));
const onTube = (s: Shape): Shape => up(turned(turned(turned(turned(s, 180, Y), 90, X), angle, Z), out, b));
const onCross = (s: Shape): Shape => up(turned(turned(s, turn, X), tilt, u1));
// ---- yokes
const flangeEnd = [own(cylinder(52, 10, { at: [-BACK - 10, 0, 0], axis: X })), own(cylinder(34, 6, { at: [-BACK - 3, 0, 0], axis: X }))];
const flangeHoles = [45, 135, 225, 315].map((a) => own(cylinder(5.5, 14, { at: [-BACK - 12, 42 * Math.cos(a * RAD), 42 * Math.sin(a * RAD)], axis: X })));
flangeHoles.push(own(cylinder(20, 4, { at: [-BACK - 12, 0, 0], axis: X }))); // pilot recess
const tubeEnd = [own(cylinder(30, 10, { at: [-BACK - 8, 0, 0], axis: X })), own(cylinder(25.4, 40, { at: [-BACK - 46, 0, 0], axis: X }))];
const tubeHoles = [own(cylinder(23.7, 32, { at: [-BACK - 47, 0, 0], axis: X }))];
const flangeRaw = own(yoke(flangeEnd, flangeHoles, open));
const tubeRaw = own(yoke(tubeEnd, tubeHoles, false));
// ---- cross: two trunnion pairs, a web, grease bores
const pair = (r: number, reach: number, axis: P3): Shape => own(cylinder(r, 2 * reach, { at: [-reach * axis[0], -reach * axis[1], -reach * axis[2]], axis }));
const reach = half - FLOOR;
const crossBlank = own(unwrap(fuseAll([
pair(TRUNNION, reach, Z), pair(TRUNNION, reach, Y), pair(SHOULDER.radius, SHOULDER.end, Z), pair(SHOULDER.radius, SHOULDER.end, Y),
own(cylinder(15, 14, { at: [-7, 0, 0], axis: X })), own(cylinder(6, 12, { axis: X })), // web and the boss of the grease fitting
]))) as Shape;
const crossRaw = own(unwrap(cutAll(crossBlank, [pair(2, 50, Z), pair(2, 50, Y), own(cylinder(2, 13, { axis: X }))]))) as Shape;
const hex: P3[] = Array.from({ length: 6 }, (_, i): P3 => [12, 4 * Math.cos(i * 60 * RAD), 4 * Math.sin(i * 60 * RAD)]);
const fittingRaw = own(unwrap(fuseAll([
own(unwrap(extrude(own(unwrap(polygon(hex))), [3.5, 0, 0]))) as Shape,
own(cylinder(1.7, 3.5, { at: [15, 0, 0], axis: X })), own(cylinder(2.4, 2.2, { at: [18, 0, 0], axis: X })),
]))) as Shape;
// ---- one bearing on +Z: cup, seal, snap ring, needles. The open one has a window on +X.
const cupRadius = TRUNNION + 2 * NEEDLE.radius;
const bearing = (gap: number) => ({
cup: lathe([[cupRadius, mouth], [CUP / 2, mouth], [CUP / 2, half], [0, half], [0, reach], [cupRadius, reach]], gap),
seal: lathe([[TRUNNION, SHOULDER.end], [CUP / 2 - 0.4, SHOULDER.end], [CUP / 2 - 0.4, mouth], [TRUNNION, mouth]], gap),
ring: lathe([[10.5, half], [RING.radius, half], [RING.radius, half + RING.thick], [10.5, half + RING.thick]], gap === 0 ? 30 : gap),
});
const needle = own(cylinder(NEEDLE.radius, reach - mouth - 0.6, { at: [TRUNNION + NEEDLE.radius, 0, mouth + 0.6] }));
const closed = bearing(0);
const opened = open ? bearing(WINDOW) : closed;
const needles = open ? Array.from({ length: NEEDLE.count }, (_, i) => onFlange(turned(needle, (360 * i) / NEEDLE.count, Z))) : [];
const flip = (s: Shape): Shape => turned(s, 180, X);
const sets = [
{ place: onFlange, parts: opened }, { place: (s: Shape) => onFlange(flip(s)), parts: closed },
{ place: onTube, parts: closed }, { place: (s: Shape) => onTube(flip(s)), parts: closed },
];
// Mass of the kit from the kernel volumes of closed parts.
const steel = volume(crossRaw) + volume(fittingRaw) + 4 * (volume(closed.cup) + NEEDLE.count * volume(needle));
const grams = steel * DENSITY.steel + 4 * volume(closed.seal) * DENSITY.rubber;
return {
flange: onFlange(flangeRaw), tube: onTube(tubeRaw), cross: onCross(crossRaw), fitting: onCross(fittingRaw),
cups: sets.map((s) => s.place(s.parts.cup)), seals: sets.map((s) => s.place(s.parts.seal)), rings: sets.map((s) => s.place(s.parts.ring)),
needles, grams, turn, out: (out + 360) % 360, bend: angle,
};
}
const part = freeing(() => joint());
console.log('Flange yoke at ' + part.turn + ' deg, tube yoke at ' + part.out.toFixed(2) + ' deg: tan(out) = cos(' + part.bend + ') x tan(in).');
console.log('Mass of the cross kit: ' + part.grams.toFixed(0) + ' g from the kernel volumes. The catalogue has ' + CATALOGUE_G.toFixed(0) + ' g.');
export default [
color(part.flange, '#f5f2ea'),
color(part.tube, '#c3c9d1'),
color(part.cross, '#12b5b0'),
color(part.fitting, '#ff5a1f'),
...part.cups.map((s) => color(s, '#d3a956')),
...part.seals.map((s) => color(s, '#ff5a1f')),
...part.rings.map((s) => color(s, '#22262b')),
...part.needles.map((s) => color(s, '#c3c9d1')),
];Functions used
box cutAll cylinder extrude fuseAll intersect measureVolume polygon revolve rotate unwrap color