Reusable Objects
Most features in FluidCAD consume their inputs. A selection used by shell(), fillet() or project() is gone afterwards, so it can't accidentally be picked up by the next feature.
Sketches, planes and axes are different: their first consumer only takes them off the screen. The wires, the quad or the dashed line disappear from that feature on (and come back when you scrub the timeline before it), but the object stays available to every later feature. Pass it by variable and it is used again, no marker needed.
Using one sketch twice
The same profile drives two features here — an extrude up and another one down — by handing the sketch to both:
// @screenshot skip
import { sketch, circle, extrude, origin } from 'fluidcad/core';
import { coincident, diameter } from 'fluidcad/constraints';
const s = sketch("xy", () => {
const c = circle([0, 0], 60);
coincident(c.center(), origin());
diameter(c, 60);
});
extrude(20, s);
extrude(-50, s);
The first extrude(20, s) hides the sketch; the second extrude(-50, s) takes it again and fuses with the first. extrude() with no sketch argument always picks up the most recent sketch, consumed or not, so a bare extrude(20); extrude(-50); after one sketch does the same.
Extruding parts of a sketch at different heights
When one sketch holds several closed shapes, declare each one as a region() and name it on each feature. The sketch is used once per region:
// @screenshot skip
import { sketch, circle, extrude, origin, region } from 'fluidcad/core';
import { coincident, concentric, diameter } from 'fluidcad/constraints';
const s = sketch("xy", () => {
const outer = circle([0, 0], 100);
const inner = circle([0, 0], 50);
coincident(outer.center(), origin());
concentric(inner, outer);
diameter(outer, 100);
diameter(inner, 50);
region("ring", outer);
region("disc", inner);
});
extrude(10, s).region("ring");
extrude(50, s).region("disc");
The Pick regions link of the extrude, revolve, sweep and wrap dialogs writes these declarations for you — see region picking.
Cleaning up with remove()
A sketch, a plane or an axis stays within reach of every later feature until you explicitly dispose of it. To drop one for good — so no later feature can take it and it no longer comes back when the timeline is scrubbed — keep a reference and call remove():
const layout = sketch("xy", () => {
const c = circle([0, 0], 60);
coincident(c.center(), origin());
diameter(c, 60);
});
extrude(20, layout);
extrude(50, layout);
remove(layout);
remove() is final: the object leaves the screen and every later feature's reach.
Units across files
Reuse across files follows the units rule: a part is built in the unit of the file that defines it. An assembly's own lengths (mate offsets, limits, translations) are in the project unit, parts inserted into it are scaled into that unit automatically, and parameter overrides such as insert(def, { width: 10 }) are read in the part's unit, not the assembly's.
What can be used again
- Whole sketches — the object returned by
sketch(...): pass it to as many features as you like, as a profile, aproject()source or a.region()host. - Planes and axes — the objects returned by
plane(...)andaxis(...): two sketches on one plane, or two revolves around one axis, by variable. - Selections — the object returned by
select(...)is consumed by the first feature that uses it. To drive two features from the same faces, select them again for the second one.
If you find yourself re-sketching the same profile, just pass the sketch to both features. If you find yourself re-selecting the same faces, that is the intended pattern — a consumed selection can't leak into a later feature by accident.