dxf
Generate, regenerate, and validate 2D DXF drawings from Python ezdxf sources. Use for DXF files, gen_dxf() sources, 2D profiles, outlines, templates, gaskets, panels, flat patterns, laser/plasma/waterjet cut layouts, and 2D drawing exports of CAD geometry.
- License 许可
- MIT
- 最近更新
- 2026-09-19
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- dxf
- description
- Generate, regenerate, and validate 2D DXF drawings from Python ezdxf sources. Use for DXF files, gen_dxf() sources, 2D profiles, outlines, templates, gaskets, panels, flat patterns, laser/plasma/waterjet cut layouts, and 2D drawing exports of CAD geometry.
02 资源文件 42
- 参考文档agents/openai.yaml265 B
- 许可证LICENSE1.0 KB
- 参考文档requirements.txt42 B
- 脚本scripts/dxf/__init__.py26 B
- 脚本scripts/dxf/__main__.py345 B
- 脚本scripts/dxf/cli.py1.6 KB
- 脚本scripts/dxf/render_payload.py14.2 KB
- 脚本scripts/packages/cadpy/pyproject.toml484 B
- 脚本scripts/packages/cadpy/src/cadpy/__init__.py1.1 KB
- 脚本scripts/packages/cadpy/src/cadpy/analysis.py24.9 KB
- 脚本scripts/packages/cadpy/src/cadpy/api.py290 B
- 脚本scripts/packages/cadpy/src/cadpy/assembly_composition.py49.3 KB
- 脚本scripts/packages/cadpy/src/cadpy/assembly_export.py35.6 KB
- 脚本scripts/packages/cadpy/src/cadpy/assembly_flatten.py8.7 KB
- 脚本scripts/packages/cadpy/src/cadpy/assembly_spec.py16.1 KB
- 脚本scripts/packages/cadpy/src/cadpy/assembly.py14.6 KB
- 脚本scripts/packages/cadpy/src/cadpy/cad_ref_syntax.py4.2 KB
- 脚本scripts/packages/cadpy/src/cadpy/catalog.py19.6 KB
- 脚本scripts/packages/cadpy/src/cadpy/cli_logging.py1.6 KB
- 脚本scripts/packages/cadpy/src/cadpy/file_metadata.py1.9 KB
- 脚本scripts/packages/cadpy/src/cadpy/generation_status.py5.8 KB
- 脚本scripts/packages/cadpy/src/cadpy/generation.py86.9 KB
- 脚本scripts/packages/cadpy/src/cadpy/glb_mesh_payload.py15.4 KB
- 脚本scripts/packages/cadpy/src/cadpy/glb_topology.py20.3 KB
- 脚本scripts/packages/cadpy/src/cadpy/glb.py44.3 KB
- 脚本scripts/packages/cadpy/src/cadpy/lookup.py9.7 KB
- 脚本scripts/packages/cadpy/src/cadpy/metadata.py16.2 KB
- 脚本scripts/packages/cadpy/src/cadpy/py.typed1 B
- 脚本scripts/packages/cadpy/src/cadpy/render.py2.9 KB
- 脚本scripts/packages/cadpy/src/cadpy/reporting.py3.9 KB
- 脚本scripts/packages/cadpy/src/cadpy/selector_types.py374 B
- 脚本scripts/packages/cadpy/src/cadpy/source_hash.py1.5 KB
- 脚本scripts/packages/cadpy/src/cadpy/step_artifact.py14.5 KB
- 脚本scripts/packages/cadpy/src/cadpy/step_artifacts.py7.9 KB
- 脚本scripts/packages/cadpy/src/cadpy/step_export.py13.1 KB
- 脚本scripts/packages/cadpy/src/cadpy/step_hash.py345 B
- 脚本scripts/packages/cadpy/src/cadpy/step_metadata.py12.1 KB
- 脚本scripts/packages/cadpy/src/cadpy/step_scene.py103.1 KB
- 脚本scripts/packages/cadpy/src/cadpy/step_targets.py17.4 KB
- 脚本scripts/packages/cadpy/src/cadpy/stl.py1.0 KB
- 脚本scripts/packages/cadpy/src/cadpy/threemf.py19.7 KB
- 脚本scripts/packages/cadpy/src/cadpy/validators.py3.9 KB
03 SKILL.md 正文
DXF 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.
04 同仓库更多 Skills
ui-styling
Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns, forms, tables), customizing themes and colors, implementing dark mode, generating visual designs and posters, or establishing consistent styling patterns across applications.
scroll-craft
Premium scroll-driven landing pages. Scroll is the timeline: video scrubs, sections pin, rails pan, headlines assemble, the ground shifts colour. Interviews first, then locks a page grammar, one feeling peak, a signature move, and a fingerprint so two builds cannot share a skeleton. Use when the user or seat wants scrollytelling, an Apple-style landing, a unique scroll site, or when a template-looking page must be rejected.
design
Comprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG, Gemini 3.1 Pro), social photos (HTML→screenshot, multi-platform). Actions: design logo, create CIP, generate mockups, build slides, design banner, generate icon, create social photos, social media images, brand identity, design system. Platforms: Facebook, Twitter, LinkedIn, YouTube, Instagram, Pinterest, TikTok, Threads, Google Ads.
design-system
Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing/typography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
supabase-postgres-best-practices
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.