Skip to main content

Trim a surface

Trimming a surface cuts it and keeps one side: the top of a wall cut off at a height, a skin cut back along a curve laid on it, two surfaces cut back to the line where they cross, a window cut out of a panel. The cut can be a plane, a sketch line, another surface, or a curve lying on the surface.

You trim with the Split tool (Split on the toolbar, beside Boolean) on its Face tab, keeping the Front side or the Back side. It writes split(cut, surface).keep('front'), and its row in the timeline is a Split row. The surface is replaced by the piece kept. With Both sides kept, the surface becomes two surfaces.

In the viewport​

  1. Click Split on the toolbar, right after Boolean. The Split dialog opens on the Solid tab; click the Face tab. Its Targets row is armed (blue border).
  2. Click the surface to trim, or its row in the timeline. The row takes the whole surface; a click takes the face you click, which is the whole surface when it has one face, as an extruded line or arc has. On a surface of several faces, click its row to trim it whole, or click faces to trim only those.
  3. Click the Cut row, then pick the cut: an origin plane or a plane(), a line or a curve of a sketch, another surface, or a curve lying on the surface. A click on a curve takes that curve, one of several where its statement holds more (see Picking a curve). Their rows in the timeline work too, a curve's row taking every curve of it.
  4. Set Keep to Front side or Back side, and check the preview: the piece that stays is green, the piece that goes is red. Switch to the other side to keep the other piece.
  5. Click Apply. The timeline gains a Split row, and the Shapes panel lists the piece kept as a Surface.
The Split dialog on the Face tab, a curved wall as the target, a projected curve as the cut and Front side kept
  1. 1
    Face
    The tab that divides faces: a surface’s, which falls apart into surfaces, or a solid’s, divided in place. The Solid tab cuts solids.
  2. 2
    Targets
    The faces to trim, numbered in the order the statement lists them: a surface whole, here the wall, or faces of it. Click a chip’s ✕ to drop it.
  3. 3
    Cut
    What cuts: a plane, a sketch line, a surface or a curve. One cut at a time; a new pick takes the place of the last one. Click its ✕ to clear it.
  4. 4
    Keep
    Front side or Back side keeps one piece; the preview shows which piece that is. Both sides, the default, keeps both as two surfaces.
  5. 5
    Apply
    Writes split(cut, surface).keep(side). Exit closes the dialog without writing anything.
  6. 6
    Statement
    The statement Apply will write, updated as you pick.

Surfaces or faces selected before you click Split open the Face tab with them in Targets.

Trim at a plane​

A plane cuts the surface where it crosses it, as far as the surface reaches. A curved wall cut 20 above the XY plane, keeping what lies below:

A curved wall cut level at a height of 20

The code behind it

The plane here is written in the code. In the dialog, pick an origin plane, or a plane() made with the Plane tool first, by its quad in the viewport or its timeline row.

wall.part.js
import { sketch, arc, extrude, plane, split } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// A curved wall: an arc of radius 50 swept 30 up, a surface.
const profile = sketch('xy', () => {
const a = arc([40, 0], [-40, 0], [0, -30]);
fix(a.start(), [40, 0]);
fix(a.end(), [-40, 0]);
fix(a.center(), [0, -30]);
});
const wall = extrude(30, profile).surface();

// Split: the cut is a plane 20 above XY, the target the wall.
// A plane's front is the side its normal points to, here up; Back keeps
// what lies below the plane. The wall is replaced by the piece kept, which
// the split statement now holds.
const lower = split(plane('xy', 20), wall).keep('back');

A plane's Front is the side its normal points to: +Z for XY, −Y for XZ, +X for YZ. A line of a sketch cuts the same way, along the plane it sweeps out of its sketch, and a curve of a sketch along the curved surface it sweeps (see Split along a sketch edge).

Trim along a curve​

A curve that lies on the surface cuts the surface along itself. The usual way to get one is to draw the cut in a sketch and lay it onto the surface with Curves › Project; the curve where two surfaces meet, from Curves › Intersect, lies on both. The curve must run across the surface from rim to rim, or close on itself inside it.

A slanted line drawn in front of the curved wall, projected onto it, then the wall trimmed along it:

The curved wall trimmed along a slanted curve, the part below it kept

The code behind it

In the dialog, pick the projected curve by clicking it or its row, Projected Curve 1. The dialog names it after its variable once it has one, here onWall.

wall.part.js
import { sketch, arc, line, extrude, plane, project, split } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// The curved wall of the previous example.
const profile = sketch('xy', () => {
const a = arc([40, 0], [-40, 0], [0, -30]);
fix(a.start(), [40, 0]);
fix(a.end(), [-40, 0]);
fix(a.center(), [0, -30]);
});
const wall = extrude(30, profile).surface();

// A slanted line drawn in front of the wall, laid onto it with
// Curves › Project: a curve lying on the wall from one end to the other.
const slant = sketch(plane('xz', -60), () => {
const l = line([-60, 6], [60, 26]);
fix(l.start(), [-60, 6]);
fix(l.end(), [60, 26]);
});
const onWall = project(slant, wall);

