Skip to main content

Bridge

Bridge joins two curve ends with one smooth curve: it closes the gap between two guide curves so a loft or a sweep has one continuous rail, leaves an edge of a model and arrives at another without a kink, or makes the missing side of a boundary. You choose how it meets each end — at its position, along its direction, or following its bend too — and how far it runs on before it turns. The curves it joins stay as they are; the result is a curve.

In the viewport​

  1. Open the Curves menu on the toolbar and click Bridge. The Bridge dialog opens with the From row armed (blue border).
  2. Move the cursor along an edge or a curve: the end nearer the cursor shows a marker. Click: From takes that end, and To is armed. A click on a vertex dot takes that point instead (see Picking an end).
  3. Pick the other end the same way. As soon as both rows hold an end, the bridge previews in blue.
  4. Set each end's Continuity and Magnitude: the preview follows every change.
  5. Click Apply. The timeline gains a Bridge row and the statement is written to the file.
The Bridge dialog with the end of one curve in From, met at Curvature with magnitude 1.5, and the start of another in To
  1. 1
    From
    Where the bridge starts: the start or the end of an edge or a curve, or a point. Click the row to arm it before picking again; the chip’s ✕ empties it.
  2. 2
    Continuity
    How the bridge meets the From end: Position, Tangent (the default) or Curvature.
  3. 3
    Magnitude
    How far the bridge keeps going along the curve at the From end before it turns: 1 by default, larger is fuller. Hidden at Position, where it does nothing.
  4. 4
    To
    Where the bridge ends, with its own Continuity and Magnitude below it.
  5. 5
    Apply
    Writes bridge(from, to) with the options that differ from their defaults. Both rows need an end. Exit closes the dialog without writing anything.

If the bridge cannot be made, the dialog says why instead of drawing a preview: the two ends are at the same point, or a magnitude is not greater than zero.

Two rails with a gap between them, joined from the end of the first to the start of the second:

A bridge from the end of one line to the start of another

The code behind it

A sketch's lines are read from outside the sketch through geometries, which the sketch returns; the dialog writes the return for you when you pick a sketch's edge.

rails.part.js
import { sketch, line, bridge } from 'fluidcad/core';

// Two rails with a gap between them, the second one 20 higher up. The
// sketch returns its lines so a statement after it can read their ends.
const rails = sketch('xy', () => {
const l1 = line([0, 0], [30, 0]);
const l2 = line([50, 20], [80, 20]);
return { l1, l2 };
});

// A smooth curve from the end of l1 to the start of l2. It leaves l1
// heading the way l1 runs and arrives at l2 heading along it: tangent at
// both ends, the default. The rails are read, not used up.
const br = bridge(rails.geometries.l1.end(), rails.geometries.l2.start());

Picking an end​

While an end row is armed:

  • Near the end of an edge or a curve. Hovering an edge of a solid, a surface, a curve or a sketch shows a marker at the end nearer the cursor; a click takes that end. The bridge then continues that edge out of its end. An edge of a curve made of several edges offers its own two ends, so take the curve's last edge near its end to start from the curve's end.
  • A vertex dot. Vertices show as dots, and a click on one takes it. The dot wins over the edge within a few pixels of it: move a little along the edge to take the edge's end instead.
    • The end of a sketch's line or arc keeps its direction, as if you had picked near that end of the edge.
    • A corner of a solid or a surface and a sketch point have no single direction, so they are met at their position only: the end's Continuity switches to Position and locks there, with the hint A corner is met at its position. (or A point is met at its position.). Pick another end in the row and the continuity you had chosen comes back.
  • A closed edge, such as a full circle, has no start or end: the dialog says so.
  • The same end in both rows is refused: the bridge needs two ends apart.

Continuity​

Each end has its own Continuity: how closely the bridge follows the curve it meets there.

ContinuityIn codeAt that end, the bridge
Position'g0'meets the point and nothing more: it can arrive at an angle
Tangent (default)'g1'leaves the curve heading the way the curve heads, with no kink
Curvature'g2'heads the way the curve heads and bends as it bends there, so even the change of bend is smooth

