Files
modeling-app/docs/kcl-std/functions/std-sketch-rectangle.md
Adam Chalmers 051bb0589e 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>
2025-07-01 14:26:04 -04:00

65 KiB

title, subtitle, excerpt, layout
title subtitle excerpt layout
rectangle Function in std::sketch Sketch a rectangle. manual

Sketch a rectangle.

rectangle(
  @sketchOrSurface: Sketch | Plane | Face,
  width: number(Length),
  height: number(Length),
  center?: Point2d,
  corner?: Point2d,
): Sketch

Arguments

Name Type Description Required
sketchOrSurface Sketch or Plane or Face Sketch to extend, or plane or surface to sketch on. Yes
width number(Length) Rectangle's width along X axis. Yes
height number(Length) Rectangle's height along Y axis. Yes
center Point2d The center of the rectangle. Incompatible with corner. No
corner 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 - A sketch is a collection of paths.

Examples

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

Rendered example of rectangle 0

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

Rendered example of rectangle 1