Convertisseur DXF vers SVG
The DXF → SVG converter that joins the seams
- dxf
- svg_text
- path
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) ornonzero. This controls how holes work when closed paths overlap. If you're converting a drawing with donut holes,evenoddis 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(defaultoutput/svg),filename(defaultshape.svg),timestamp_suffix,save_file- the save block, same behavior as the pack's other exporters.
Outputs
svg_text- theSVG_TEXToutput, ready to feedSVG Style,SVG Boolean,SVG Preview, orSVG Save.path- the absolute path of the saved file, ifsave_fileis 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.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| dxf | DXF | — | |
| curve_quality | INT | 501–100 | — |
| scale | FLOAT | 1.000.1–10 | — |
| padding_percent | FLOAT | 50–50 | — |
| close_tolerance_percent | FLOAT | 0.0000–1 | — |
| fill_rule | COMBO | evenodd | 2 options: evenodd, nonzero |
| directory | STRING | output/svg | — |
| filename | STRING | shape.svg | — |
| timestamp_suffix | BOOLEAN | true | — |
| save_file | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| svg_text | SVG_TEXT | — |
| path | STRING | — |