KCL: rectangle function (#7616)

* 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>
This commit is contained in:
Adam Chalmers
2025-07-01 13:26:04 -05:00
committed by GitHub
parent 7f9851ae28
commit 051bb0589e
29 changed files with 2182 additions and 1 deletions

View File

@ -234,6 +234,39 @@ export fn startProfile(
tag?: TagDecl,
): Sketch {}
/// Sketch a rectangle.
///
/// ```
/// exampleSketch = startSketchOn(-XZ)
/// |> rectangle(center = [0, 0], width = 10, height = 5)
// |> extrude(length = 2)
/// ```
///
/// ```
/// exampleSketch = startSketchOn(-XZ)
/// |> rectangle(corner = [0, 0], width = 10, height = 5)
// |> extrude(length = 2)
/// ```
@(impl = std_rust)
export fn rectangle(
/// Sketch to extend, or plane or surface to sketch on.
@sketchOrSurface: Sketch | Plane | Face,
/// Rectangle's width along X axis.
width: number(Length),
/// Rectangle's height along Y axis.
height: number(Length),
/// The center of the rectangle.
/// Incompatible with `corner`.
@(snippetArray = ["0", "0"])
center?: Point2d,
/// The corner of the rectangle.
/// Incompatible with `center`.
/// This will be the corner which is most negative on
/// both X and Y axes.
@(snippetArray = ["0", "0"])
corner?: Point2d,
): Sketch {}
/// Construct a 2-dimensional circle, of the specified radius, centered at
/// the provided (x, y) origin point.
///