PolyScript

A parametric CAD language for describing 3D models in concise code.
box 40 30 10 | fillet 2 | faces top | hole 5
✎ Edit

Pipe | simple shapes together and refine. That’s all.

What is PolyScript?

PolyScript is a parametric CAD language for describing 3D models in concise code. Built on the OpenCascade kernel, it is designed for easier and safer 3D modeling.

Concise and flexible syntax

  • Concise DSL – No parentheses needed for function calls. Just write box 80 60 10
  • Pipeline | – Chain operations left to right. Reading order = execution order
  • Declarative modeling – Describe “create → select → modify” declaratively
  • Shareable – Easy to share parts and safe to run in a browser
# Create a case, round the edges, and cut a hole in the side
box 100 60 40
 | faces >Z | shell 2
 | edges =Z | fillet 3
 | faces right | circle 4 | cut
✎ Edit

For 3D printing, DIY, and education

PolyScript is ideal for:

  • 3D Printing – Change parameters to produce parts of different dimensions
  • DIY / Makers – Quickly design practical parts: cases, brackets, jigs, and more
  • Education – Simple syntax that anyone can pick up, from kids to adults, no programming experience required

Features

  • Write less — Common operations need no parentheses
  • Read left to right — Operations flow through pipes
  • Parametric — Variables and functions let you change dimensions freely
  • Runs in the browser — Safe execution in a sandbox
  • AI-friendly — A model written by an AI can be checked by the same AI, without looking at a picture (see below)

Try it

Use PolyScript Playground right in your browser. No installation needed.

Documentation

Why we built PolyScript

Parametric CAD tools that describe 3D models with code are gaining attention alongside advances in AI. Among them, CadQuery is an excellent CAD framework that lets you program any shape in Python.

However, being a general-purpose programming language is itself a weakness. You cannot safely execute 3D models created by others. To share our work safely, a DSL is essential.

Easy enough for children with no programming experience to use – that is the design concept behind PolyScript.

AI-friendly

An LLM can write PolyScript. Where it stumbles is judging whether what it wrote is what was asked for. Both the language and the tools are designed around that step.

  • No silent failures — A selector that matched nothing (selector.empty), an operation that changed nothing (check.no-effect) and a result split into several solids (check.multiple-solids) are reported with a code and a line number instead of passing through as a plausible-looking shape.
  • Machine-readable diagnostics — Every diagnostic carries a stable code, a position and a fix; poly explain <code> gives the reason and the remedy. Every subcommand accepts --json.
  • One command, everything needed to judge — poly verify runs the syntax check, the build, a per-step trace, the measurements, a fingerprint and the post-build checks in one call. It is strict by default, so exit code 0 already means “nothing silent was reported”.
  • Orientation mistakes show up as numbers — The trace’s where column gives the centroid, normal and area of each selection, so confusing faces >Z (the top) with faces =Z (the sides) is visible without an image.
  • Sections as numbers — poly section returns the outline of a cut as a loop table in millimetres (area, length, bbox), so “is it hollow” and “is the wall 2 mm” can be answered without reading a picture.
  • One picture, at the end — poly build -o x.png puts front, top, right and isometric line drawings on one sheet, the same drawing as the SVG, for models that take raster input only.
  • Did the shape change? — A fingerprint and poly diff say whether a refactor changed the geometry, and by how much.
  • Dimensions exposed — @param declares a dimension, and -D name=value overrides are checked against its type, range and choices.
  • Safe to execute — PolyScript is a DSL, not a general-purpose language, so a model an AI produced can be run in a sandbox as it is.
  • A playbook for coding agents — poly skill install installs the modelling workflow (dimension table first, verify with numbers before looking at pixels, the common mistakes, a reference of real-world dimensions) as an agent skill.

The design starts from three things that are hard for an AI: images are expensive and stay in the context, mental simulation of 3D space is unreliable, and remembered numbers are not to be trusted. Hence numbers first, and one picture last.

Acknowledgements

PolyScript is built on top of many outstanding open-source projects.

  • Open CASCADE Technology — The powerful B-Rep modeling engine used as PolyScript’s 3D kernel. It handles everything from boolean operations and fillets to STEP export.
  • OpenSCAD — The pioneer that forged the culture of “writing 3D models in code.” It was the starting point for PolyScript.
  • CadQuery — An elegant parametric CAD API for Python. PolyScript’s Python implementation uses CadQuery’s OCP bindings, and its pipeline syntax was a major influence.

Our deep gratitude goes to these projects and their communities.


Getting Started

Core concepts and your first model.

Tutorial

Build 3 models hands-on.

Language Reference

Full details on every operation.

CLI Reference

Every subcommand and option of the poly command.

Cheat Sheet

Quick reference to keep at hand.