An end is met at the lower of its own continuity and what it offers: a point offers its position only, so Tangent or Curvature at a point still meets it at its position.

The same two rails at each continuity, set at both ends:

PositionPosition mode.continuity('g0')

A straight line between the two points.

TangentTangent modebridge(a, b)

Leaves along the first rail and arrives along the second: an S.

CurvatureCurvature mode.continuity('g2')

A line has no bend, so the bridge leaves each rail straighter and turns later.

The code behind Position
rails.part.js
import { sketch, line, bridge } from 'fluidcad/core';

const rails = sketch('xy', () => {
const l1 = line([0, 0], [30, 0]);
const l2 = line([50, 20], [80, 20]);
return { l1, l2 };
});

// Position at both ends: the bridge meets the two points and nothing
// more, a straight line between them.
const br = bridge(rails.geometries.l1.end(), rails.geometries.l2.start()).continuity('g0');
The code behind Curvature
rails.part.js
import { sketch, line, bridge } from 'fluidcad/core';

const rails = sketch('xy', () => {
const l1 = line([0, 0], [30, 0]);
const l2 = line([50, 20], [80, 20]);
return { l1, l2 };
});

// Curvature at both ends: the bridge carries on each rail's bend as well
// as its direction. A line has no bend, so the bridge leaves it with none
// and turns later than a tangent bridge does.
const br = bridge(rails.geometries.l1.end(), rails.geometries.l2.start()).continuity('g2');

Magnitude​

The Magnitude of an end says how far the bridge keeps going along the curve's direction there before it turns. It is measured against the gap between the two ends, so the shape stays the same when the whole layout is scaled. 1 is balanced; smaller makes the bridge tighter, larger makes it fuller. Each end has its own, and an end met at Position has none: its field is hidden.

Magnitude 0.5Magnitude 0.5 mode.startMagnitude(0.5).endMagnitude(0.5)

Turns soon after each rail, close to the straight line between the points.

Magnitude 2Magnitude 2 mode.startMagnitude(2).endMagnitude(2)

Runs on along each rail longer and swings round in a fuller S.

The code behind 0.5
rails.part.js
import { sketch, line, bridge } from 'fluidcad/core';

const rails = sketch('xy', () => {
const l1 = line([0, 0], [30, 0]);
const l2 = line([50, 20], [80, 20]);
return { l1, l2 };
});

// Magnitude 0.5 at each end: the bridge turns soon after it leaves a
// rail, staying close to the straight line between the two points.
const br = bridge(rails.geometries.l1.end(), rails.geometries.l2.start()).startMagnitude(0.5).endMagnitude(0.5);
The code behind 2
rails.part.js
import { sketch, line, bridge } from 'fluidcad/core';

const rails = sketch('xy', () => {
const l1 = line([0, 0], [30, 0]);
const l2 = line([50, 20], [80, 20]);
return { l1, l2 };
});

// Magnitude 2 at each end: the bridge runs on along each rail for longer
// before it turns, and swings round in a fuller S.
const br = bridge(rails.geometries.l1.end(), rails.geometries.l2.start()).startMagnitude(2).endMagnitude(2);

A small radius at an end against a long gap, or a large magnitude, can make the bridge loop. The preview shows it; lower the magnitude at that end.

Meeting a corner of a solid​

Code names a corner of a solid as the end of an edge through it, so with Tangent the bridge would follow whichever edge names the corner. Picking the corner's dot in the dialog sets that end to Position: the bridge lands on the corner and leaves the other end as you set it.

Tangent at the cornerTangent at the corner modebridge(l.end(), corner)

Follows the upright edge that names the corner: it comes straight down onto it.

Position at the cornerPosition at the corner mode.continuity('g1', 'g0')

Lands on the corner at its position only, leaving the rail along it.

The code behind Position at the corner

.continuity(start, end) sets each end: here the start keeps Tangent and the corner gets Position. One value sets both ends.

block.part.js
import { sketch, extrude, line, plane, bridge } from 'fluidcad/core';
import { rect } from 'fluidcad/shapes';
import { edge } from 'fluidcad/filters';

