Skip to main content

Offset

Offset runs a curve beside edges at a constant distance, lying on the faces the edges lie on: a line set back from an edge of a body where a trim, a groove or a two-tone split runs, the inner boundary of a band along a rim, a curve beside a projected curve on the same surface. The edges and the faces stay as they are; the result is a curve.

This is the Curves menu's Offset. The Surfaces menu's Offset makes a surface at a distance from faces, and the sketch toolbar's Offset offsets sketch geometry. All three write offset(…); how the statement is written tells them apart (see In code).

In the viewport​

  1. Open the Curves menu on the toolbar and click Offset. The Offset curve dialog opens with the Edges row armed (blue border).
  2. Click the edges to run beside. An edge of a solid or a surface takes that edge; a click on a sketch takes the whole sketch, and an edge of a curve (a projected curve, an intersection curve) that curve — the whole statement unless it holds several, see Picking a curve. A sketch's or a curve's row in the timeline works too. Once Edges holds a pick, On faces is armed.
  3. Click the faces the edges lie on, where the curve is to run. A click on a face takes that face, of a solid or of a surface; a surface that is a single face, such as an extruded line, is taken whole, as its row in the timeline takes any surface. The dialog does not fill this row from the edges: pick the faces yourself.
  4. Set the Distance. As soon as both rows hold a pick and the distance reads, the curve previews in blue.
  5. Click Apply. The timeline gains an Offset Curve row and the statement is written to the file.
The Offset curve dialog with the four top edges and the four side faces of a block picked, distance 3
  1. 1
    Edges
    The edges the curve runs beside. Takes several picks: edges of solids and surfaces, whole sketches and curves. Click a chip’s ✕ to drop it.
  2. 2
    On faces
    The faces the edges lie on; the curve lies on them too. Faces of solids and of surfaces, and whole surfaces. Click a row to arm it before picking for it.
  3. 3
    Distance
    How far the curve is from the edges, measured straight through space. A number or an expression, never zero; a negative distance goes to the other side.
  4. 4
    Apply
    Writes offset(distance, edges, { on: faces }). Both rows need a pick. Exit closes the dialog without writing anything.

If the curve cannot be made, the dialog says why instead of drawing a preview: nothing on that side of the edges lies on the faces at that distance, the distance is larger than a bend of the edges allows on that side, or the edges are not on the faces.

A loop 3 below the top rim of a block, on its side faces. Double-click a top edge to take the whole rim, and a side face to take every side face; the dialog writes them as box.endEdges() and box.sideFaces():

A loop 3 below the top rim of a block

The code behind it

The dialog names picked edges and faces with selectors of its own; any edge or face selection, a curve, a sketch or a surface works in their place.

block.part.js
import { sketch, extrude, offset } from 'fluidcad/core';
import { rect } from 'fluidcad/shapes';

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

// A loop 3 below the top rim, on the four side faces. The top edges are the
// rim of those faces — each edge has one of them beside it — so a positive
// distance goes onto the faces, down the walls. The edges and the faces are
// read, not used up: the block stays as it is.
const band = offset(3, box.endEdges(), { on: box.sideFaces() });

Picking several edges or faces at once​

  • Double-click an edge or a face of a solid: the armed row takes the whole group it belongs to, such as the rim an edge is on or every side face of an extrude; an edge on a surface's open rim takes the rim loop.
  • Right-click an edge or a face of a solid: a menu lists the groups it belongs to, such as its tangent edges, the loops it is on and the edges or faces of the feature that made it. Hover an item to preview it; click it to add it to the armed row.

A sketch and a face of a surface already stand for the whole object, so neither gesture applies to them. On one curve of a statement that holds several, a double-click takes all of its curves.

Distance and side​

The distance is measured straight through space, not along the faces: every point of the curve is that far from the nearest point of the edges. On a flat face the two are the same; on a curved face or across a bend, the gap measured along the surface is a little longer.

The side depends on where the edges lie on the faces you picked:

  • From a rim — edges along the boundary of the picked faces, with a picked face on one side only, as a block's top edges are with its side faces — a positive distance goes onto the faces. A negative one goes off them, where there is nothing, and the dialog says the curve leaves the faces.
  • Anywhere else — edges inside the faces, or with a picked face on both sides — stand on the outside of the faces and walk along the edges the way they run: a positive distance is to the left, a negative one to the right.

The preview shows which side you get; to flip it, change the sign.

Picking the top face as well as the side faces puts a picked face on both sides of each top edge. The edges run counter-clockwise seen from above, so their left is the top face and their right the side faces:

Distance 4Distance 4 modeoffset(4, box.endEdges(), { on: [box.endFaces(), box.sideFaces()] })

Left of the edges: a loop 4 in from the rim, on the top face.

Distance −4Distance −4 modeoffset(-4, box.endEdges(), { on: [box.endFaces(), box.sideFaces()] })

Right of the edges: a loop 4 below the rim, on the side faces.

The code behind distance 4
block.part.js
import { sketch, extrude, offset } from 'fluidcad/core';
import { rect } from 'fluidcad/shapes';

