Skip to main content

Mirror

mirror() reflects solids across a plane. The mirrored body is a new solid that fuses with, cuts from, or stays separate from the model, like any create feature.

In the viewport

  1. Click Mirror on the toolbar. The Mirror dialog docks on the right.
  2. Pick the tab: Add fuses the mirrored bodies with what they touch, Remove cuts them out of the model, New keeps them as separate solids.
  3. Click the solids to mirror; each becomes a chip in the Solids slot.
  4. Click the Plane slot to arm it, then pick the mirror plane: an origin-plane quad at the origin, a plane feature's quad, or a planar face.
  5. Click Apply.

A block mirrored across the YZ plane

The code behind it

The block starts at x = 10, so its mirror image starts at x = −10 and the two do not touch — two solids. Move the block to x = 0 and the pair fuses into one.

mirror.part.js
import { extrude, mirror, sketch } from 'fluidcad/core';
import { line } from 'fluidcad/core';
import { coincident, distance, fix, horizontal, vertical } from "fluidcad/constraints";

sketch("xy", () => {
const sg1 = line([10, 0], [60, 0]);
const sg2 = line([60, 0], [60, 30]);
const sg3 = line([60, 30], [10, 30]);
const sg4 = line([10, 30], [10, 0]);
coincident(sg1.end(), sg2.start());
coincident(sg2.end(), sg3.start());
coincident(sg3.end(), sg4.start());
coincident(sg4.end(), sg1.start());
horizontal(sg1);
vertical(sg2);
horizontal(sg3);
vertical(sg4);
fix(sg1.start(), [10, 0]);
distance(sg1.start(), sg1.end(), 50);
distance(sg2.start(), sg2.end(), 30);
})

extrude(20)

// Reflect the last solid across the YZ plane (the Mirror dialog with the YZ
// origin quad in its Plane slot). The block starts at x = 10, so its image
// starts at x = -10 and the two stay separate.
mirror("yz")

Code forms

import { mirror } from 'fluidcad/core';

mirror("yz") // mirror every solid across the YZ plane
mirror("front", body) // mirror specific solids
mirror(p, a, b) // across a plane() feature — offset, tilted, from a face
mirror("yz").new() // keep the image as a separate solid
mirror("yz").remove() // cut the image out of the model

The plane is any plane-like value: a name or alias ("xy", "top", "-xz" …), a plane() feature, or a face selection wrapped in plane(…) — see Planes.

Mirror versus mirror repeat

mirror() reflects finished solids. repeat("mirror", plane, feature) re-applies a feature on the other side — a cut mirrored this way cuts the far side too. For symmetric parts modelled as one half, the repeat is usually the right tool: see Repeat.

Inside a sketch

Called inside sketch(...), mirror() reflects sketch geometry across a sketched line or an axis: mirror(l, g1, g2), mirror(yAxis()). See Mirror in the sketch tools.