* KCL test for rectangle * Rectangle function * Rectangle helper tests * Rectangle helper * Fix clippy lints * Update docs * fmt * Fix bug * fmt * Fix doc comments * Update generated docs --------- Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
56 lines
65 KiB
Markdown
56 lines
65 KiB
Markdown
---
|
|
title: "rectangle"
|
|
subtitle: "Function in std::sketch"
|
|
excerpt: "Sketch a rectangle."
|
|
layout: manual
|
|
---
|
|
|
|
Sketch a rectangle.
|
|
|
|
```kcl
|
|
rectangle(
|
|
@sketchOrSurface: Sketch | Plane | Face,
|
|
width: number(Length),
|
|
height: number(Length),
|
|
center?: Point2d,
|
|
corner?: Point2d,
|
|
): Sketch
|
|
```
|
|
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `sketchOrSurface` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
|
|
| `width` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Rectangle's width along X axis. | Yes |
|
|
| `height` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | Rectangle's height along Y axis. | Yes |
|
|
| `center` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The center of the rectangle. Incompatible with `corner`. | No |
|
|
| `corner` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The corner of the rectangle. Incompatible with `center`. This will be the corner which is most negative on both X and Y axes. | No |
|
|
|
|
### Returns
|
|
|
|
[`Sketch`](/docs/kcl-std/types/std-types-Sketch) - A sketch is a collection of paths.
|
|
|
|
|
|
### Examples
|
|
|
|
```kcl
|
|
exampleSketch = startSketchOn(-XZ)
|
|
|> rectangle(center = [0, 0], width = 10, height = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
```kcl
|
|
exampleSketch = startSketchOn(-XZ)
|
|
|> rectangle(corner = [0, 0], width = 10, height = 5)
|
|
|
|
```
|
|
|
|

|
|
|
|
|