Nodes/ComfyUI_DAO_master/Convertisseur DXF vers SVG
ComfyUI Node

Convertisseur DXF vers SVG

The DXF → SVG converter that joins the seams

By orion4d·Created about a year ago·Updated 12 months ago· 11
Convertisseur DXF vers SVG
  • dxf
  • svg_text
  • path
curve_quality50
scale1.00
padding_percent5
close_tolerance_percent0.000
fill_ruleevenodd
directoryoutput/svg
filenameshape.svg
timestamp_suffixtrue
save_filetrue

The DXF and SVG lanes of ComfyUI_DAO_master meet at this node. DXF to SVG takes the in-memory DXF drawing and emits it as SVG text - which matters because SVG is where ComfyUI's vector tools get friendly: you can restyle it, boolean it, rasterize it back to an image, or hand the file to a browser, a plotter, or a laser tool that speaks SVG but not DXF. It's the bridge that lets you build in CAD and live in the SVG world.

How it works

The conversion is genuinely clever about geometry. Each DXF entity is flattened into a polyline (curves get sampled according to a quality setting), and then the node tries to join polylines together - if the end of one segment touches the start of another within a tolerance, they're fused into a longer path. That's the difference between a mess of hundreds of tiny line segments and a clean SVG path. The joined polylines are then split into closed loops (which become filled path elements) and open paths (which become strokes with no fill). The Y axis is flipped to SVG convention, and a viewBox is computed around the drawing with the padding you request.

Two details that matter:

  • fill_rule - evenodd (default) or nonzero. This controls how holes work when closed paths overlap. If you're converting a drawing with donut holes, evenodd is usually the friendlier choice; if holes come out wrong, try the other.
  • curve_quality (default 50) - how finely curves are sampled. Higher = smoother, bigger file. This maps to the flattening tolerance; don't crank it to 100 and then complain about an enormous SVG.

Inputs that matter

  • dxf - the document to convert.
  • curve_quality, scale, padding_percent (default 5), close_tolerance_percent, fill_rule - the geometry knobs above.
  • directory (default output/svg), filename (default shape.svg), timestamp_suffix, save_file - the save block, same behavior as the pack's other exporters.

Outputs

  • svg_text - the SVG_TEXT output, ready to feed SVG Style, SVG Boolean, SVG Preview, or SVG Save.
  • path - the absolute path of the saved file, if save_file is on.

How to install

Part of the orion4d/ComfyUI_DAO_master pack:

cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/ComfyUI_DAO_master.git
pip install ezdxf svgpathtools      # svgpathtools builds the SVG path geometry

Restart ComfyUI. No models.

Common issues

If your open polylines aren't closing up into shapes, raise close_tolerance_percent a little - it's a percentage of the drawing's diagonal, so a small value like 0.5 goes a long way. If the exported SVG has holes where you didn't expect them, flip fill_rule between evenodd and nonzero. And curve_quality is a genuine trade-off: too low and circles look like octagons, too high and your SVG balloons in size for no visible gain. Start at 50, adjust only when something looks wrong.

CategoryDAO_master/SVG/Convert

Inputs (10)

NameTypeDefaultDescription
dxfDXF
curve_qualityINT501–100
scaleFLOAT1.000.1–10
padding_percentFLOAT50–50
close_tolerance_percentFLOAT0.0000–1
fill_ruleCOMBOevenodd2 options: evenodd, nonzero
directorySTRINGoutput/svg
filenameSTRINGshape.svg
timestamp_suffixBOOLEANtrue
save_fileBOOLEANtrue

Outputs (2)

NameTypeDescription
svg_textSVG_TEXT
pathSTRING