Skip to content

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

Getting started

Modlumi scripts are JavaScript. Modlumi runs them in its own built-in JavaScript engine, so you don’t need to install anything to run a script. Everything a script needs is on the global modlumi namespace: get the open model from modlumi.activeModel, then read or edit it.

Create a file called outline.js:

outline.js
// Draws a one-meter square with edges, then fills it; edges alone make no face.
const model = modlumi.activeModel;
model.operation("Draw outline", () => {
const [side] = model.entities.addEdges([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]]);
model.entities.findFaces(side);
});
console.log(`The model has ${model.entities.length} elements`);

A few things to notice:

  • modlumi.activeModel is the model the script runs against.
  • Every edit happens inside model.operation(name, () => { ... }). The operation becomes one step in Edit → Undo. See Operations and undo.
  • Coordinates are in meters. Use modlumi.mm() or modlumi.inches() to convert other units.

In Modlumi, choose File → Run Script… and pick outline.js. The square appears in the model, and the console.log output appears in Scripting → Script Console.

To try something without a file, paste any example from these guides into the script console, or write it in Scripting → Script Editor. You can also run scripts from the command line, with or without a window. See Running scripts.

Modlumi publishes type declarations for its API, so your editor can complete names, show documentation and catch mistakes before you run anything. Put two files next to your scripts:

Both also ship with Modlumi for Windows, in C:\Program Files\modlumi\scripting\types. Use the declarations that match your Modlumi version, so new API members show up in your editor. The API reference on this site is generated from the same file. Editors such as Visual Studio Code pick up tsconfig.json and modlumi.d.ts automatically, also for plain JavaScript files.

You can also write scripts in TypeScript. Modlumi runs JavaScript, so install TypeScript and compile the folder first:

Terminal window
npx tsc

The compiler checks every script against modlumi.d.ts and writes the JavaScript to dist/, so outline.ts becomes dist/outline.js. Run npx tsc --watch while you work, so the .js files stay up to date every time you save.