Skip to main content

rect()

Draws a rectangle with the given width and optional height.

Returns: Rect

tip

See the guide for detailed usage examples.

Signatures

rect(width: number, height?: number): Rect

Draws a rectangle with the given width and optional height.

ParameterTypeDescription
widthnumberThe rectangle width
heightnumberThe rectangle height (defaults to width) (optional)

rect(start: Point2DLike, width: number, height?: number): Rect

Draws a rectangle at a given start point.

ParameterTypeDescription
startPoint2DLikeThe start point (bottom-left corner)
widthnumberThe rectangle width
heightnumberThe rectangle height (defaults to width) (optional)
note

All signatures also accept an optional targetPlane parameter as the last argument to draw on a specific plane.