Skip to main content

Fill

Fill makes a surface inside a closed loop of edges and curves. It has three typical uses:

  • Closing an opening of a surface: the end of a tube, a hole in a skin, or the opening Delete face leaves when it takes a face off a solid.
  • A face from a ring of curves that no extrude, revolve, sweep or loft describes: a patch with three sides, with five, with a wavy outline.
  • A flat face inside a closed sketch, as a surface.

The fill can meet the faces next to its boundary at an angle, tangent to them or with the same curvature, and it can be pulled through points and curves inside the loop. It is a surface of one face. Where its boundary runs along the rim of a surface, the fill joins that surface, and a surface with no opening left becomes a solid (see Joining the surface it fills). Elsewhere the fill is a body of its own.

In the viewport​

  1. Open the Surfaces menu on the toolbar and click Fill. The Fill dialog opens with the Boundary row armed (blue border).
  2. Pick the boundary side by side: the edges and curves that go round the loop, in any order. A click takes one edge: an edge of a body, or one line or arc of a sketch. Double-click takes the whole loop a rim edge of a surface lies on, or the whole chain a sketch line is drawn in.
  3. The fill previews in green from the second or third pick on. While the loop is still open the preview is a stand-in (see While the boundary is open); once it closes, it is the surface Apply will make.
  4. Choose a Continuity, and for Tangent or Curvature the Adjacent faces if the fill needs them (see Continuity).
  5. Leave Join chosen at the top of the dialog to join the fill to the surfaces whose rim it runs along, or choose New to keep it a surface of its own (see Joining the surface it fills).
  6. Click Apply. The timeline gains a Fill row. In the Shapes panel, a fill that joined a surface takes that surface's place: a Surface while an opening is left, a Solid once none is. A fill that joined nothing appears as a Surface of its own.
The Fill dialog with Join chosen, the top rim of a post picked, Tangent chosen and the post's wall picked as the adjacent face
  1. 1
    Join / New
    With Join, the fill becomes one body with the surfaces whose rim it runs along, a solid once no opening is left. With New, it stays a surface of its own.
  2. 2
    Boundary
    The closed loop to fill. Takes several picks: edges of solids and surfaces, single lines and arcs of sketches, and curves. Click a chip’s ✕ to drop it.
  3. 3
    Continuity
    How the fill meets the faces beside its boundary: Position, Tangent or Curvature.
  4. 4
    Adjacent faces
    The faces to be continuous with. Optional; shown for Tangent and Curvature. Left empty, the fill follows the faces along a surface’s rim.
  5. 5
    Guides
    Points and curves the fill passes through. Optional.
  6. 6
    Apply
    Writes fill(boundary) with its options, and .new() for New. Exit closes the dialog without writing anything.
  7. 7
    Statement
    The statement Apply will write, updated as you pick.

Edges selected before you click Fill go into the Boundary row. The selection goes in whole or not at all: with a face or a vertex among it, the row opens empty.

While the boundary is open​

A boundary is picked one side at a time, so for most of the picking it is not closed yet. The dialog previews all the same: it closes the picks with a straight side across each gap and draws the surface over that. Three lines of a rectangle picked, the fourth still missing:

Three sides of a rectangle picked in the Fill dialog, the surface previewed across the open side, and an orange line naming the two open ends

This preview is only feedback. It shows where the fill is going, not the surface you will get: the straight sides are a guess at what you have not picked yet. The orange line under the dialog says so and names the open ends. While it shows, Apply writes nothing; pick the missing side, and the preview becomes the real one.

Picks that cannot enclose anything, such as one straight edge, show the message alone. In code there is no stand-in: fill() of an open boundary fails with the same message.

Closing an opening​

A circle extruded on the Surface tab is a tube with no ends. Double-click its top rim in the Boundary row and apply:

A tube closed at the top by a flat lid

The code behind it

The dialog names edges with a selector, here tube.endEdges(), and gives the tube's statement a variable if it has none. It names the statement Fill n.

tube.part.js
import { sketch, circle, extrude, fill, color, origin } from 'fluidcad/core';
import { coincident, diameter } from 'fluidcad/constraints';

// A circle extruded 30 up on the Surface tab: a tube open at both ends.
const ring = sketch('xy', () => {
const c = circle([0, 0], 40);
coincident(c.center(), origin());
diameter(c, 40);
});
const tube = extrude(30, ring).surface();

// Surfaces › Fill with the tube's top rim double-clicked into Boundary. The
// rim is one closed loop lying in a plane, and nothing else is asked, so the
// fill is that plane exactly: a flat lid. The rim is the tube's, so the lid
// joins the tube: one surface, a cup still open at the bottom.
const lid = fill(tube.endEdges());

