Nodes/ComfyUI_DAO_master/DXF Add Rectangle
ComfyUI Node

DXF Add Rectangle

DXF Add Rectangle — your first vector shape in a ComfyUI graph

By orion4d·Created about a year ago·Updated 12 months ago· 11
DXF Add Rectangle
  • dxf
  • DXF
x0.00
y0.00
width20.00
height10.00
centeredfalse

ComfyUI isn't exactly famous for CAD. But if you want to generate vector geometry - actual coordinates, not pixels - this is the pack that does it, and DXF Add Rectangle is usually the first node you'll chain. It appends a rectangle to a DXF document, and because every DXF node here is non-destructive, you can keep adding shapes forever without wrecking what you already drew.

This is part of orion4d/ComfyUI_DAO_master, the French-authored vector-and-image utility pack. It leans on ezdxf under the hood, which is a battle-tested Python library for reading and writing real DXF files - the format plotters, laser cutters and CAM software actually eat.

How it works

Every DXF Add … node in this pack shares the same trick: it takes your dxf document in, creates a brand-new empty doc, imports the existing contents into it via ezdxf's Importer, adds the new shape, and hands you a new DXF object out. Nothing mutates the input. That means you can branch - send the same doc down two paths, add a circle to one and a star to the other, and neither pollutes the other.

For the rectangle you get:

  • x, y - anchor point (defaults 0, 0).
  • width, height - dimensions (defaults 20 × 10).
  • centered - if true, (x, y) is the center; if false, it's the lower-left corner. This one bites people who assume center.

Output is a single DXF socket carrying the updated document.

What to do with it

Rectangles are the base for panels, frames, borders, and the building blocks of most geometric designs. Chain it after DXF New (to start a blank doc) and before DXF Preview (to see what you drew) or DXF to SVG (to turn the whole thing into a vector you can use in the SVG side of the pack). Since the pack's SVG converters and clone-grid nodes all speak to each other, a rectangle can go from coordinates to a rendered image entirely inside ComfyUI.

Installing

ComfyUI Manager (search ComfyUI_DAO_master) or:

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

Then install the DXF dependency and restart:

pip install ezdxf

Where people get burned

The usual suspect is the centered flag - set it and your carefully-placed rectangle teleports a half-width left and down. And if you ever get a confusing error, remember the node family is non-destructive: you have to wire your previous DXF output into the next node's dxf input or your rectangle silently starts from an empty document.

CategoryDAO_master/DXF/Primitives

Inputs (6)

NameTypeDefaultDescription
dxfDXF
xFLOAT0.00
yFLOAT0.00
widthFLOAT20.00
heightFLOAT10.00
centeredBOOLEANfalse

Outputs (1)

NameTypeDescription
DXFDXF