# Dxf

Generates, regenerates and validates 2D DXF drawings from Python build123d models...

- Repository: https://github.com/earthtojake/text-to-cad (24718 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add earthtojake/text-to-cad --skill dxf -g -a claude-code -y`
Codex: `npx skills add earthtojake/text-to-cad --skill dxf -g -a codex -y`
Cursor: `npx skills add earthtojake/text-to-cad --skill dxf -g -a cursor -y`
Gemini CLI: `npx skills add earthtojake/text-to-cad --skill dxf -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add earthtojake/text-to-cad`

## Description

Generates, regenerates and validates 2D DXF drawings from Python build123d models, exported by cadgen. Use for DXF files, `.py` drawing scripts, 2D profiles, outlines, templates, gaskets, panels, flat patterns, laser/plasma/waterjet cut layouts, and 2D drawing exports of CAD geometry. Opens and visually reviews existing DXF files in the CAD Viewer.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# DXF generation and validation

Provenance: maintained in [earthtojake/text-to-cad](https://github.com/earthtojake/text-to-cad).
Use the installed local skill files as the runtime source of truth; the
repository link is only for provenance and release review.

## Setup

Run cadgen through the `cadgen` command its installation writes, so this skill's commands
share one installation, and its engine server, with the CAD app's:

- `cadgen` below means `cadgen +0.8.4` (`~/.local/bin/cadgen +0.8.4` where `~/.local/bin` is not on your PATH)
- `python` below means `cadgen +0.8.4 run`

For first-time setup or an update, a missing `cadgen` command, a release it says is not
installed, an engine that is not running, or an installation or kernel load error, read
[Setup and troubleshooting](references/setup.md).

Drawings are build123d geometry, so a drawing builds in the engine's warm worker
like any model: the first run of a script loads the CAD kernel (a few seconds),
and later runs reuse it.

## Purpose

Create or modify 2D DXF drawings from natural-language requirements or from CAD
geometry, export validated DXF files, and return checked outputs. A drawing's source
of truth is a Python file named `<name>.py` defining a parameterless `@model` function
that returns planar geometry.

**A drawing is a model.** It builds as any `$cad` model does: `python <name>.py`
rebuilds it in the engine, prints its document's `id:` and page, and writes nothing.
The DXF is exported from that document, by build123d's own exporter, once the drawing
checks pass: `cadgen export <id> drawing.dxf`. A drawing that calls a part model
(`bracket()` in its body) builds that part in the same run. The CAD Viewer and
`cadgen snapshot` read the `.dxf` itself, so the file you hand a cutting service,
the file the viewer draws and the file a snapshot renders are one and the same.

## The contract

The rest: https://github.com/earthtojake/text-to-cad/blob/HEAD/skills/dxf/SKILL.md