// lid.faces() is the lid's own face, painted only so the picture tells it
// from the tube.
color('#5b9bd5', lid.faces());

A loop that lies in a plane, with Position continuity and no guides, is filled with that plane exactly: the lid is flat, not a fitted surface that happens to be flat.

The lid joins the tube, and the two are one surface, open at the bottom. Fill the bottom rim as well and no opening is left: the tube becomes a solid.

const cup = fill(tube.endEdges()); // the top: one surface, open at the bottom
const can = fill(cup.boundaryEdges()); // the bottom, the last opening: a solid

A face from a ring of curves​

The boundary may mix edges of bodies with curves and lines of sketches, as long as together they close one loop. Here two walls of a quarter pipe leave a gap. The top rim of one, the bottom rim of the other and two sketch lines go round it:

Two walls of a quarter pipe with the gap between them closed by a patch

The code behind it
pipe.part.js
import { sketch, line, arc, extrude, plane, fill, color } from 'fluidcad/core';
import { fix } from 'fluidcad/constraints';

// A quarter of a pipe of radius 20, with a gap in it: one wall from z = 0
// to 30, a second from z = 45 to 75.
const quarter = (on) => sketch(on, () => {
const a = arc([0, -20], [20, 0], [0, 0]);
fix(a.start(), [0, -20]);
fix(a.end(), [20, 0]);
fix(a.center(), [0, 0]);
});
const low = extrude(30, quarter('xy')).surface();
const high = extrude(30, quarter(plane('xy', 45))).surface();

// The two straight sides of the gap, each a line in a sketch.
const sideX = sketch('xz', () => {
const l = line([20, 30], [20, 45]);
fix(l.start(), [20, 30]);
fix(l.end(), [20, 45]);
});
const sideY = sketch('yz', () => {
const l = line([-20, 30], [-20, 45]);
fix(l.start(), [-20, 30]);
fix(l.end(), [-20, 45]);
});

// Surfaces › Fill: the top rim of the low wall, the bottom rim of the high
// one and the two lines make one closed loop of four sides. Tangent
// continuity makes the patch flow out of both walls: each rim has one face
// beside it, and the fill follows that face. The two lines have no face
// beside them and are met in position. The patch runs along a rim of each
// wall, so it joins them: one surface from z = 0 to 75.
const patch = fill(low.endEdges(), sideX, high.startEdges(), sideY).continuity('g1');

// patch.faces() is the patch's own face, painted so the picture tells it
// from the walls.
color('#5b9bd5', patch.faces());

The patch runs along a rim of each wall, so it joins both: the two walls and the patch become one surface.

A side that is missing is usually a line in a sketch, or a bridge between two ends. The loop may have any number of sides. A boundary with a hole in it (a second loop inside the first) is not supported.

A flat face in a closed sketch​

Pick the lines of a closed sketch into Boundary, or double-click one of them to take them all, and the fill is the flat face inside them. To take a sketch whole, whatever it holds, click its row in the timeline:

A flat face with one round end

The code behind it
plate.part.js
import { sketch, line, arc, fill, origin } from 'fluidcad/core';
import { coincident, distance, horizontal, radius, tangent, vertical } from 'fluidcad/constraints';

// A closed outline: three lines and an arc, drawn end to end.
const outline = sketch('xy', () => {
const a = line([0, 0], [40, 0]);
const b = arc([40, 0], [40, 30], [40, 15]);
const c = line([40, 30], [0, 30]);
const d = line([0, 30], [0, 0]);
coincident(a.end(), b.start());
coincident(b.end(), c.start());
coincident(c.end(), d.start());
coincident(d.end(), a.start());
coincident(a.start(), origin());
horizontal(a);
horizontal(c);
vertical(d);
tangent(a, b);
distance(a.start(), a.end(), 40);
radius(b, 15);
});

// Surfaces › Fill with the sketch clicked into Boundary: the flat face
// inside the outline, as a surface with no thickness. The sketch is hidden
// and stays readable, as it does after an extrude.
fill(outline);

This is the surface an extrude of the same sketch would start from. Thicken it for a plate.

What a click takes​

You clickThe row takesWritten as
An edge of a solid or a surfaceThat edgeA selector, such as tube.endEdges()
A line, an arc, a circle, an ellipse or a spline of a sketchThat one curveThrough its sketch: s.geometries.l1
A side of a rectangle, a slot or another shape one statement drawsThe whole sketchIts variable
The timeline row of a sketchThe whole sketchIts variable
A curve (a bridge, a composite, a projected curve) or its timeline rowThe whole curveIts variable
One curve of a statement that holds several, such as an intersection's Curve 1That curve alone; a double-click or the row takes them allA selector, such as ic.edges(edge().closed())

