Code: scripts, files and Document JSON

Edit live OpenSCAD scripts, the .scad files they include, and the project itself as JSON.

Everything in a project that is text lives in the Code workspace. A live script re-runs whenever you change one of its parameters. The .scad files belong to the whole project, so every script can include them, and a change to a settings file updates each part that uses it. When you import an OpenSCAD folder and choose Run as live script, the files the script needs are kept here. The built-in libraries download the first time a script uses them. Document JSON shows the whole project as data; applying an edit to it is a single undo step too.

  1. Open the Code panel on the left rail. It lists the project’s live OpenSCAD scripts, its own .scad files, and Document JSON.
  2. Use the New script icon on the Scripts heading to start a live script and open it to be written, or Run .scad file to run one from disk.
  3. Click an entry to open it in the Code workspace, then Run a script, Save a file or Apply the JSON — each is one undo step.
  4. Use the New file, Add .scad files and Add folder icons on the Files heading for the settings.scad or utils.scad your scripts include. A file is found by its path: include <lib/utils.scad> reaches lib/utils.scad.
  5. Saving a file re-runs every script that includes it. BOSL2, MCAD, Round-Anything and threads-scad are built in, so include <BOSL2/std.scad> needs no file at all.

More in Projects & files

  • New project
  • Open a project
  • Saving
  • Import a model
  • Repair an imported mesh
  • Version history
  • Share a project
  • Turn off cloud sync

All help articles