kcl-std → functions → rectangle

rectangleFunction in std::sketch

Sketch a rectangle.

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

A rectangle can be defined by its width, height, and location. Either the center or corner must be provided, but not both, to specify its location.

Arguments

NameTypeDescriptionRequired
sketchOrSurfaceSketch or Plane or FaceSketch to extend, or plane or surface to sketch on.Yes
widthnumber(Length)Rectangle's width along X axis.Yes
heightnumber(Length)Rectangle's height along Y axis.Yes
centerPoint2dThe center of the rectangle. Either corner or center is required, but not both.No
cornerPoint2dThe corner of the rectangle. Either corner or center is required, but not both. 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

Found a typo?