A sketch line picked on its own is named through its sketch. The dialog gives the sketch a variable and the line a name if they have none, and returns the line from the sketch: const s = sketch(…, () => { const l1 = line(…); return { l1 }; }). Only the lines the fill names are hidden afterwards; the rest of the sketch stays on screen. A rectangle is one statement that draws four sides, so its sides have no names of their own: a click on one takes the sketch.

On an edge of a body, double-click takes the loop it lies on when it is a rim edge of a surface, and otherwise the group it belongs to, such as the end edges of an extrude. On a sketch line, double-click takes the lines that run on from it end to end: the chain, or the closed loop. Right-click on an edge of a body opens a menu of its loops, tangent chains and other groups; hover an item to preview it, click it to add it.

The Adjacent faces row takes single faces: a click on a face takes that face, on a solid and on a surface alike, and never a whole surface. The Guides row takes what Boundary takes, and vertices too.

Continuity​

Continuity says how the fill meets the faces beside its boundary:

ContinuityThe fill
Position (the default)meets its boundary and nothing more. It creases against the faces beside it.
Tangentleaves each matched edge in the direction of the face beside it: no crease.
Curvaturealso bends as that face bends where they meet.

The top of the tube above, with each:

PositionPosition modefill(tube.endEdges())

A flat lid, creased against the wall.

TangentTangent modefill(tube.endEdges()).continuity('g1')

A dome that rises out of the wall.

CurvatureCurvature modefill(tube.endEdges()).continuity('g2')

A fuller dome. It builds with a warning: see below.

One continuity holds for the whole fill, and it applies to the boundary edges that are matched to a face. Which edges are matched depends on what lies beside them and on the Adjacent faces row:

Boundary edgeAdjacent faces emptyAdjacent faces picked
A rim edge of a surface (one face beside it)matched to that facematched if that face is picked, otherwise position only
An edge of a solid (two faces beside it)position only, with a warning that names the edgematched to the picked one of the two; both picked is an error
A curve or a sketch (no face beside it)position onlyposition only

So for the rim of a surface, choosing Tangent is enough. For an edge of a solid the fill cannot know which of the two faces to follow, and you pick it. A round post, its top rim as the boundary and Tangent chosen:

The Fill dialog with a warning that edge 1 lies between two faces and was matched by position only
  1. 1
    Adjacent faces
    Click the row, then the face to follow: the post’s wall.
  2. 2
    Warning
    What the fill would build with, short of what was asked. A warning does not stop Apply.

With the wall picked, the warning goes and the fill becomes a dome that leaves the rim going straight up, as the wall does:

A round post closed by a dome that continues its wall

The code behind it
post.part.js
import { sketch, circle, extrude, fill, color, origin } from 'fluidcad/core';
import { coincident, diameter } from 'fluidcad/constraints';

// A round post, 30 across and 20 high: a solid.
sketch('xy', () => {
const c = circle([0, 0], 30);
coincident(c.center(), origin());
diameter(c, 30);
});
const post = extrude(20);

// The post's top rim lies between two faces: its flat top and its round
// wall. A tangent fill can follow only one of them, and `.adjacent()` says
// which: the wall. The fill leaves the rim going straight up, as the wall
// does, and closes over the post as a dome. With the top face listed
// instead, it would lie flat on it.
const dome = fill(post.endEdges()).continuity('g1').adjacent(post.sideFaces());

color('#5b9bd5', dome);

Adjacent faces is hidden for Position, where it would do nothing, and the statement then writes no .adjacent().

What a continuous fill can reach​

The fill is a fitted surface, and some requests have no good answer. What to expect:

  • The end of a round tube, or a hole's rim with the hole's wall picked. A tangent fill is a dome, about half as high as the opening is wide. It cannot be flat: flat would crease against the wall.
  • Curvature on such an end builds, and warns that it is a little off tangent (about 0.7°) and does not match the curvature. Use Tangent unless you need the fuller shape.
  • Faces that meet at a corner of the boundary cannot all be continued: no smooth surface is tangent to two walls at the corner where they meet. The end of a square tube, or the top of an opened box, with Tangent is refused, and the message names the corner. Cap it with Position, or round the corner first with a fillet on the edge between the two walls.
  • A gap between two walls is met tangent across a quarter of a pipe. With Curvature a wide gap may come out tangent only, with a warning.

