Skip to main content

Symmetric

symmetric mirrors two points across a line: they end up the same distance from it on opposite sides, on a line perpendicular to it. It is how one dimension drives both halves of a symmetric profile.

In the viewport

  1. Click the two points, then the mirror line — a datum axis, or any sketched line (a .guide() centreline is the usual choice).
  2. Click Symmetric. Both points get an S badge.
The constraint bar with two points and a line picked and the Symmetric button highlighted
Two points and the mirror line picked: Symmetric is enabled.
BeforeBefore mode

The keyway's walls sit at unequal distances from the centreline.

AfterAfter modesymmetric(a, b, yAxis())

Both walls mirrored across the Y axis: the keyway is centred on the bore.

The code behind it

The keyway's walls are drawn at unequal distances from the bore's centreline. Two symmetric statements mirror the right wall's endpoints from the left wall's across yAxis() (2 DOF each), so the keyway is centred on the bore whatever width the distance sets. Only the left wall needs vertical; the right one follows.

hub.part.js
import { sketch, line, circle, origin, yAxis } from 'fluidcad/core';
import { symmetric, coincident, vertical, distance, diameter } from "fluidcad/constraints";

sketch("xy", () => {
// A bore with a keyway. The keyway's two walls are drawn at unequal
// distances from the centreline.
const bore = circle([0, 0], 40);
coincident(bore.center(), origin());
diameter(bore, 40);
const leftWall = line([-4, 19], [-4, 24]);
const rightWall = line([2, 20], [2, 24]);
const top = line([-4, 24], [2, 24]);
coincident(leftWall.end(), top.start());
coincident(top.end(), rightWall.end());
coincident(leftWall.start(), bore); // both walls start on the bore
vertical(leftWall);
// Each wall endpoint mirrors its partner across the Y axis — the
// sketch's centreline — so the keyway stays centred on the bore.
symmetric(leftWall.start(), rightWall.start(), yAxis());
symmetric(leftWall.end(), rightWall.end(), yAxis());
distance(leftWall, rightWall, 6); // keyway width
distance(origin(), top, 23); // keyway depth from the bore center
})

In code

symmetric(a, b, l) // points a and b mirror across line l: 2 DOF
symmetric(a, b, yAxis()) // ... across a datum axis

a and b are points (line ends, centers, point()s); l is a line or an axis datum. To mirror whole shapes rather than two points, draw one half and use the sketch mirror tool instead.

See also