VPype G-Code Generator
The node between your AI image and a real pen mark
- gcode_output
Every other node in ComfyUI makes pixels. This one makes machine movement. VPypeGCodeGenerator is the last step in the boardmain/ComfyUI-Svg2Gcode chain: feed it a clean SVG and it spits out G-code your pen plotter or CNC can actually run. If you've got an AxiDraw, a cheap 3018-style machine, or anything that eats G-code, this is the node that takes your AI image from the screen to the page.
You almost never use it alone. The typical flow is image → SVG tracer → VPypeProcessor (or the extended one) to clean the geometry → this node → a file you can send to your machine.
How it works
Like its sibling processors, this node doesn't draw anything itself. It writes your SVG to a temp file, generates a TOML config for the vpype-gcode plugin, then runs vpype -c config read input.svg gwrite -p default output.gcode and returns the text. The config is where the plot personality lives: it emits absolute positioning (G90), sets units to millimeters (G21), homes the pen to X0 Y0 with G92, marks each SVG layer in the output, and finishes with a pen-up and M2 end-of-program. In between, every line is a G1 move at your chosen feed rate.
The inputs that matter
Only five, and honestly only two are interesting.
svg_input(STRING) - the SVG content, usually wired from aVPypeProcessoroutput. The node can also take a file path.pen_upandpen_down- the Z positions for traveling vs. drawing. Here's a genuine trap: the README claims defaults of pen_up=5, pen_down=0, but the shipped code defaults to the reverse - pen_up=0, pen_down=5. If your machine treats positive Z as "up" (most do), that means it will try to draw with the pen lifted and travel with it touching. Your first plot will either be invisible or a smeared drag line. Just set pen_up higher than pen_down and confirm which direction your machine calls up, and you're fine.speed(1000 mm/min) - the feed rate. Start conservative; a pen skipping across paper is usually a speed problem.invert_y(off) - flips the Y axis. Turn it on when the plot comes out mirrored, which is common after a rotation upstream or on machines whose Y convention doesn't match the SVG.
The single output, gcode_output (STRING), is the whole payoff.
Getting the G-code out
Here's the bit the README doesn't spell out: the node only returns a string - it doesn't save a file. You need to capture it yourself. Wire it into a text-saving or preview node, or grab it from the node's output and write it to a .gcode file before loading it into whatever you use to drive the machine (OctoPrint, UGS, LightBurn, or the plotter vendor's software). It's a two-second extra step, but it catches everyone on the first run.
Installing it
Standard pack install - ComfyUI Manager, search "ComfyUI-Svg2Gcode", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/boardmain/ComfyUI-Svg2Gcode
cd ComfyUI-Svg2Gcode
pip install -r requirements.txt
That pulls vpype, vpype-occult, and vpype-gcode - the vpype-gcode part is essential here, without it the gwrite command doesn't exist. No model files, nothing GPU-related. Install into the same Python environment that starts ComfyUI, or the node's subprocess call won't find vpype at all.
Where people get burned
The pen_up/pen_down flip above is the one that bites. Beyond that: machines that interpret invert_y differently, and the ever-present "vpype executable not found" error when ComfyUI is launched from a different environment than the one where you installed the packages (common on Windows). Fix it by installing into the right environment and checking vpype --version in the same shell that runs ComfyUI. The pack is tiny and mostly unspoken-for in the community - the author announced it on r/comfyui to a grand total of one upvote - so treat the defaults skeptically and verify on a cheap test plot before you burn good paper.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| svg_input | STRING | — | |
| pen_up | FLOAT | 0.00–10 | — |
| pen_down | FLOAT | 5.00–15 | — |
| speed | FLOAT | 10001–10000 | — |
| invert_y | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| gcode_output | STRING | — |