sketch('xy', () => {
rect([0, 0], 60, 40).centered();
});
const box = extrude(30);

// The top face and the side faces together: each top edge now has a face
// on both sides, so the side follows the edges' direction. They run
// counter-clockwise seen from above, and standing on the top face a
// positive distance is to their left: inward, a loop 4 in from the rim.
const inset = offset(4, box.endEdges(), { on: [box.endFaces(), box.sideFaces()] });
The code behind distance −4
block.part.js
import { sketch, extrude, offset } from 'fluidcad/core';
import { rect } from 'fluidcad/shapes';

sketch('xy', () => {
rect([0, 0], 60, 40).centered();
});
const box = extrude(30);

// The same edges and faces, the sign flipped: to the right of the edges,
// down the side faces, a loop 4 below the rim.
const band = offset(-4, box.endEdges(), { on: [box.endFaces(), box.sideFaces()] });

At a corner of the edges the curve is rounded on the outside, by an arc about the corner, and stays sharp on the inside, as a 2D offset is. An open curve ends square to the edges at their ends; closed edges give a closed loop.

Beside a curve on a surface​

Pick a projected curve (its row in the timeline, or one of its edges) in Edges and the surface it lies on in On faces: the offset runs beside it on the surface. Change the sign for the other side. A rectangle laid onto a dome, with a curve 3 to each side of it:

A curve projected onto a dome and a curve to each side of it

The code behind it
dome.part.js
import { sketch, sphere, split, plane, project, offset, select } from 'fluidcad/core';
import { rect } from 'fluidcad/shapes';
import { face } from 'fluidcad/filters';

// The dome: a ball of radius 40 cut flat at XY, its top half kept.
const ball = sphere(40);
split('xy', ball).keep('front');
const dome = select(face().sphere());

// A rectangle drawn above the dome and laid onto it.
const logo = sketch(plane('xy', 60), () => {
rect([0, 0], 30, 20).centered();
});
const mark = project(logo, dome);

// A curve 3 to each side of the projected one, on the dome. The rectangle
// runs counter-clockwise seen from above: to its left is inside, to its
// right outside. Outside, the corners are rounded by arcs about them;
// inside they stay sharp. The projected curve hides and stays readable.
const inner = offset(3, mark, { on: dome });
const outer = offset(-3, mark, { on: dome });

Editing​

Double-click the Offset Curve row in the timeline. The view rolls back to just before the statement and the dialog reopens with each row on its argument as Current: … chips, lit where it names edges, faces, a curve or a surface, and the Distance as written.

Pick in a row to change it. Where the row names edges or faces, the first pick adds to them and a chip's ✕ takes one off; anything else in the row is replaced by the pick. Apply rewrites only what you changed: a row, the distance. Changing only the distance leaves both rows as they were written.

In code​

import { offset } from 'fluidcad/core';

const oc = offset(distance, edges, { on: faces });
ArgumentTakes
distanceA length or an expression, not zero. Its sign picks the side.
edgesCurves: a selection of edges, a curve (a helix, an intersection, projected or offset curve), a sketch, or a list of those. They must lie on the faces.
{ on }The faces the curve lies on: a face selection (faces of solids or of surfaces), a surface, a solid (all its faces), or a list of those. Required, and the only option.

offset has three meanings; where and how the call is written decides which:

WrittenMeaning
inside a sketch() callbackthe sketch offset of sketch geometry
outside a sketch, with { on }an offset curve, this page
outside a sketch, without { on }an offset surface: the faces moved along their normals

A sketch or a curve given as the edges hides and stays readable: a later statement can read it again. Edges of a body and the faces are read, not used up.

One curve per chain​

The result holds one curve for each connected chain of the edges, each running the way its source runs, in the order of the sources.

oc.edges() // every edge, curve after curve, each in the order it runs
oc.edges(0) // one edge
oc.start() // where the first curve starts
oc.end() // where it ends

Like any curve, an offset curve can be a sweep path: set a plane square to it at its start and sweep a profile along it (see Curves).

Errors​

SituationMessage
The edges do not lie on the facesoffset: the edges do not lie on the faces given in { on }.
Nothing on that side of the edges lies on the faces at that distanceoffset: at this distance the curve leaves the faces.
The distance is larger than a bend of the edges allows on that sideoffset: the distance is larger than the curve's tightest bend allows on this side.
The distance is zerooffset: the distance is zero.
{ on } is empty, or holds something that is not a scene objectoffset: { on } needs the faces the curve lies on.
The options object has another key, or no onoffset: the only option is { on: faces }.
The edges forkoffset: the source branches at (x, y, z); a curve cannot fork.

A fork is three or more curve ends meeting at one point, as in a T: remove one of the curves that meet there, or give each branch a statement of its own. Curves that meet without sharing an end are not a fork but separate curves: a line that ends on the middle of another, a line touching a circle, two curves that cross.

Limitations​

  • The distance is always straight through space; there is no distance measured along the surface.
  • The curve ends square to the ends of the edges; it is not run out to the edges of the faces.
  • The On faces row is not filled from the picked edges.
  • A curve that leaves the faces and comes back (across a hole, say) is refused with the tightest-bend message.

See also​