DesignmatixDX-CAD

Build and publish a DX-CAD plugin

Designmatix Ltd. Last updated 20 November 2026. For DX-CAD 0.1.7, plugin API 9.

In short. Write a Python module with a register(registry) function, declare it as a dxcad.plugins entry point, check it with dxcad-sdk check, build it as a wheel (.whl) and publish the file. DX-CAD users install it from Help > Add-ons > Install from File. The SDK is free and open source under the Apache License 2.0; see the SDK page.
  1. What you need
  2. Start from the template
  3. Write the plugin
  4. Check it and try it
  5. Test it
  6. Say which plugin API it needs
  7. Build the wheel
  8. Publish it
  9. How users install it
  10. A paid plugin
  11. Where to read more

1. What you need

Python 3.12 (DX-CAD runs on 3.12 only, not 3.13), and DX-CAD and the SDK installed together in a virtual environment of their own, so your plugin can be loaded and run while you work on it:

python -m venv .venv
.venv\Scripts\activate          (Windows; on macOS or Linux: source .venv/bin/activate)
python -m pip install dxcad dxcad-sdk
dxcad doctor

dxcad doctor ends with SMOKE OK when DX-CAD works, and its plugins line names the plugin API this DX-CAD has.

2. Start from the template

The SDK's source, on GitHub at github.com/faizaldm/DX-CAD-SDK, has a starter in template/ and three worked examples in examples/ (a washer, a spacer and a part counter). Copy template/ to a folder of your own, say my-plugin, and rename dxcad_myplugin in both places: the module's file name and its entry in pyproject.toml. The template's pyproject.toml declares the plugin:

[project]
name = "dxcad-myplugin"
version = "0.1.0"
description = "A DX-CAD plugin"
requires-python = ">=3.12"

[project.entry-points."dxcad.plugins"]
myplugin = "dxcad_myplugin:register"

[tool.setuptools]
py-modules = ["dxcad_myplugin"]

The entry point's name, myplugin here, is the plugin's name: its menu and its toolbar in DX-CAD's window carry it.

3. Write the plugin

DX-CAD calls your register function once as it starts, handing it the registry. Each call on the registry adds one thing: a name for model.py, a dxcad subcommand, a tool for AI agents, or a command in the window.

def plate(width, depth, thickness):
    """A plain plate, its corner at the origin."""
    from dxcad.model import make_box

    return make_box(width, depth, thickness)


def add_plate(window):
    document = window.document
    document.add(document.unique_name("plate"), plate(100.0, 60.0, 3.0))


def register(registry):
    registry.require(2)
    registry.add_name("plate", plate)
    registry.action("add_plate", "Add Plate", add_plate)

With it installed, a model.py can say part("plate", plate(80, 40, 2)), and the window has a menu and a toolbar holding Add Plate. Two rules keep a plugin working everywhere:

  • Take from DX-CAD only dxcad.model and dxcad.plugins, and import them inside the functions that use them, as above, so the checker can load your module without DX-CAD.
  • The installed DX-CAD (the Windows installer, the macOS app, the Linux AppImage) runs your plugin in its own Python. There you may import the Python standard library (but not tkinter), any OCP (OpenCASCADE) module, and the PySide6 modules QtCore, QtGui, QtWidgets, QtSvg, QtSvgWidgets, QtNetwork, QtPrintSupport, QtOpenGL, QtOpenGLWidgets and QtPdf. Anything else must travel inside your wheel. The SDK's README has the full list.

The registry can also add model.py names, subcommands (registry.command), tools for agents (registry.tool), kinds of sheet-metal part, and views, annotations and tools for drawings. The plugins page lists every call.

4. Check it and try it

dxcad-sdk check my-plugin
python -m pip install -e my-plugin
dxcad plugins
dxcad gui