A fill that builds is never refused for missing its continuity. It builds, and the warnings say how far off it is.

Guides​

A guide is a point or a curve inside the loop that the fill must pass through. Click the Guides row, then a vertex, an edge, a curve or a line of a sketch. A rectangle, and a point 12 above its middle:

A rectangular surface rising to a rounded peak in its middle

The code behind it

A sketch point is named through the sketch's return value, so the dialog adds return { p } to the sketch when you click the point.

dome.part.js
import { sketch, line, point, plane, fill, origin } from 'fluidcad/core';
import { coincident, distance, fix, horizontal, vertical } from 'fluidcad/constraints';

// A closed rectangle, 40 by 30.
const outline = sketch('xy', () => {
const a = line([0, 0], [40, 0]);
const b = line([40, 0], [40, 30]);
const c = line([40, 30], [0, 30]);
const d = line([0, 30], [0, 0]);
coincident(a.end(), b.start());
coincident(b.end(), c.start());
coincident(c.end(), d.start());
coincident(d.end(), a.start());
coincident(a.start(), origin());
horizontal(a);
vertical(b);
horizontal(c);
vertical(d);
distance(a.start(), a.end(), 40);
distance(b.start(), b.end(), 30);
});

// A point 12 above the middle of the rectangle, in a sketch of its own. The
// sketch returns it, so that the fill can name it from outside.
const marks = sketch(plane('xy', 12), () => {
const p = point([20, 15]);
fix(p, [20, 15]);
return { p };
});

// Without the guide this is the flat rectangle. With it, the fill keeps
// its boundary and rises to pass through the point: a dome 12 high.
fill(outline).guides(marks.geometries.p);

A guide curve is met closely along its middle and a little less closely at its two free ends. A guide the surface cannot reach, such as a point beside the loop instead of over it, gives a warning. Guides that fight each other or a tangent boundary are refused.

Joining the surface it fills​

Where the boundary runs along the rim of a surface, the fill is joined to that surface: the two are sewn together along the rim, share its edges and become one body. Join, chosen when the dialog opens, does this, and the statement is fill(…) with nothing more.

Boundary edgeJoined
A rim edge of a surface (one face of the surface beside it)That surface
An edge between two faces of a surfaceNothing
An edge of a solidNothing
A curve, a sketch, or a line of a sketchNothing
  • Every surface with a rim edge in the boundary is joined. Several surfaces and the fill become one body: the two walls of the patch above, or the two halves of a tube's end.
  • While the body still has an opening, it is a surface. Once no rim is left, it is a solid: the top of a box opened with Delete face, or the second end of a tube.
  • The fill is never fused with a solid, not even one whose edges it runs along. It takes the place of the surfaces it joins and of nothing else.
  • With nothing to join, as on a sketch, on curves or on edges of a solid, the fill is a surface of its own.

The joined surfaces leave the Shapes panel: the fill's statement holds the body now. A variable that named one of them reaches the body, so color('red', opened) after the fill paints the whole of it, and colours painted on a surface before the fill stay on its faces.

New keeps the fill a surface of its own and writes fill(…).new(). The surface and the fill then lie edge to edge as two bodies. A lid needs that when it is to be thickened together with the walls into a hollow part (see Delete face).

The boundary is read, not used up, apart from the surfaces the fill joins. A sketch or a curve in it is hidden and stays readable, as after an extrude; an edge of a solid leaves the solid as it is.

On the rim of a surface the fill faces as the faces beside it do, whatever order the rim's edges are given in: a lid on an opened box faces up, as the box's top did. Elsewhere, on a sketch, on curves or on edges of a solid, its side follows the direction the boundary is walked in. Before you thicken such a fill, look at the thicken preview, and use a negative thickness for the other side.

Editing​

Double-click the Fill row in the timeline. The view rolls back to just before the statement and the dialog reopens with Join or New, the boundary, the adjacent faces and the guides on chips, and the Continuity, as written.

  • In Boundary and Adjacent faces, a pick adds to what the statement has, and a chip's ✕ takes a piece off.
  • In Guides, each guide is a chip as written. A chip's ✕ takes it out; a pick adds one after the others.
  • Emptying Adjacent faces or Guides removes .adjacent() or .guides() from the statement.
  • Switching to Position removes .continuity() and .adjacent() and leaves the guides.
  • Switching to New adds .new(), and switching to Join takes it out.

