Replicate
replicate() copies a mated part — or a mated sub-assembly — onto new mate targets. It is the "copy with mates" of other CAD systems, not a geometric pattern: every replica gets the seed's mates re-targeted to its own references, so the four standoffs on a plate each sit in their own hole and move on their own.
In the viewport
- Mate the first instance the way every copy should be mated — the seed.
- Click Replicate on the assembly toolbar and pick the seed.
- The dialog lists the seed's outer mate sides — the connectors or faces on other parts its mates reference. For each replica, pick the replacement for each one.
- Click Apply. The replicas appear as ordinary rows in the Parts panel, named after the seed with a suffix, marked as replicas.

The code behind it
standoff.part.js
standoff.part.js
import { part, sketch, circle, extrude, chamfer, color, connector } from 'fluidcad/core';
// A Ø8 × 15 standoff with a Ø4 through hole, chamfered on top.
export const standoff = part('Standoff', () => {
sketch('xy', () => {
circle([0, 0], 8);
circle([0, 0], 4);
});
const body = extrude(15);
chamfer(0.5, body.endEdges());
color('goldenrod');
// The foot: the face that sits on a mounting hole.
connector('foot', body.startFaces());
});
standoffs.assembly.js
import { assembly, insert, mate, replicate } from 'fluidcad/core';
import { plate } from './asm-plate.part.js';
import { standoff } from './asm-standoff.part.js';
export const standoffs = assembly('standoffs', () => {
const base = insert(plate).grounded();
// The seed: one standoff fastened onto the first mounting hole.
const first = insert(standoff);
mate('fastened', base.connectors.hole1, first.connectors.foot);
// replicate() re-inserts the seed once per row and re-targets its
// mates. The second argument lists the seed's OUTER mate sides that
// change per copy (one column: the plate connector); each row gives
// that column's replacement for one replica. Replicas take the seed's
// name with a suffix — "Standoff (2)", "Standoff (3)", … — and are
// ordinary instances from here on.
replicate(first, [base.connectors.hole1], [
[base.connectors.hole2],
[base.connectors.hole3],
[base.connectors.hole4],
]);
});
Signature
replicate(seed, targets, rows)
| Argument | Meaning |
|---|---|
seed | The handle insert() returned for the instance or sub-assembly to copy. |
targets | The seed's outer mate sides that change per replica — one column each. Any outer side not listed stays shared by every replica (a planar mate onto one common base). |
rows | One array per replica, one entry per target: rows[k][j] replaces targets[j] in replica k's mates. At least one row. |
It returns the replica handles in row order, so const [b, c, d] = replicate(...) lets you name or mate them further.
Rules
- Only mates written before the statement replicate. Mate options (flip, rotate, offset, limits) are copied verbatim.
- Replicas start at the seed's pose and are never grounded — their mates place them.
- A target can be any mate side:
instance.connectors.<name>, an assembly connector, orinstance.features.<name>for a tangent mate. - Replicating a sub-assembly re-runs its body with the same parameters; its inner mates come along.