Che cosa rende davvero un SVG pronto per il pen plotting?

Da un po’ di tempo sto dedicando parecchio tempo alla preparazione di disegni al tratto architettonici per il pen plotting, e una cosa è diventata sempre più chiara: un SVG che appare corretto sullo schermo non è necessariamente un buon SVG da inviare a un pen plotter.

Visivamente, due file possono sembrare quasi identici. Dal punto di vista meccanico, però, possono comportarsi in modo molto diverso.

Alcuni degli aspetti a cui ora presto molta più attenzione sono:

  • se il disegno è composto da tratti effettivi anziché da forme riempite;
  • se le linee apparentemente semplici sono davvero tracciati singoli o geometrie complesse con contorno;
  • quanti tracciati separati contiene il file;
  • se ci sono linee duplicate o sovrapposte;
  • l’ordine in cui vengono tracciati i percorsi;
  • quanto movimento non necessario deve compiere il carrello tra un tratto e l’altro;
  • se è possibile separare nettamente spessori di linea diversi per penne differenti.

Quest’ultimo aspetto è particolarmente importante per il tipo di disegni su cui sto lavorando.

Spesso voglio usare diverse penne tecniche nello stesso disegno — per esempio, con spessori di linea fine, medio e maggiore — quindi ho bisogno che l’SVG conservi una struttura sufficiente per assegnare parti diverse del disegno a penne differenti.

Di conseguenza, un file può essere un SVG perfettamente valido e risultare comunque piuttosto inefficiente per il plotting.

Per esempio, un disegno contenente migliaia di tracciati brevi può richiedere molto più tempo del previsto, non perché ci sia un’enorme quantità di inchiostro sulla pagina, ma perché la macchina trascorre molto tempo a sollevare la penna, spostarsi, abbassarla di nuovo e riposizionarsi.

Sto anche constatando che l’ottimizzazione dei tracciati richiede un compromesso.

È allettante ottimizzare tutto nel modo più aggressivo possibile, ma non voglio che un algoritmo di ottimizzazione modifichi la geometria del disegno, unisca linee che dovrebbero rimanere separate o alteri la gerarchia prevista delle linee soltanto per risparmiare qualche minuto.

Quindi sto iniziando a considerare un «SVG pronto per il plotter» come qualcosa di leggermente diverso da un normale file vettoriale.

Idealmente, vorrei che avesse:

  • geometrie a linea singola pulite, ove possibile;
  • nessun tracciato duplicato non necessario;
  • spessori o colori dei tratti prevedibili;
  • una struttura sensata di gruppi o livelli;
  • un ordinamento efficiente dei tracciati;
  • il minimo possibile di spostamenti non necessari con la penna sollevata;
  • geometria che rimanga invariata dopo l’ottimizzazione.

Mi interessa sapere come preparano i propri file SVG le altre persone prima del plotting.

Li ripulite e ottimizzate manualmente in Illustrator, Inkscape, Affinity Designer o in un altro editor vettoriale?

Usate script o software dedicati al plotter per riordinare automaticamente i tracciati?

E dove tracciate il confine tra rendere un disegno più veloce da tracciare e preservare esattamente la geometria originale?

A useful distinction is between an SVG that is visually correct and one that is plotter-explicit: the latter makes the intended pen-down geometry, pen assignment, and drawing order unambiguous.

My preflight would be:

  1. Define the physical document

    • Confirm page size, units, viewBox, scale, and origin.
    • Remove or resolve transforms where possible.
    • Check that the artwork fits the actual machine’s usable area.
  2. Make the plotted geometry explicit

    • Use open or closed stroked paths for linework.
    • Convert text, effects, clipping, live shapes, and unsupported objects to paths.
    • Be cautious with filled shapes: a plotter may outline them, ignore the fill, or require a separate hatching step depending on the software.
    • Keep stroke colour or layer structure meaningful if it controls pen selection.
  3. Clean topology without changing intent

    • Remove exact duplicates and zero-length paths.
    • Detect coincident or nearly coincident segments, but review them before deleting.
    • Join path endpoints only when they are genuinely continuous and should be drawn as one stroke.
    • Avoid converting strokes to outlines unless the outline itself is what should be plotted.
  4. Separate optimisation from geometry editing

    • Path ordering and reversing a path are generally low-risk optimisations.
    • Merging paths, simplifying nodes, snapping endpoints, and removing “near duplicates” can change the drawing.
    • I would preserve an untouched source SVG and write the optimised result as a separate export.

For multiple pens, I would treat each pen as a separate plotting pass or explicit group, for example:

<g id="pen-fine" stroke="#111" fill="none">
  ...
</g>
<g id="pen-medium" stroke="#222" fill="none">
  ...
</g>

The colours themselves are not universal, of course; the important part is that the mapping is predictable in the plotting software. Optimising globally across all pens can produce a shorter route but a worse workflow if it causes frequent tool changes.

A practical ordering strategy is:

  • group by pen first;
  • within each pen, group by layer or semantic importance;
  • minimise pen-up travel within those groups;
  • allow path reversal when the geometry is unchanged;
  • preserve deliberate visual order where overlaps matter.

For architectural drawings, I would not let a generic optimiser freely merge everything. A long wall edge, a hatch, a dimension line, and a label may be geometrically adjacent but should remain separate because they have different pen assignments or meanings.

A good validation method is to compare three things:

  • the original SVG rendered normally;
  • the final SVG rendered normally;
  • a preview showing the actual pen-down sequence, including pen-up moves and pen changes.

Then run a small-scale or low-pressure test plot. A visually identical render cannot reveal excessive lifting, bad path order, or a pen assignment that the plotter software interprets differently.

The related discussion What tools do you use to prepare SVGs for pen plotting? may also be useful for comparing editor-based and scripted workflows. A final post documenting the working preflight rules and toolchain would make a valuable reference for future plotterfolk members.