* Automatic fixing of deprecations and use non-quoted default planes by default Signed-off-by: Nick Cameron <nrc@ncameron.org> * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
238 lines
1.4 MiB
238 lines
1.4 MiB
---
|
|
title: "revolve"
|
|
excerpt: "Rotate a sketch around some provided axis, creating a solid from its extent."
|
|
layout: manual
|
|
---
|
|
|
|
Rotate a sketch around some provided axis, creating a solid from its extent.
|
|
|
|
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 revolved around an axis rather than using the extent of the sketch linearly translated through a third dimension.
|
|
|
|
Revolve occurs around a local sketch axis rather than a global axis.
|
|
|
|
You can provide more than one sketch to revolve, and they will all be revolved around the same axis.
|
|
|
|
```js
|
|
revolve(
|
|
sketches: [Sketch],
|
|
axis: Axis2dOrEdgeReference,
|
|
angle?: number,
|
|
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 revolved | Yes |
|
|
| `axis` | [`Axis2dOrEdgeReference`](/docs/kcl/types/Axis2dOrEdgeReference) | Axis of revolution. | Yes |
|
|
| `angle` | [`number`](/docs/kcl/types/number) | Angle to revolve (in degrees). Default is 360. | No |
|
|
| `tolerance` | [`number`](/docs/kcl/types/number) | Tolerance for the revolve operation. | No |
|
|
| `tagStart` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the start of the revolve, i.e. the original sketch | No |
|
|
| `tagEnd` | [`TagDeclarator`](/docs/kcl/types#tag-declaration) | A named tag for the face at the end of the revolve | No |
|
|
|
|
### Returns
|
|
|
|
[`[Solid]`](/docs/kcl/types/Solid)
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
part001 = startSketchOn(XY)
|
|
|> startProfileAt([4, 12], %)
|
|
|> line(end = [2, 0])
|
|
|> line(end = [0, -6])
|
|
|> line(end = [4, -6])
|
|
|> line(end = [0, -6])
|
|
|> line(end = [-3.75, -4.5])
|
|
|> line(end = [0, -5.5])
|
|
|> line(end = [-2, 0])
|
|
|> close()
|
|
|> revolve(axis = 'y') // default angle is 360
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// A donut shape.
|
|
sketch001 = startSketchOn(XY)
|
|
|> circle(center = [15, 0], radius = 5)
|
|
|> revolve(angle = 360, axis = 'y')
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
part001 = startSketchOn(XY)
|
|
|> startProfileAt([4, 12], %)
|
|
|> line(end = [2, 0])
|
|
|> line(end = [0, -6])
|
|
|> line(end = [4, -6])
|
|
|> line(end = [0, -6])
|
|
|> line(end = [-3.75, -4.5])
|
|
|> line(end = [0, -5.5])
|
|
|> line(end = [-2, 0])
|
|
|> close()
|
|
|> revolve(axis = 'y', angle = 180)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
part001 = startSketchOn(XY)
|
|
|> startProfileAt([4, 12], %)
|
|
|> line(end = [2, 0])
|
|
|> line(end = [0, -6])
|
|
|> line(end = [4, -6])
|
|
|> line(end = [0, -6])
|
|
|> line(end = [-3.75, -4.5])
|
|
|> line(end = [0, -5.5])
|
|
|> line(end = [-2, 0])
|
|
|> close()
|
|
|> revolve(axis = 'y', angle = 180)
|
|
|
|
part002 = startSketchOn(part001, 'end')
|
|
|> startProfileAt([4.5, -5], %)
|
|
|> line(end = [0, 5])
|
|
|> line(end = [5, 0])
|
|
|> line(end = [0, -5])
|
|
|> close()
|
|
|> extrude(length = 5)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
box = startSketchOn(XY)
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 20])
|
|
|> line(end = [20, 0])
|
|
|> line(end = [0, -20])
|
|
|> close()
|
|
|> extrude(length = 20)
|
|
|
|
sketch001 = startSketchOn(box, "END")
|
|
|> circle(center = [10, 10], radius = 4)
|
|
|> revolve(angle = -90, axis = 'y')
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
box = startSketchOn(XY)
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 20])
|
|
|> line(end = [20, 0])
|
|
|> line(end = [0, -20], tag = $revolveAxis)
|
|
|> close()
|
|
|> extrude(length = 20)
|
|
|
|
sketch001 = startSketchOn(box, "END")
|
|
|> circle(center = [10, 10], radius = 4)
|
|
|> revolve(angle = 90, axis = getOppositeEdge(revolveAxis))
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
box = startSketchOn(XY)
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 20])
|
|
|> line(end = [20, 0])
|
|
|> line(end = [0, -20], tag = $revolveAxis)
|
|
|> close()
|
|
|> extrude(length = 20)
|
|
|
|
sketch001 = startSketchOn(box, "END")
|
|
|> circle(center = [10, 10], radius = 4)
|
|
|> revolve(angle = 90, axis = getOppositeEdge(revolveAxis), tolerance = 0.0001)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
sketch001 = startSketchOn(XY)
|
|
|> startProfileAt([10, 0], %)
|
|
|> line(end = [5, -5])
|
|
|> line(end = [5, 5])
|
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|> close()
|
|
|
|
part001 = revolve(
|
|
sketch001,
|
|
axis = {
|
|
custom = {
|
|
axis = [0.0, 1.0],
|
|
origin = [0.0, 0.0]
|
|
}
|
|
},
|
|
)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Revolve two sketches around the same axis.
|
|
|
|
|
|
sketch001 = startSketchOn(XY)
|
|
profile001 = startProfileAt([4, 8], sketch001)
|
|
|> xLine(length = 3)
|
|
|> yLine(length = -3)
|
|
|> xLine(length = -3)
|
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|> close()
|
|
|
|
profile002 = startProfileAt([-5, 8], sketch001)
|
|
|> xLine(length = 3)
|
|
|> yLine(length = -3)
|
|
|> xLine(length = -3)
|
|
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
|
|> close()
|
|
|
|
revolve([profile001, profile002], axis = "X")
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Revolve around a path that has not been extruded.
|
|
|
|
|
|
profile001 = startSketchOn(XY)
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 20], tag = $revolveAxis)
|
|
|> line(end = [20, 0])
|
|
|> line(end = [0, -20])
|
|
|> close(%)
|
|
|
|
sketch001 = startSketchOn(XY)
|
|
|> circle(center = [-10, 10], radius = 4)
|
|
|> revolve(angle = 90, axis = revolveAxis)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// Revolve around a path that has not been extruded or closed.
|
|
|
|
|
|
profile001 = startSketchOn(XY)
|
|
|> startProfileAt([0, 0], %)
|
|
|> line(end = [0, 20], tag = $revolveAxis)
|
|
|> line(end = [20, 0])
|
|
|
|
sketch001 = startSketchOn(XY)
|
|
|> circle(center = [-10, 10], radius = 4)
|
|
|> revolve(angle = 90, axis = revolveAxis)
|
|
```
|
|
|
|

|
|
|
|
|