Apply rewrites only what you changed. A guide point that lies on a vertex, such as a point of a sketch or a corner of a body, previews as that vertex. A point no vertex lies at, such as the centre of a circle, has nothing in the viewport to stand for it: while its chip is kept the dialog shows no preview, so apply to see the result. A statement written in a form the dialog cannot hold opens no dialog: a message says why, and you edit it in the source.

In code​

import { fill } from 'fluidcad/core';

fill(tube.endEdges()); // a flat lid on a rim, joined to the tube
fill(opened.boundaryEdges()); // the opening Delete face left: a solid again
fill(opened.boundaryEdges()).new(); // a lid of its own beside the opened body
fill(a, b, c, d); // four curves round a loop
fill(outline); // the face inside a closed sketch
fill(wall.endEdges(), s.geometries.l1, s.geometries.l2); // an edge of a body and two lines of a sketch
fill(rim).continuity('g1'); // tangent to the faces along a surface's rim
fill(rim).continuity('g2').adjacent(wall); // curvature, continuing the faces given
fill(outline).guides(marks.geometries.p, crown); // through a point and a curve
ArgumentTakes
...boundaryCurves forming one closed loop: selections of edges (s.endEdges(), select(edge()…)), curves, sketches, single lines or arcs of a sketch returned from it (s.geometries.l1), or lists of those.
Chained methodMeaning
.continuity('g0' | 'g1' | 'g2')Position (the default), tangent or curvature.
.adjacent(...faces)The faces to be continuous with: face selections, or a surface or a solid for all of its faces.
.guides(...guides)Points and curves the fill passes through: vertices (e.endEdges(0).start()), sketch points, curves, sketches, edge selections.
.new()The fill stays a surface of its own: it is not joined to the surfaces whose rim it runs along.

The methods chain in any order. A select(…) cannot be written inside .adjacent(…) or .guides(…): declare it on a line before the fill.

A loop is easiest to give with a filter: select(edge().boundary().farthest('z').withChain()) is the rim loop at the top of a surface.

The result names its own face and the rim it still has:

const fl = fill(tube.endEdges());

fl.faces() // the fill's own face, joined or not
fl.boundaryEdges() // the rim the result still has: here the tube's other end; none for a solid

With .new(), or with nothing to join, boundaryEdges() is the loop the fill fills.

Errors and warnings​

A refusal shows in the dialog in place of the preview, and on the row in the timeline:

SituationMessage
The boundary is openfill: the boundary is not closed: it has open ends at (0, 0, 0) and (0, 10, 0). Add the missing side, or bridge the gap.
The boundary is several loopsfill: the boundary is 2 separate loops; a fill takes one.
The boundary forksfill: the boundary branches at (20, 10, 0); a curve cannot fork.
A curve lies on an edge that is in the boundary toofill: two boundary pieces overlap at (20, 0, 0).
Both faces beside an edge are adjacent facesfill: both faces beside edge 1 are in .adjacent(); list the one to be continuous with.
Tangent or Curvature where two faces beside the boundary meet at an angle at a corner, such as the top of an opened boxfill: the faces beside the boundary meet at an angle at (140, 0, 10): one surface cannot be tangent to both. Use Position, leave one of the two faces out of Adjacent faces, or round the corner first (a fillet on the edge between the two faces).
No surface fitsfill: could not fit a surface to this boundary (…what went wrong…). Try Position, fewer guides, or simpler patches.
A guide point taken on a selection that matches nothingfill: guide 1 names no point.
The fill could not be joined to a surface along its rimfill: the surface could not be joined to the surface from line 4 along its rim. Choose New to keep the fill a surface of its own.

While you are still picking the loop, the dialog shows the open-boundary message in orange beside a stand-in preview (see While the boundary is open); it goes when the loop closes. A fill that could not be joined shows its message the same way, in orange beside the preview of the fill, and Apply writes nothing until you choose New or change the picks.

A warning does not stop the fill. It shows under the dialog in orange, and afterwards as a mark on the timeline row:

SituationWarning
An edge of a solid with neither face pickedfill: edge 2 lies between two faces and was matched by position only; list one of them in .adjacent(). The number is the edge's place round the loop, from 1.
An adjacent face that is not beside the boundaryfill: a face in .adjacent() is not beside the boundary.
.adjacent() written with position continuityfill: .adjacent() has no effect with position continuity.
The tangent was not reachedfill: the surface is up to 90° off tangent to its adjacent faces.
The curvature was not reachedfill: the surface does not match the curvature of its adjacent faces.
The surface misses its boundary or a guidefill: the surface is up to 0.047 away from its boundary. / fill: the surface passes up to 80 from its guides.

See also​