// Split: the cut is the curve, the target the wall. Front is to
// the right of the curve travelled the way it runs, seen from the wall's
// outer side: here the part below the slant. The curve leaves the screen
// once it has cut, and stays readable.
const trimmed = split(onWall, wall).keep('front');

For a curve, Front is to the right of the curve as it runs, looking at the surface from its outer side. A curve projected along a direction is looked at along that direction instead, the way its sketch is. The curve runs the way its source was drawn. Rather than work it out, look at the preview: the side that goes is red.

Front sideFront side modesplit(onWall, wall).keep('front')

Here, the part of the wall below the slant.

Back sideBack side modesplit(onWall, wall).keep('back')

The part above it.

Keep the back side
wall.part.js
import { sketch, arc, line, extrude, plane, project, split } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// The curved wall and the projected slant of the Front example.
const profile = sketch('xy', () => {
const a = arc([40, 0], [-40, 0], [0, -30]);
fix(a.start(), [40, 0]);
fix(a.end(), [-40, 0]);
fix(a.center(), [0, -30]);
});
const wall = extrude(30, profile).surface();

// A slanted line drawn in front of the wall, laid onto it with
// Curves › Project: a curve lying on the wall from one end to the other.
const slant = sketch(plane('xz', -60), () => {
const l = line([-60, 6], [60, 26]);
fix(l.start(), [-60, 6]);
fix(l.end(), [60, 26]);
});
const onWall = project(slant, wall);

// The same trim keeping the Back side: the part above the slant.
const trimmed = split(onWall, wall).keep('back');

The curve leaves the screen once it has cut, as a sketch does after an extrude. Its timeline eye shows it again, and later statements can still use it: to trim another surface with it, pick its timeline row.

Trim with another surface​

A surface cuts another where they cross. The cutting surface is not changed: it stays in the model, whole, and is often the next thing to trim.

Two flat surfaces standing across each other, the first trimmed by the second:

One surface trimmed back to the surface crossing it, which stays whole

The code behind it
panels.part.js
import { sketch, line, extrude, split, color } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// Two flat surfaces standing across each other, 50 high.
const aLine = sketch('xy', () => {
const l = line([-40, 0], [40, 0]);
fix(l.start(), [-40, 0]);
fix(l.end(), [40, 0]);
});
const a = extrude(50, aLine).surface();
const bLine = sketch('xy', () => {
const l = line([10, -40], [10, 40]);
fix(l.start(), [10, -40]);
fix(l.end(), [10, 40]);
});
const b = extrude(50, bLine).surface();

// Split: b cuts a where it crosses it. A cutting surface's front
// is the side its normal points to; Back keeps the part of a behind b. The
// cutter is a body of its own: it stays, whole, for the next step.
const aTrimmed = split(b, a).keep('back');

// Painted only so the picture tells the cutter from the trimmed surface.
color('#5b9bd5', b);

A cutting surface's Front is the side its normals point to. For a surface extruded from a sketch, that is the left of each curve as it was drawn, seen from the side the extrusion goes to.

To cut both back to the line where they meet, trim the second surface with what is left of the first, keeping the other side. Pick the first trim's Split row as the cut:

Two surfaces trimmed to each other, meeting along one edge

The code behind it
panels.part.js
import { sketch, line, extrude, split } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// The two surfaces of the previous example.
const aLine = sketch('xy', () => {
const l = line([-40, 0], [40, 0]);
fix(l.start(), [-40, 0]);
fix(l.end(), [40, 0]);
});
const a = extrude(50, aLine).surface();
const bLine = sketch('xy', () => {
const l = line([10, -40], [10, 40]);
fix(l.start(), [10, -40]);
fix(l.end(), [10, 40]);
});
const b = extrude(50, bLine).surface();

// First step: b trims a.
const aTrimmed = split(b, a).keep('back');

// Second step: the trimmed a trims b the other way round. The two surfaces
// now meet along one edge, a corner with nothing sticking out.
const bTrimmed = split(aTrimmed, b).keep('front');

A surface does not cut itself, and it parts no solid: given a solid as a target, it is refused (see Errors). Cut a solid with a plane or a sketch line on the Solid tab, or name its faces to divide them.

A window​

A closed curve lying on a surface, clear of its rims, divides it into the piece inside the curve and the surface around it. A circle drawn in front of the curved wall and projected onto it cuts a window:

The curved wall with a round window cut through it

The code behind it
wall.part.js
import { sketch, arc, circle, extrude, plane, project, split } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// The curved wall of the first example.
const profile = sketch('xy', () => {
const a = arc([40, 0], [-40, 0], [0, -30]);
fix(a.start(), [40, 0]);
fix(a.end(), [-40, 0]);
fix(a.center(), [0, -30]);
});
const wall = extrude(30, profile).surface();

// A circle drawn in front of the wall and projected onto it: a closed curve
// lying on the wall, clear of its rims.
const ring = sketch(plane('xz', -60), () => {
const c = circle([0, 15], 16);
fix(c.center(), [0, 15]);
});
const onWall = project(ring, wall);

