* renames Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> updates Signed-off-by: Jess Frazelle <github@jessfraz.com> udpates Signed-off-by: Jess Frazelle <github@jessfraz.com> fix parse Signed-off-by: Jess Frazelle <github@jessfraz.com> fix typos Signed-off-by: Jess Frazelle <github@jessfraz.com> docs Signed-off-by: Jess Frazelle <github@jessfraz.com> update tests Signed-off-by: Jess Frazelle <github@jessfraz.com> empty * fix; Signed-off-by: Jess Frazelle <github@jessfraz.com> * new Signed-off-by: Jess Frazelle <github@jessfraz.com> * add the types pages Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * Look at this (photo)Graph *in the voice of Nickelback* * empty * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
168 lines
1.1 MiB
168 lines
1.1 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.
|
|
|
|
```js
|
|
revolve(data: RevolveData, sketch: Sketch) -> Solid
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `data` | [`RevolveData`](/docs/kcl/types/RevolveData) | Data for revolution surfaces. | Yes |
|
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
|
|
|
### Returns
|
|
|
|
[`Solid`](/docs/kcl/types/Solid) - An solid is a collection of extrude surfaces.
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
const part001 = startSketchOn('XY')
|
|
|> startProfileAt([4, 12], %)
|
|
|> line([2, 0], %)
|
|
|> line([0, -6], %)
|
|
|> line([4, -6], %)
|
|
|> line([0, -6], %)
|
|
|> line([-3.75, -4.5], %)
|
|
|> line([0, -5.5], %)
|
|
|> line([-2, 0], %)
|
|
|> close(%)
|
|
|> revolve({ axis: 'y' }, %) // default angle is 360
|
|
```
|
|
|
|

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

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

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

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

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

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

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

|
|
|
|
|