We continue migrating KCL stdlib functions to use keyword arguments. Next up is the `angledLine` family of functions (except `angledLineThatIntersects, which will be a quick follow-up).
Before vs. after:
`angledLine({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, length = 3, tag = $edge)`
`angledLineOfXLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthX = 3, tag = $edge)`
`angledLineOfYLength({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, lengthY = 3, tag = $edge)`
`angledLineToX({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteX = 3, tag = $edge)`
`angledLineToY({angle = 90, length = 3}, %, $edge)`
  => `angledLine(angle = 90, endAbsoluteY = 3, tag = $edge)`
		
	
		
			
				
	
	
		
			132 lines
		
	
	
		
			530 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			132 lines
		
	
	
		
			530 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: "sweep"
 | 
						|
excerpt: "Extrude a sketch along a path."
 | 
						|
layout: 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.
 | 
						|
 | 
						|
You can provide more than one sketch to sweep, and they will all be swept along the same path.
 | 
						|
 | 
						|
```js
 | 
						|
sweep(
 | 
						|
  sketches: [Sketch],
 | 
						|
  path: SweepPath,
 | 
						|
  sectional?: bool,
 | 
						|
  tolerance?: number,
 | 
						|
  tagStart?: TagDeclarator,
 | 
						|
  tagEnd?: TagDeclarator,
 | 
						|
): [Solid]
 | 
						|
```
 | 
						|
 | 
						|
 | 
						|
### Arguments
 | 
						|
 | 
						|
| Name | Type | Description | Required |
 | 
						|
|----------|------|-------------|----------|
 | 
						|
| `sketches` | [`[Sketch]`](/docs/kcl/types/Sketch) | The sketch or set of sketches that should be swept in space | Yes |
 | 
						|
| `path` | [`SweepPath`](/docs/kcl/types/SweepPath) | The path to sweep the sketch along | Yes |
 | 
						|
| `sectional` | [`bool`](/docs/kcl/types/bool) | If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components. | No |
 | 
						|
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for this operation | No |
 | 
						|
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the sweep, i.e. the original sketch | No |
 | 
						|
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the sweep | No |
 | 
						|
 | 
						|
### Returns
 | 
						|
 | 
						|
[`[Solid]`](/docs/kcl/types/Solid)
 | 
						|
 | 
						|
 | 
						|
### Examples
 | 
						|
 | 
						|
```js
 | 
						|
// 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)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
```js
 | 
						|
// 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)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
```js
 | 
						|
// Sweep two sketches along the same path.
 | 
						|
 | 
						|
 | 
						|
sketch001 = startSketchOn(XY)
 | 
						|
rectangleSketch = startProfileAt([-200, 23.86], sketch001)
 | 
						|
  |> angledLine(angle = 0, length = 73.47, tag = $rectangleSegmentA001)
 | 
						|
  |> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 50.61)
 | 
						|
  |> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))
 | 
						|
  |> line(endAbsolute = [profileStartX(%), profileStartY(%)])
 | 
						|
  |> close()
 | 
						|
 | 
						|
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
 | 
						|
 | 
						|
sketch002 = startSketchOn(YZ)
 | 
						|
sweepPath = startProfileAt([0, 0], sketch002)
 | 
						|
  |> yLine(length = 231.81)
 | 
						|
  |> tangentialArc({ radius = 80, offset = -90 }, %)
 | 
						|
  |> xLine(length = 384.93)
 | 
						|
 | 
						|
sweep([rectangleSketch, circleSketch], path = sweepPath)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
```js
 | 
						|
// Sectionally sweep one sketch along the path
 | 
						|
 | 
						|
 | 
						|
sketch001 = startSketchOn(XY)
 | 
						|
circleSketch = circle(sketch001, center = [200, -30.29], radius = 32.63)
 | 
						|
 | 
						|
sketch002 = startSketchOn(YZ)
 | 
						|
sweepPath = startProfileAt([0, 0], sketch002)
 | 
						|
  |> yLine(length = 231.81)
 | 
						|
  |> tangentialArc({ radius = 80, offset = -90 }, %)
 | 
						|
  |> xLine(length = 384.93)
 | 
						|
 | 
						|
sweep(circleSketch, path = sweepPath, sectional = true)
 | 
						|
```
 | 
						|
 | 
						|

 | 
						|
 | 
						|
 |