Skip to main content

Project

Project flattens 3D edges and faces onto the sketch plane. The projected curves are fixed reference geometry: the solver never moves them, they render as locked (green) geometry, and your sketch geometry can be constrained against them. It is how a feature follows the shape of what is already there.

In the viewport

  1. Click Project on the sketch toolbar. The Project dialog opens with one Selection slot.
  2. Click the 3D edges and faces to bring in — a face projects its outline, an edge projects itself. Picks accumulate as chips.
  3. Apply writes the project(…) statement at the top of the sketch body, where the references it creates are available to every constraint after it.

A gasket drawn from the projected lid outline

The code behind it
plate.part.js
import { sketch, line, fillet, extrude, project, offset } from 'fluidcad/core';
import { coincident, distance, fix, horizontal, vertical } from "fluidcad/constraints";

// A rounded housing lid, 100 × 60 × 30.
sketch("xy", () => {
const sg1 = line([-50, -30], [50, -30]);
const sg2 = line([50, -30], [50, 30]);
const sg3 = line([50, 30], [-50, 30]);
const sg4 = line([-50, 30], [-50, -30]);
coincident(sg1.end(), sg2.start());
coincident(sg2.end(), sg3.start());
coincident(sg3.end(), sg4.start());
coincident(sg4.end(), sg1.start());
horizontal(sg1);
vertical(sg2);
horizontal(sg3);
vertical(sg4);
fix(sg1.start(), [-50, -30]);
distance(sg1.start(), sg1.end(), 100);
distance(sg2.start(), sg2.end(), 60);
fillet(8, sg1, sg2, sg3, sg4)
})

const e = extrude(30)

// A gasket that follows the lid's outline, drawn on its top face.
sketch(e.endFaces(), () => {
// The top face outline, flattened onto this sketch as fixed reference
// geometry. It is a guide so it stays out of the profile.
const outline = project(e.endFaces()).guide()
// Inset it — the offset is the gasket's inner edge; the region between
// the two offsets is the gasket.
offset(-4, outline)
offset(-9, outline)
})

By hand

project(e.endFaces()) // a face → its outline
project(e.endEdges()) // just the edges
project(face1, face2, edge1) // several sources at once

Projections usually carry .guide() so the outline stays out of the profile and only the geometry built against it is extruded or cut.

Constraining against a projection

A projection is a first-class constraint target:

sketch(e.endFaces(), () => {
const rim = project(e.endEdges()).guide() // a single edge: use it directly
const c = circle([10, 0], 12)
concentric(c, rim) // a bore concentric with the rim
})

When a projection produces several edges, address one with .ref(i) and its points with the usual accessors:

const outline = project(e.endFaces()).guide() // four edges, say
coincident(p, outline.ref(0).start())
distance(outline.ref(2), c.center(), 25)
tangent(outline.ref(1), l)

Because references are fixed, a sketch made only of projections reports Fully constrained by itself — the geometry you add is what brings degrees of freedom.

intersect() is the companion statement: instead of flattening along the sketch normal, it cuts the sketch plane through 3D objects and brings the section curves in, with the same fixed-reference behaviour.