// Split: a closed curve divides the wall into the disc inside it
// and the wall around it. Front keeps the wall with a window in it, Back
// the disc; the preview shows which is which.
const windowed = split(onWall, wall).keep('front');

Keep the other side, and the piece inside the curve is what stays: a disc shaped like the wall.

What a click takes​

RowYou clickThe row takesWritten as
TargetsThe timeline row of a surfaceThe whole surface: every face, and every surface the statement holdsIts variable, wall
TargetsThe face of a surface that is a single face, such as an extruded line or arcThe whole surfaceIts variable
TargetsA face of a surface of several facesThat faceA selector naming it, such as s.sideFaces(…); a piece of an earlier split through the split, sp.back()
TargetsA face of a solidThat face, divided in place; double-click for its group, right-click for a menu of its groupsA selector, such as block.endFaces()
CutAn origin plane's quadThat plane'xy', 'xz', 'yz'
CutA plane()'s quad, or its rowThe planeIts variable
CutA line, an arc, a circle, an ellipse or a spline of a sketch, or its rowWhat it sweeps out of its sketchs.geometries.l1
CutThe timeline row of a surfaceThe whole surfaceIts variable
CutA face of a surfaceThat face, the whole surface when it has one faceA selector, or its variable
CutA curve, or its rowThe whole curveIts variable
CutOne curve of a statement that holds severalThat curve aloneA selector, such as ic.edges(edge().closed())
CutFaces of a solidThose faces: a flat face, or several on one plane, is that plane; others cut as they areA selector, such as block.endFaces()
CutEdges of a solid or a surfaceThose edges, a curveA selector

In Targets, a click on a face already there takes it back off. In Cut, further faces, or further edges, of the same body join the cut; a pick of another kind takes the place of what the row held, and a click on what it holds takes it back off. A sketch's own row is no cut: pick one of its lines. While Cut is armed, the origin planes are shown so that you can pick them; a face, an edge or a curve under the cursor comes first, so click a plane where nothing else lies behind it.

A row of the timeline goes to the armed row. A row only the other one takes goes there instead and arms it: a plane()'s row while Targets is armed lands in Cut.

When nothing is cut​

A cut divides a surface only where it runs across it from rim to rim, or closes on itself inside it. A plane that misses the surface, a surface that crosses only part of it, or a curve that stops short of a rim leaves the surface as it is. The dialog says so beside the preview, and the timeline row carries the same warning once applied:

The Split dialog with a projected curve that stops short of the rims, and the warning that the cut divides none of the targets
  1. 1
    Cut
    A curve on the board that stops short of its rims.
  2. 2
    Warning
    The cut divides none of the surfaces it was given. A warning does not stop Apply: the statement would leave them as they are.

Extend the curve so it runs off the surface before you project it, or pick another cut. A cut that divides some targets and misses others says nothing: the targets it misses stay as they were.

Editing​

Double-click the Split row in the timeline. The view rolls back to just before the statement and the dialog reopens on the Face tab: Targets on the statement's targets as written, Cut on a Current: … chip holding its own cut, whatever it is, Keep as written. A pick in Cut replaces the cut, and its ✕ goes back to the statement's own. Apply rewrites only what you changed: a new side leaves the cut and the targets as written.

A statement written with the options object of earlier versions, split(onWall, { keep: 'front' }, wall), reopens on Front side as well. Choose Back side and Apply writes the side as the chain: split(onWall, wall).keep('back').

In code​

import { split } from 'fluidcad/core';

split('xz', s); // a surface at a plane: two surfaces
split(plane('xy', 20), s).keep('back'); // keep what lies below z = 20
split(other, s).keep('back'); // s cut where the surface other crosses it
split(project(sk, s), s).keep('front'); // trim s along a curve laid on it
split(onS, s.sideFaces(1)).keep('front'); // trim one face of s, leaving the rest as it is

Surfaces are split only when they are named: split('xz') with no targets splits every solid in scope and leaves surfaces alone. See Split for every argument.

Errors​

SituationMessage
A surface or a curve given a solid as a targetsplit: a surface cuts surfaces, not solids. (or a curve) Hint: Cut the solid with a plane or a sketched edge, or name its faces to divide them: split(cut, select(face()…)).
A surface and a solid as targets of one splitsplit: the targets mix solids with faces or surfaces. Hint: A split cuts solids, or divides faces: split the solids and the faces in two split() statements.
A curve that does not lie on the surfacesplit: the curve does not lie on target 1. Hint: Project it onto the surface first: project(curve, surface).
A curve with no target namedsplit: name the surface the curve lies on: split(curve, surface).
A surface given as its own cutsplit: target 1 cannot cut itself.

The dialog shows a refusal in place of the preview, and Apply answers with it instead of writing the statement, until you change the cut or the targets.

See also​

  • Before: the surface, and the cut: a plane, another surface, or a curve on the surface from Intersect, Project or Offset
  • After: fill the opening the trim left, or thicken the piece you kept