Files
modeling-app/docs/kcl/sweep.md
Nick Cameron 5d25f4a0e5 Support types in the standard library (#5651)
* Parse an unparse type decls (and refactor impl attributes slightly)

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Remove special treatment of geometric types from parser and executor

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Generate docs for std types

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Hover tool-tips for types and fixup the frontend

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Fixes

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
2025-03-07 09:53:34 -05:00

326 KiB

title, excerpt, layout
title excerpt layout
sweep Extrude a sketch along a path. manual

Extrude a sketch along a path.

This, like extrude, is able to create a 3-dimensional solid from a 2-dimensional sketch. However, unlike extrude, this creates a solid by using the extent of the sketch as its path. This is useful for creating more complex shapes that can't be created with a simple extrusion.

sweep(
  sketch: Sketch,
  path: SweepPath,
  sectional?: bool,
  tolerance?: number,
): Solid

Arguments

Name Type Description Required
sketch Sketch The sketch that should be swept in space Yes
path SweepPath The path to sweep the sketch along Yes
sectional bool If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components. No
tolerance number Tolerance for this operation No

Returns

Solid

Examples

// Create a pipe using a sweep.


// Create a path for the sweep.
sweepPath = startSketchOn('XZ')
  |> startProfileAt([0.05, 0.05], %)
  |> line(end = [0, 7])
  |> tangentialArc({ offset = 90, radius = 5 }, %)
  |> line(end = [-3, 0])
  |> tangentialArc({ offset = -90, radius = 5 }, %)
  |> line(end = [0, 7])

// Create a hole for the pipe.
pipeHole = startSketchOn('XY')
  |> circle(center = [0, 0], radius = 1.5)

sweepSketch = startSketchOn('XY')
  |> circle(center = [0, 0], radius = 2)
  |> hole(pipeHole, %)
  |> sweep(path = sweepPath)

Rendered example of sweep 0

// Create a spring by sweeping around a helix path.


// Create a helix around the Z axis.
helixPath = helix(
  angleStart = 0,
  ccw = true,
  revolutions = 4,
  length = 10,
  radius = 5,
  axis = 'Z',
)

// Create a spring by sweeping around the helix path.
springSketch = startSketchOn('YZ')
  |> circle(center = [0, 0], radius = 1)
  |> sweep(path = helixPath)

Rendered example of sweep 1