Skip to content

Vibe coding a plugin? Teach your agent Modlumi first. Works with Claude Code, Codex, Cursor and more.

ToolView

What a tool’s draw function and overlays draw with. A tool’s draw takes points in the coordinates of the context being edited, like its events’ ToolPoint.position, and Modlumi maps them to the model. Overlays from PluginContext.addOverlay take model coordinates. Either takes screen pixels instead with screen: true.

box(origin, size, style?): void

The twelve edges of a box with one corner at origin and size along X, Y and Z, placed by transformation when given, such as a group’s. Needs the "previewBoxes" feature.

Point3dLike

Vector3dLike

Omit<PreviewStyle, "screen"> & object

void


image(image, corners, style?): void

An image stretched over four corners: its top left, top right, bottom right and bottom left. In model coordinates the image bends with the perspective; with screen: true the corners are screen pixels, as for a photo to match the model to. Images draw over the model and the other shapes, at opacity from 0 to 1.

PluginImage

readonly [Point3dLike | readonly [number, number], Point3dLike | readonly [number, number], Point3dLike | readonly [number, number], Point3dLike | readonly [number, number]]

number

boolean

void

// Shows a photo over the top left of the viewport, half see-through.
const photo = context.loadImage("site.jpg");
context.addOverlay((view) => {
const [w, h] = [photo.width / 4, photo.height / 4];
view.image(photo, [[20, 60], [20 + w, 60], [20 + w, 60 + h], [20, 60 + h]], { screen: true, opacity: 0.5 });
});

lines(points, style?): void

Separate segments, one from each pair of points.

Iterable<Point3dLike | readonly [number, number]>

PreviewStyle

void


points(points, style?): void

Iterable<Point3dLike | readonly [number, number]>

PreviewStyle

void


polygon(points, style?): void

A filled convex polygon.

Iterable<Point3dLike | readonly [number, number]>

PreviewStyle

void


polyline(points, style?): void

Iterable<Point3dLike | readonly [number, number]>

PreviewStyle

void


text(position, text, style?): void

Text at a point, or at screen pixels.

Point3dLike | readonly [number, number]

unknown

PreviewStyle

void