* Add documentation to modules, and some constants and types Signed-off-by: Nick Cameron <nrc@ncameron.org> * Improve the language reference Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
288 lines
1.5 MiB
288 lines
1.5 MiB
---
|
|
title: "revolve"
|
|
subtitle: "Function in std::sketch"
|
|
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.
|
|
|
|
```kcl
|
|
revolve(
|
|
@sketches: [Sketch; 1+],
|
|
axis: Axis2d | Edge,
|
|
angle?: number(Angle),
|
|
tolerance?: number(Length),
|
|
symmetric?: bool,
|
|
bidirectionalAngle?: number(Angle),
|
|
tagStart?: tag,
|
|
tagEnd?: tag,
|
|
): Solid
|
|
```
|
|
|
|
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.
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `sketches` | [`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch) | The sketch or set of sketches that should be revolved | Yes |
|
|
| `axis` | [`Axis2d`](/docs/kcl-std/types/std-types-Axis2d) or [`Edge`](/docs/kcl-std/types/std-types-Edge) | Axis of revolution. | Yes |
|
|
| `angle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | Angle to revolve (in degrees). Default is 360. | No |
|
|
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Tolerance for the revolve operation. | No |
|
|
| `symmetric` | [`bool`](/docs/kcl-std/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No |
|
|
| `bidirectionalAngle` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | If specified, will also revolve in the opposite direction to 'angle' to the specified angle. If 'symmetric' is true, this value is ignored. | No |
|
|
| `tagStart` | [`tag`](/docs/kcl-std/types/std-types-tag) | A named tag for the face at the start of the revolve, i.e. the original sketch. | No |
|
|
| `tagEnd` | [`tag`](/docs/kcl-std/types/std-types-tag) | A named tag for the face at the end of the revolve. | No |
|
|
|
|
### Returns
|
|
|
|
[`Solid`](/docs/kcl-std/types/std-types-Solid) - A solid is a collection of extruded surfaces.
|
|
|
|
|
|
### Examples
|
|
|
|
```kcl
|
|
part001 = startSketchOn(XY)
|
|
|> startProfile(at = [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
|
|
```
|
|
|
|

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

|
|
|
|
```kcl
|
|
part001 = startSketchOn(XY)
|
|
|> startProfile(at = [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)
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
part001 = startSketchOn(XY)
|
|
|> startProfile(at = [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, face = END)
|
|
|> startProfile(at = [4.5, -5])
|
|
|> line(end = [0, 5])
|
|
|> line(end = [5, 0])
|
|
|> line(end = [0, -5])
|
|
|> close()
|
|
|> extrude(length = 5)
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
box = startSketchOn(XY)
|
|
|> startProfile(at = [0, 0])
|
|
|> line(end = [0, 20])
|
|
|> line(end = [20, 0])
|
|
|> line(end = [0, -20])
|
|
|> close()
|
|
|> extrude(length = 20)
|
|
|
|
sketch001 = startSketchOn(box, face = END)
|
|
|> circle( center = [10,10], radius = 4 )
|
|
|> revolve(
|
|
angle = -90,
|
|
axis = Y
|
|
)
|
|
```
|
|
|
|

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

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

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

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

|
|
|
|
```kcl
|
|
// Revolve around a path that has not been extruded.
|
|
|
|
profile001 = startSketchOn(XY)
|
|
|> startProfile(at = [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)
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
// Revolve around a path that has not been extruded or closed.
|
|
|
|
profile001 = startSketchOn(XY)
|
|
|> startProfile(at = [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)
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
// Symmetrically revolve around a path.
|
|
|
|
profile001 = startSketchOn(XY)
|
|
|> startProfile(at = [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, symmetric = true)
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
// Bidirectional revolve around a path.
|
|
|
|
profile001 = startSketchOn(XY)
|
|
|> startProfile(at = [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, bidirectionalAngle = 50)
|
|
```
|
|
|
|

|
|
|
|
|