Compound Geometries
Compound geometries create complete, closed profiles in a single call. They are ready to extrude right away.
rect
sketch("xy", () => {
rect(100, 60) // 100 wide, 60 tall, starting at current position
rect(80) // 80x80 square
rect([10, 20], 50, 30) // 50x30 rectangle starting at position [10, 20]
})
Useful methods on rect:
import { sketch } from 'fluidcad/core';
import { rect } from 'fluidcad/core';
sketch("xy", () => {
rect(100, 60).center().radius(5)
})

You can also access individual edges of a rect:
const r = rect(100, 60)
r.topEdge() // the top edge
r.bottomEdge() // the bottom edge
r.leftEdge() // the left edge
r.rightEdge() // the right edge
polygon
import { sketch } from 'fluidcad/core';
import { polygon } from 'fluidcad/core';
sketch("xy", () => {
polygon(6, 80)
})

slot
An obround shape (rectangle with rounded ends):
import { sketch } from 'fluidcad/core';
import { slot } from 'fluidcad/core';
sketch("xy", () => {
slot(100, 30)
})

Slot from edge
You can create a slot that follows an existing edge or arc. Pass the geometry as the first argument and the width as the second:
import { sketch } from 'fluidcad/core';
import { move, arc, slot } from 'fluidcad/core';
sketch("xy", () => {
move([100, 0])
const a = arc(90, 0, 90)
slot(a, 20, true)
})

The third argument (true) removes the source geometry after creating the slot. Set it to false to keep the original edge.