// A block 40 × 20, 10 tall.
sketch('xy', () => {
rect([0, 0], 40, 20);
});
const block = extrude(10);

// A rail in the air, to the left of the block.
const rail = sketch(plane('xy', 25), () => {
const l = line([-40, 10], [-15, 10]);
return { l };
});

// The same corner met at its position only: 'g0' at the end, while the
// start still leaves the rail along it. The dialog writes this when you
// pick the corner itself.
const br = bridge(rail.geometries.l.end(), block.sideEdges(edge().farthest('x').farthest('y')).end()).continuity('g1', 'g0');
The code behind Tangent at the corner
block.part.js
import { sketch, extrude, line, plane, bridge } from 'fluidcad/core';
import { rect } from 'fluidcad/shapes';
import { edge } from 'fluidcad/filters';

// A block 40 × 20, 10 tall.
sketch('xy', () => {
rect([0, 0], 40, 20);
});
const block = extrude(10);

// A rail in the air, to the left of the block.
const rail = sketch(plane('xy', 25), () => {
const l = line([-40, 10], [-15, 10]);
return { l };
});

// The block's far top corner is written as the end of the upright edge
// through it. Tangent there follows that edge: the bridge arrives heading
// into the edge, coming straight down onto the corner as if to run on
// down the edge.
const br = bridge(rail.geometries.l.end(), block.sideEdges(edge().farthest('x').farthest('y')).end());

Direction​

At an end of a curve the bridge continues the curve: it leaves From in the direction that curve was heading and arrives at To heading into that curve. There is nothing to flip. Swapping From and To gives the same curve, run the other way: the order only sets the direction of the result — where its start() and end() are.

Editing​

Double-click the Bridge row in the timeline. The view rolls back to just before the statement and the dialog reopens with each end on its own text as a Current: … chip, lit where it names an edge or a curve, and each end's Continuity and Magnitude as written.

Pick in a row to change that end; the chip's ✕ goes back to the statement's own. Apply rewrites only what you changed: an end, a continuity, a magnitude. Changing only a magnitude leaves both ends and the continuities as they were written. An end written as a point (a sketch point) stays as written and shows no preview until you pick it again.

In code​

import { bridge } from 'fluidcad/core';

const br = bridge(from, to)
.continuity('g2') // both ends; or .continuity(start, end)
.startMagnitude(1.5)
.endMagnitude(0.8);
ArgumentTakes
from, toA curve end: .start() or .end() of an edge selection (body.sideEdges(2).end()), of a curve (c.end()), of one edge of a curve (c.edges(0).start()), or of a sketch's line or arc (s.geometries.l1.end()). Or a point: a sketch point (s.geometries.p1) or a vertex, met at its position only.
Chained methodMeaning
.continuity(value)'g0' position, 'g1' tangent (default), 'g2' curvature, at both ends.
.continuity(start, end)Each end its own: .continuity('g1', 'g0').
.startMagnitude(n), .endMagnitude(n)How far the bridge keeps going along the curve at that end, against the gap. 1 by default; greater than zero. A number or a parameter.

The dialog writes each option only when it differs from its default, and no magnitude at an end met at Position. The ends are read, not used up: the curves and bodies they lie on stay in the model.

The result is one curve of one edge, running from from to to:

br.edges(0) // its edge
br.start() // where it starts: the from end
br.end() // where it ends: the to end — an end for another bridge

Like any curve, a bridge can be a sweep path or a loft guide (see Curves).

Errors​

SituationMessage
The two ends are at the same pointbridge: the two ends are at the same point.
A magnitude is zero or negativebridge: a magnitude must be greater than zero.
An end is .center(), an offset or a face anchorbridge: an end is the start or the end of an edge, or a point.
.continuity() takes something elsebridge: .continuity() takes 'g0', 'g1' or 'g2'.
Written inside a sketchbridge: is written outside a sketch; inside one, draw the curve with bezier().

See also​

  • Before: the curves and edges whose ends it joins: intersection, projected and offset curves, a sketch, a body's edge
  • After: join it with the curves it meets into one run, sweep along that run, or fill the loop it closes