dxcad-sdk check checks the plugin's declarations before DX-CAD loads it, one line per check. Installed with -e, your folder is used as it is, so each change shows the next time DX-CAD starts. dxcad plugins lists what each plugin registered, or why one was skipped. dxcad gui opens the window with your plugin loaded.

5. Test it

Tests of a plugin call the real DX-CAD, which keeps its settings, licence, log and recovery files in the user's own folders. Copy the template's tests/conftest.py into your tests/ folder: it sets DXCAD_HOME to a folder of each test's own, so your tests never touch the settings of the DX-CAD you use every day. Then:

python -m pytest
dxcad-sdk sweep myplugin

dxcad-sdk sweep NAME opens each of your window commands offscreen and checks its dialogs fit a 1366 x 768 screen at 100, 125 and 150 percent, that OK, Cancel, Esc and Enter work, and that every part it adds is a valid solid. Before you publish, install your wheel (step 7) into an installed DX-CAD as a user would (step 9) and run its doctor --addons (dxcad.exe doctor --addons on Windows): it imports every installed add-on's modules in the installed DX-CAD's own Python and names each that fails.

6. Say which plugin API it needs

Each DX-CAD has a plugin API version: DX-CAD 0.1.7 has plugin API 9. Your register calls registry.require(N) with the version it was written for: the lower that number, the older the DX-CADs it loads in (the plugins page says which version brought each call), and the [project] table of your pyproject.toml says the same with a classifier, which DX-CAD reads before it installs your wheel:

classifiers = ["Framework :: DX-CAD :: Plugin API :: 2"]

DX-CAD refuses, with the reason, a wheel built for a later plugin API than it has, so a user is told before anything is installed. A wheel without the classifier is taken as built for API 1; registry.require still checks when it loads.

7. Build the wheel

python -m pip wheel --no-deps -w dist my-plugin

This writes one file, such as dist/dxcad_myplugin-0.1.0-py3-none-any.whl. A plugin written only in Python gives one py3-none-any wheel that installs on Windows, macOS and Linux alike. A plugin with compiled modules needs a wheel for each platform, built on that platform: win_amd64, macosx_..._arm64 for Apple silicon, and manylinux_..._x86_64. DX-CAD refuses a wheel built for another platform, with the reason.

Raise the version in pyproject.toml for each release: DX-CAD shows it in Help > Add-ons, and installing a newer wheel replaces the older one.

8. Publish it

Publishing a plugin is putting its .whl file where your users can download it:

  • a release on GitHub (or any code host) with the wheel attached;
  • a download link on your own website;
  • or PyPI, for users who run DX-CAD from Python with pip. PyPI accepts only the classifiers on its own list, so leave the DX-CAD classifier out of a wheel you upload there; DX-CAD then takes it as built for API 1, and registry.require still checks the version when it loads.

Say on your download page which DX-CAD versions and platforms the plugin is for, and give your plugin a licence of your own: the SDK's Apache License 2.0 lets you choose any licence for a plugin you write with it.

9. How users install it

  1. Download the plugin's .whl file.
  2. In DX-CAD, choose Help > Add-ons..., then Install from File..., and pick the file. DX-CAD checks it is a DX-CAD plugin for this platform and plugin API before it installs anything.
  3. Restart DX-CAD. The plugin's menu and toolbar are there, and Help > Add-ons lists it with its version, publisher and licence state, where it can be disabled, enabled or removed.

From a terminal, dxcad addons install FILE.whl does the same. DX-CAD installs add-ons into its own add-ons folder, never into the installed program, so this works with the Windows installer, the macOS app and the AppImage alike.

10. A paid plugin

A plugin can say it needs an entitlement with registry.require_entitlement(name, link). Until an installed entitlement provider (an entry point in the dxcad.entitlements group, whose holds(name) answers True or False) says it is held, the plugin loads locked: its menu and toolbar show, greyed, with the words "Requires NAME: see LINK", where the link is your buy page. How you sell the plugin and grant the entitlement is up to you. The plugins page gives the details.

11. Where to read more