Trimming
trim() removes sketch edges — either by matching edge filters or by interactively picking segments.
In practice, trimming is rarely needed — overlapping sketch geometries are automatically fused when extruded or cut. Trimming is mainly useful when you need precise control over which segments form the final profile.
Removing edges with filters
Pass edge filters to trim() to remove all matching edges entirely:
sketch("xy", () => {
circle([25, 0], 120)
circle([-25, 0], 100)
rect(200, 10).centered()
// Remove all circle edges
trim(edge().circle())
})
You can match specific sizes or pass multiple filters (each filter is OR'd):
// Remove circles with a specific diameter
trim(edge().circle(120))
// Remove all arcs and all lines
trim(edge().arc(), edge().line())
// Remove arcs with a specific radius
trim(edge().arc(30))
Filter-based trimming removes matching edges entirely — it does not split edges at intersection points. Splitting only happens in interactive mode (.pick()).
Interactive trimming with .pick()
Chain .pick() to enter interactive trimming mode. FluidCAD splits all edges at their intersection points, then you select which segments to remove:
sketch("xy", () => {
circle([25, 0], 120)
circle([-25, 0], 100)
trim().pick()
})
Pass points to .pick() to trim specific segments — the segment nearest to each point gets removed:
sketch("xy", () => {
circle([25, 0], 120)
circle([-25, 0], 100)
trim().pick([50, 10], [30, -20])
})
How interactive mode works in the UI
- When
trim()is the last call in a sketch, an "Interactive Trimming" button appears at the top of the viewport. - Clicking the button appends
.pick()and enters trimming mode. - Hover over edge segments to highlight them, then click to remove — each click adds a point to
.pick(). - Click "Exit" to finish. If no edges were trimmed, the empty
.pick()is removed automatically.
Combining filters and interactive picking
Filters and .pick() can be combined. The filter removes matching edges first, then interactive picking operates on the remaining edges:
sketch("xy", () => {
circle([25, 0], 120)
circle([-25, 0], 100)
rect(200, 10).centered()
// Remove all circles, then interactively pick from remaining edges
trim(edge().circle()).pick([50, 0])
})
When you trim by passing coordinates (or by clicking in interactive mode), those coordinates are saved in your code. If the model dimensions change later, the trim points may fall outside the resized geometry, breaking the model.
This makes trim() great for fast prototyping or models with fixed dimensions. For parametric models, prefer building profiles from individual primitives and constrained geometry.
Quick reference
| Code | Effect |
|---|---|
trim(edge().circle()) | Removes all circle edges |
trim(edge().arc(), edge().line()) | Removes all arcs and lines |
trim() | Shows interactive trimming button |
trim().pick([x, y]) | Splits edges at intersections, removes segment near [x, y] |
trim(edge().circle()).pick([x, y]) | Removes circles, then splits and trims remaining edges |