Skip to main content

Parallel

parallel gives two or more lines the same direction. The first line is the reference; every other line turns to match it, and turns again whenever the reference turns.

In the viewport

  1. Click two or more distinct lines. The first click is the reference.
  2. Click Parallel. Each following line gets a badge.
The constraint bar with two lines picked and the Parallel button highlighted
Two lines picked: Parallel is enabled. The first pick is the reference.
BeforeBefore mode

The two flanks lean at different angles.

AfterAfter modeparallel(leftFlank, rightFlank)

The right flank turns to match the left one's lean.

The code behind it

The left flank's lean comes from angle(xAxis(), leftFlank, 110); parallel(leftFlank, rightFlank) removes 1 DOF from the right flank so it follows. Change the angle and the channel leans as one, keeping its width.

channel.part.js
import { sketch, line, xAxis } from 'fluidcad/core';
import { parallel, coincident, horizontal, fix, distance, angle } from "fluidcad/constraints";

sketch("xy", () => {
// The cross-section of a tilted channel: a floor and two flanks.
// The flanks are drawn at rough, unequal angles.
const floor = line([0, 0], [30, 0]);
const leftFlank = line([0, 0], [-16, 42]);
const rightFlank = line([30, 0], [18, 40]);
coincident(leftFlank.start(), floor.start());
coincident(rightFlank.start(), floor.end());
horizontal(floor);
fix(floor.start());
distance(floor.start(), floor.end(), 30);
// The left flank sets the lean; the right flank follows it, so the
// channel keeps a constant width whatever the lean becomes.
angle(xAxis(), leftFlank, 110);
parallel(leftFlank, rightFlank);
distance(leftFlank.start(), leftFlank.end(), 45);
distance(rightFlank.start(), rightFlank.end(), 45);
})

In code

parallel(a, b) // b parallel to a: 1 DOF
parallel(a, b, c, ...) // every line after the first: 1 DOF each

A datum axis can be the reference: parallel(xAxis(), l) is equivalent to horizontal(l).

See also