Slider
A slider mate leaves one degree of freedom: translation along the shared Z axis. Everything else — the other two translations and all three rotations — is locked. It is the joint of a carriage on a rail, a drawer in a cabinet, a key in a keyway.
| Free motion | travel along Z |
|---|
In the viewport
- Click Slider on the assembly toolbar and pick the two connectors — the rail's first, then the carriage's.
- The carriage snaps onto the rail. Drag it in the viewport: it moves along the rail and nowhere else.
- Offset takes a Z value only (the two frames share their axis, so an X or Y offset would contradict the joint); it sets where the carriage rests. Limits bound the travel in document units.
- Click Apply. Right-click the joint's row in the Joints panel and choose Animate… to drive it back and forth.

The code behind it
Both connectors point Z along the direction of travel. Each is a face frame — the rail's top face, the carriage's groove ceiling — given X across the rail with xDirection: 'y' and then turned 90° about that X. Built the same way, the two frames meet face-to-face with their X axes agreeing, so the carriage lands upright on the rail with no further options:rail.part.js
carriage.part.js
import { assembly, insert, mate } from 'fluidcad/core';
import { rail } from './asm-rail.part.js';
import { carriage } from './asm-carriage.part.js';
export const linearStage = assembly('linear-stage', () => {
const track = insert(rail).grounded();
const slide = insert(carriage).translate(0, 0, 40);
// Slider leaves one degree of freedom: travel along the shared Z, which
// both parts' frames point along their length. The carriage sits over
// the rail and slides; .offset(0, 0, d) sets where it rests and
// .limits() bounds the travel, both in document units (mm here).
mate('slider', track.connectors.track, slide.connectors.slide).offset(0, 0, 25).limits(-45, 45);
});
Options
mate('slider', track.connectors.track, slide.connectors.slide)
.offset(0, 0, 25) // rest 25 along the rail (Z only)
.limits(-45, 45) // travel bounds, in document units
.flip() // reverse which way the carriage faces along the rail
.offset(x, y, z) with a non-zero x or y is refused on a slider.
Choosing the connectors
The free axis is the connectors' Z, so the connectors must point along the direction of travel. A face connector points out of its face; turn it with .rotate() on the connector, or pick a straight edge, whose frame already has Z along the edge.
The mate also lines up the two frames' X axes, and on a slider that fixes the roll about the rail. Two face frames on facing faces get opposite default X directions, so turning each about its own Y leaves the second part rolled half a turn. Give both connectors the same xDirection (the rail and carriage use 'y', across the rail) and turn both about that X instead — they then meet face-to-face as they are. .rotate(180) on the mate spins a part that still lands upside down.