dxf
Skill này làm gì
Skill này hướng dẫn AI của bạn tạo file bản vẽ DXF 2D từ script Python, dùng cho bố cục cắt, đường viền và khuôn mẫu. Skill dành cho người làm và xưởng gia công cần file cho máy cắt.
Khi nào nên dùng
- ✓Khi bạn cần một file DXF 2D để cắt laser, plasma hoặc tia nước.
- ✓Khi bạn muốn biến một chi tiết 3D thành đường viền phẳng hoặc bố cục cắt.
- ✓Khi bạn muốn xem lại hoặc chỉnh sửa một file DXF có sẵn trong trình xem.
Liên kết skill
https://github.com/earthtojake/text-to-cad/blob/main/skills/dxf/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể làm một file DXF của tấm 100 x 50 mm có bốn lỗ ở góc để đưa vào máy cắt laser của tôi không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI viết một script Python vẽ hình. Công cụ CAD dựng nó và xuất file DXF, rồi AI kiểm tra file trước khi bạn dùng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
DXF generation and validation
Setup
Run the cad command (~/.local/bin/cad where ~/.local/bin is not on your PATH, or where a
project's environment puts its own cad first; cad.cmd on Windows). If cad is not found and
the CAD app was only just added, its server may still be starting: wait five seconds and run the
command again, for up to a minute, before anything else. Otherwise install text-to-cad, outside a sandbox or with its permission:
curl -fsSL https://texttocad.dev/install.sh | sh
On Windows, in PowerShell: irm https://www.texttocad.dev/install.ps1 | iex. Any other failure
says what to do, and cad doctor explains the installation.
Drawings are build123d geometry, so a drawing builds in the server'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 text-to-cad model does: cad run <name>.py
rebuilds it in the server, 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: cad 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
cad 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
A drawing is a @model function that takes no parameters and returns build123d 2D
geometry on z=0: a sketch, a face, wires or edges. cad export writes the DXF.
You never construct a document, name an entity, or write a file from the model.
import build123d as bd
from cad import model
HOLE_D = 4.5
@model
def gasket():
with bd.BuildSketch() as cut:
bd.Rectangle(60, 40)
bd.Circle(HOLE_D / 2, mode=bd.Mode.SUBTRACT)
return cut.sketch # one shape: the CUT layer
if __name__ == "__main__":
gasket() # decoration only declares: this call builds it
cad run src/gasket.py # prints id: and view:
cad export "$ID" DXF/gasket.dxf # ID: the id: line it printed
One shape is one layer,
CUT. That is the whole contract for most drawings.A layer per part when the drawing genuinely has more than one CAM operation: return a
Compoundof labelled children, each label its layer (profile.label, marks.label = "CUT", "ENGRAVE"). Children sharing a label share a layer, and several shapes make one part of a layer asbd.Compound([a, b], label="ENGRAVE"). A layer name may not be empty or hold any of<>/\":;?*|=and a backtick.Planar means 2D, on z=0. The export refuses a document holding a solid (
bracket is 3D: a DXF is drawn from 2D geometry a model returns) and an edge with any point more than 1e-6 mm off z=0, by its element name. A face taken from a solid sits at that solid's height; relocate it (flatten.flatten_face(face), orbd.Location((0, 0, -z)) * face).No parameters. Dimensions are module constants (
HOLE_D = 4.5) or constants imported from the part the drawing derives from; a different drawing is a different@modelfunction.Text is
bd.Text(...)engraved OUTLINES on a marking layer, never a DXFTEXTentity: cut and marking toolchains consume geometry, and font rendering inside CAM is unreliable.Output bytes are a function of the geometry. Layers are written in name order and entities in an order of their content, so an unchanged drawing exports an identical file, on any machine, and the file is replaced only when its bytes change.
Drawings delivered after every change go in an
exports.pybeside them that imports each drawing and callsexport(drawing, path)(the model function itself, or the handle its call returns):# src/exports.py from pathlib import Path from cad import export from gasket import gasket ROOT = Path(__file__).resolve().parent.parent if __name__ == "__main__": export(gasket, ROOT / "DXF/gasket.dxf")
The three DXF workflows
Copy th
Câu hỏi thường gặp
File DXF là gì?
Đó là định dạng bản vẽ 2D phổ biến mà các máy cắt có thể đọc.
Nó có tạo chi tiết 3D không?
Không. Skill này dành cho bản vẽ 2D. Hãy dùng skill CAD 3D cho chi tiết đặc.
Nó có mở được file DXF có sẵn không?
Có. Skill có thể mở và xem lại các file DXF có sẵn trong trình xem.
Chi tiết
Mô tả gốc của tác giả
Generates, regenerates and validates 2D DXF drawings from Python build123d models, exported by text-to-cad. 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. Covers the 2D drawing, not the 3D part or assembly it derives from, and not a cutting service's order preflight.
repo: earthtojake/text-to-cad
Độ phổ biến
- Sao GitHub
- 25k
- Vị trí xếp hạng
- #10070
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
bambu-labs
25kGiúp agent của bạn gửi một mô hình 3D đã cắt lớp hoặc chưa cắt lớp đến máy in Bambu Lab qua Bambu Connect hoặc Bambu Studio.
cad
25kGiúp agent của bạn thiết kế chi tiết và cụm lắp 3D dưới dạng script Python build123d, xuất ra file STEP hoặc STL và kiểm tra kích thước của chúng.
dfam-check
25kGiúp agent của bạn kiểm tra xem một file lưới 3D có thể in tốt không, báo cáo phần nhô ra, độ dày thành và nhu cầu hỗ trợ.
dfm
25kGiúp agent của bạn review một chi tiết để gia công tấm kim loại, CNC hoặc ép khuôn, kiểm tra xem nó có thể chế tạo được không và cần sửa gì.
Skill tương tự
blucli
394kGiúp agent của bạn tìm, phát, tạm dừng, nhóm và chỉnh âm lượng loa Bluesound và NAD qua lệnh blu.
camsnap
394kGiúp agent của bạn chụp ảnh, quay clip ngắn hoặc lấy sự kiện chuyển động từ camera mạng và webcam nội bộ mà bạn đã thiết lập.
eightctl
394kGiúp agent của bạn kiểm tra và điều khiển thiết bị Eight Sleep pod, gồm nhiệt độ, báo thức và lịch ngủ.