
DXF Generation
FreeGenerate and validate 2D DXF drawings from Python sources.
Free ยท Opens the source repo
What DXF Generation does
The DXF Generation skill allows users to create and validate 2D DXF drawings from Python sources, specifically using the ezdxf library. This skill is particularly useful for generating DXF files that represent various 2D shapes such as gaskets, panels, templates, and cut layouts for laser, plasma, or CNC routing. Users can define their drawing specifications in Python files that implement a gen_dxf() function, which returns an ezdxf document. The skill supports two primary modes of operation: standalone drafting for pure 2D outputs and CAD projection for creating DXF files based on existing 3D models.
When using the DXF Generation skill, users can leverage the power of Python to define dimensions, holes, layers, and other parameters programmatically. This flexibility allows for precise control over the generated drawings, ensuring that they meet specific requirements. The skill also includes validation features that check the generated DXF files against specified criteria, such as ensuring that profiles are closed and that dimensions match the user's input. This validation step is crucial for ensuring the integrity of the DXF files before they are handed off for manufacturing or further processing.
The skill is designed for developers and designers who need to automate the creation of DXF files from Python scripts. It is particularly beneficial for those working in fields such as manufacturing, architecture, and engineering, where precise 2D representations of designs are required. By integrating this skill into their workflow, users can streamline the process of generating DXF files, reducing the potential for errors and increasing efficiency in their design processes.
When to use it
Use this skill when you need to create DXF files for 2D designs, templates, or layouts based on specific parameters defined in Python.
When not to use it
This skill is not suitable for generating 3D models or for inspecting existing DXF files; use ezdxf for those purposes instead.
What you can build with it
Creating a Template for Laser Cutting
Generate a DXF file for a custom template to be used in a laser cutting machine, ensuring precise dimensions.
Automating CAD Drawings
Integrate the skill into a Python script to automate the generation of multiple DXF files based on varying input parameters.
Validating Design Outputs
Use the validation features to ensure that generated DXF files meet specific design requirements before handing them off for production.
How to install DXF Generation
View source1. Install with the skills CLI
npx skills add earthtojake/text-to-cad/dxf --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by earthtojakeDXF generation and validation
Provenance: maintained in 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.
Purpose
Create or modify 2D DXF drawings from natural-language requirements or from CAD geometry, generate validated .dxf artifacts, and return checked outputs. DXF sources are Python files defining gen_dxf() returning an ezdxf document; the CLI owns output paths.
Two source shapes are supported:
- Standalone drafting: a Python source defining only
gen_dxf(). Use for pure 2D outputs โ gaskets, panels, templates, cut layouts โ with no 3D model behind them. - CAD projection: a
gen_dxf()added to a CAD generator source that also definesgen_step(). Use when the DXF is a drawing or profile of a 3D part; create and validate the STEP geometry with$cadfirst, then add the projection in the same source file.
Use this skill when
Use this skill when the user asks for DXF files, 2D drawings, profiles, outlines, templates, gaskets, panels, flat patterns, or cut layouts for laser, plasma, waterjet, or CNC routing.
Use $cad for the 3D part or assembly a DXF derives from. Use $sendcutsend for SendCutSend-specific upload preflight.
Defaults
Use these defaults unless the user specifies otherwise:
- Units: millimeters; set them explicitly on the document (
doc.units = ezdxf.units.MM). - Geometry lives in modelspace at 1:1 scale.
- Cut profiles are closed polylines or closed line/arc loops; open contours only for engraving or reference geometry.
- For CAD-backed parts, prefer deriving DXF cut contours from the actual STEP/solid topology in the same generator script: build the 3D shape, select/project the real planar faces, unfold them into flat coordinates, and emit closed contours from those projected face wires. Use hand-drawn parametric outlines only when there is no reliable 3D topology to project.
- Layers carry intent: keep cut geometry and bend/fold lines on separate layers, and include "bend" in bend-layer names so downstream tools classify them as bends rather than cuts.
- DXF layers are drawing structure, not STEP part/assembly structure.
Tool
The launcher lives in the DXF skill directory:
python scripts/dxf targets... [flags]
Use the active project Python interpreter; treat python as an interpreter placeholder, and use --help for the full interface. Target paths resolve from the command's current working directory; run from the workspace that owns the artifacts with cwd-relative target paths. Keep a DXF output and its Python generator in the same directory with the same basename unless the user requests otherwise.
A DXF target is a Python source defining:
def gen_dxf():
...
return document
Plain generated Python targets write sibling .dxf outputs. Use -o/--output only with one plain generated Python target, or use SOURCE.py=OUTPUT.dxf positional pairs for per-target custom outputs. Do not put output paths in the gen_dxf() return value.
scripts/dxf is a generator; it does not inspect existing .dxf files. For existing DXF inspection, use ezdxf for entity/layer checks and $cad-viewer for visual review.
Workflow
- Convert the request into a short brief: outline dimensions, holes and slots, layers, units, output path, and validation targets.
- For CAD projections, generate and validate the STEP geometry with
$cadfirst, then add or updategen_dxf()in the same source. When possible, derive the DXF from in-memory STEP/solid topology rather than duplicating geometry formulas, so the DXF remains a direct projection/unfold of the part being exported. - Write or edit the Python source with meaningful dimensions as named parameters.
- Run
scripts/dxfon explicit Python source targets only; do not run directory-wide generation.
python scripts/dxf path/to/source.py
python scripts/dxf path/to/source.py -o path/to/output.dxf
python scripts/dxf path/to/a.py=out/a.dxf path/to/b.py=out/b.dxf
- Validate the generated DXF deterministically, then hand off and report.
Validation
Verify the generated file with targeted ezdxf checks instead of eyeballing: entity counts by type and layer, closed flags on cut profiles, drawing extents, and every dimension the user specified.
import ezdxf
doc = ezdxf.readfile("path/to/output.dxf")
msp = doc.modelspace()
profiles = [e for e in msp.query("LWPOLYLINE") if e.closed]
holes = msp.query('CIRCLE[layer=="0"]')
Report only checks that actually ran.
Handoff
After creating or modifying .dxf artifacts, you must ALWAYS hand the explicit file path(s) to $cad-viewer when that skill is installed and include its live viewer link(s) in the final response. If $cad-viewer is unavailable or startup fails, report that and rely on ezdxf checks instead of silently omitting the handoff.
Final responses should include generated files, returned viewer links, validation actually run, and assumptions.
Frequently asked questions about DXF Generation
Similar skills
Rhino 3D Scripting
Streamline your Rhinoceros 3D scripting tasks.
MVVM Toolkit
Streamline ViewModel development with source generators.
FreeCAD Scripts
Generate Python scripts for FreeCAD automation and modeling.
Azure Architecture Builder
Design and deploy Azure infrastructure using natural language.
Command Development
Streamline your command creation for Claude Code.
Create Cowork Plugin
Easily build and package plugins through guided sessions.
