You know you want to use them
Script parts
Write a part in JavaScript or TypeScript; the numbers and toggles you expose become editable settings.
A script part is a part you build with code instead of by dragging shapes. You write a short ManifoldCAD-style ES module that returns a solid, and CubbyCAD runs it to produce real geometry. Any parameters you declare — sizes, counts, angles, on/off toggles — show up as ordinary sliders, number fields, and switches, so you (or anyone who uses your part) can dial it in without touching the code.
Reach for a script part when a shape is fundamentally parametric or repetitive: gears, lattices, pegboard/Gridfinity-style grids, threads, or anything you'd rather express as a loop and a formula than place by hand. Because the part stays live, changing a parameter rebuilds the geometry instantly.
How to use it
Create the part
Open the Parts panel and click the New script part tile (you can also run from the File menu or command palette). Give the part a name and click Create.
Open the editor
The script editor opens as a docked panel. The left side holds the part's Label, Icon, Shape ID, Description, Tags, and a Parameters list. The right side is the code editor with a Live preview underneath.
Start from an example
To start from something that already works, switch to the Examples tab and pick a template (Centered cube, Rounded box, Polygon prism, Revolved vase, Pegboard tile, Spur gear, Gridfinity bin, and more).
Write the module
Write your module in the editor. Import the geometry API and your parameters, then
export defaulta solid. For example:import { Manifold } from 'manifold-3d/manifoldCAD';
import params from 'cubbycad:params';
const size = Number(params.size) || 10;
export default Manifold.cube([size, size, size], true);Define parameters
Define your editable settings under Parameters: click Add parameter and fill in a Key (e.g.
radius), a Label, a Type (Number, Integer, String, Boolean, or Enum), and a Default. Numeric types also take Min, Max, Step, and Unit. Read each value in code viaparams.<key>.Watch the preview
Watch the Live preview as you edit — it shows building… then ready, and prints any build or validation errors in red.
Save the part
Click Create script (or Save changes when editing) to save the part to your workspace. Click Close to leave the editor.
Place an instance
Back in the scene, drag the part's tile from the Parts panel into the viewport to place an instance. Select the instance to adjust its parameters in the properties panel.
Tips
- Scripts use the same dialect as manifoldcad.org, so scripts written there usually paste in with little or no change. Build with
Manifoldfor 3D primitives and booleans (subtract,add,hull), andCrossSectionfor 2D profiles youextrudeorrevolve. - You can
export defaulta single solid or an array of solids — an array is merged with a boolean union, handy for building assemblies in a loop. - TypeScript is fine: type annotations are stripped before the script runs. Top-level
awaitis allowed too. - Only two imports are permitted —
manifold-3d/manifoldCADandcubbycad:params. Any other import is a hard error, and onlyexport defaultis recognized. Scripts run in a locked-down sandbox with no network or DOM access. - Guard your parameter reads with a fallback (
Number(params.size) || 10) so a blank or out-of-range value never breaks the build. - The Shape ID is locked after the first save so existing scenes keep resolving the part — choose it deliberately.
Try it in your browser
Open CubbyCAD and put Script parts to work — it runs in the browser, no install.