cadwork Python Documentation
cadwork 3D has a built-in Python interpreter and an API (the cwapi3d controllers). With it you can automate and extend cadwork without changing the program itself. This guide gets you from "I have never scripted cadwork" to running, debugging and sharing your own plugins.
What you can do with Python in cadwork
- Model: create, modify, move and cut elements (beams, panels, axes, connectors, ...).
- Read and write data: names, groups, materials, user attributes and geometry of any element.
- Lists and exports: generate production lists, export IFC, BTL, STEP, DXF and more.
- Script-filled attributes: let a script calculate attribute values automatically (Auto Attributes).
- Batch processing: open many files from the command line, run a plugin on each and save or export the result (Command Line).
- Your own tools: small helpers on the plugin bar, up to full applications with their own UI.
Where to start
| I want to ... | Go to |
|---|---|
| set up cadwork and run my first plugin | Getting Started |
| use standard or third-party Python packages | Packages and Modules |
| find out why my plugin does nothing or crashes | Debugging |
| run cadwork and plugins from a script or batch file | Command Line |
| look up a function | Reference |
| copy a working example | Examples |
| let an AI assistant answer API questions | MCP |
| ask a question or report a bug | Community |
How it fits together
An application programming interface (API) is a defined way for one program to use another. cadwork exposes its functions to Python as a set of controller modules, grouped by topic:
1 2 3 4 5 | |
These modules exist only inside cadwork. Your plugin always runs in cadwork's own Python
interpreter, started from the plugin bar, the Python console or the command line. The
cwapi3d package on PyPI provides the same
modules as type stubs, so your editor can offer autocompletion and documentation while you write
code.

A first taste: print the subgroup of every selected element.
1 2 3 4 5 | |
New to Python?
Python is easy to read and quick to try out, which makes it a good fit for automating cadwork. If you have never written Python before, work through a short tutorial first and then come back:
Questions?
Ask in the GitHub Discussions. The posts are public, so every answer helps the next person too.