Nodes/ComfyUI_DAO_master/DXF New (ezdxf)
ComfyUI Node

DXF New (ezdxf)

The DXF New node

By orion4d·Created about a year ago·Updated 12 months ago· 11
DXF New (ezdxf)
    • DXF
    unitsmm

    ComfyUI is pixel land. Every node hands you a tensor and the only thing you ever save is a PNG. Then this pack comes along and there's a node that starts an actual DXF drawing - the file format behind laser cutters, CNC routers and pen plotters. DXF New is the entry point to that whole lane, and it's almost embarrassingly simple: it creates an empty CAD document in memory and hands it to the next node. Nothing else. Which is exactly why it's the first node in every DXF workflow this pack ships.

    The use case is more niche than most ComfyUI stuff, but it's a real one. Generate a mask or an outline with a diffusion model, clean it up, then build a DXF from it and cut it on a machine. That image-to-laser workflow is a whole little community (a 85-point thread on r/comfyui's "image to laser cutter ready art" was built on exactly this idea). DXF New is where you start before any of the geometry gets added - feed it into DXF Add Circle, DXF Add Rectangle, or any of the other primitives, then preview and save.

    How it works

    Under the hood it's a thin wrapper around ezdxf, the Python library that reads and writes DXF files. The node calls ezdxf.new(setup=True), stamps the units you pick into the drawing's $INSUNITS header, and returns a small object that carries the document, the modelspace, and your unit choice. Everything is in memory - nothing touches disk until you hit DXF Save.

    One thing worth knowing: the output type is a custom DXF type, not a standard ComfyUI type. It only plugs into the other DXF nodes in this pack (Add, Transform, Preview, Save, Stats). You can't wire it into an arbitrary pack's node, and there's no way around that except converting, e.g. DXF Preview to turn the geometry into an image you can actually work with elsewhere.

    The one input that matters

    DXF New has a single input: units, defaulting to mm. Your options are unitless, mm, cm, m, inch, foot, and px. Pick it before you draw anything, because the units travel with the document and define what a "radius of 5" means downstream.

    • mm - the default, and what you want for most laser/CNC work.
    • inch / foot - if you're a woodshop person or working from an imperial drawing.
    • px - only really useful if the DXF is headed for raster preview, not a machine.

    Realistically you'll set this once per project and never touch it again.

    How to install

    This is one of 30+ nodes in the orion4d/ComfyUI_DAO_master pack, so installing the pack gives you all of them at once.

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/ComfyUI_DAO_master.git
    

    Then install the DXF-side dependency (ezdxf) - ComfyUI Manager handles this automatically if you install via the Manager's search ("ComfyUI_DAO_master"); manually it's:

    pip install -r requirements.txt   # or at minimum: pip install ezdxf
    

    Restart ComfyUI after installing. There are no model downloads for this pack - it's pure code.

    Common issues

    If the node shows up red, it's almost always a missing ezdxf import - check the console log for the exact error and pip install ezdxf into the same Python environment ComfyUI runs in (the venv, not your global pip, if you used one). Also note this node marks itself changed on every run, so it re-executes each time you hit queue - harmless, but don't be surprised to see it flash every run. And if you forget which units you picked, don't sweat it: DXF files carry the units in their header, so DXF Stats and downstream tools read them from the document, not from your memory.

    CategoryDAO_master/DXF

    Inputs (1)

    NameTypeDefaultDescription
    unitsCOMBOmm7 options: unitless, mm, cm, m, inch, foot, +1

    Outputs (1)

    NameTypeDescription
    DXFDXF