* Make `=` and `=>` optional in function declarations And requires `:` for return types Signed-off-by: Nick Cameron <nrc@ncameron.org> * Tests Signed-off-by: Nick Cameron <nrc@ncameron.org> * Format types in function decls Signed-off-by: Nick Cameron <nrc@ncameron.org> * Require in anon function decls Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
65 lines
188 KiB
Markdown
65 lines
188 KiB
Markdown
---
|
|
title: "hole"
|
|
excerpt: "Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch."
|
|
layout: manual
|
|
---
|
|
|
|
Use a 2-dimensional sketch to cut a hole in another 2-dimensional sketch.
|
|
|
|
|
|
|
|
```js
|
|
hole(hole_sketch: SketchSet, sketch: Sketch) -> Sketch
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `hole_sketch` | [`SketchSet`](/docs/kcl/types/SketchSet) | A sketch or a group of sketches. | Yes |
|
|
| `sketch` | [`Sketch`](/docs/kcl/types/Sketch) | A sketch is a collection of paths. | Yes |
|
|
|
|
### Returns
|
|
|
|
[`Sketch`](/docs/kcl/types/Sketch) - A sketch is a collection of paths.
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
exampleSketch = startSketchOn('XY')
|
|
|> startProfileAt([0, 0], %)
|
|
|> line([0, 5], %)
|
|
|> line([5, 0], %)
|
|
|> line([0, -5], %)
|
|
|> close(%)
|
|
|> hole(circle({ center = [1, 1], radius = .25 }, %), %)
|
|
|> hole(circle({ center = [1, 4], radius = .25 }, %), %)
|
|
|
|
example = extrude(1, exampleSketch)
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
fn squareHoleSketch() {
|
|
squareSketch = startSketchOn('-XZ')
|
|
|> startProfileAt([-1, -1], %)
|
|
|> line([2, 0], %)
|
|
|> line([0, 2], %)
|
|
|> line([-2, 0], %)
|
|
|> close(%)
|
|
return squareSketch
|
|
}
|
|
|
|
exampleSketch = startSketchOn('-XZ')
|
|
|> circle({ center = [0, 0], radius = 3 }, %)
|
|
|> hole(squareHoleSketch(), %)
|
|
example = extrude(1, exampleSketch)
|
|
```
|
|
|
|

|
|
|
|
|