Metadata-Version: 2.4
Name: svg2plot
Version: 0.1.0b1
Summary: Terminal User Interface (TUI) to convert svg files to gcode and stream them via usb serial port to your xy-plotter.
Author: Julien Rippinger
License-Expression: GPL-3.0-or-later
Project-URL: Documentation, https://svg2plot.readthedocs.io/en/latest/
Project-URL: Codeberg, https://codeberg.org/mononym/svg2plot/
Project-URL: Issues, https://codeberg.org/mononym/svg2plot/issues
Project-URL: Changelog, https://codeberg.org/mononym/svg2plot/src/branch/main/CHANGELOG.rst
Keywords: plotter,drawing,gcode
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Operating System :: POSIX :: Linux
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Artistic Software
Classifier: Topic :: Multimedia :: Graphics :: Editors :: Vector-Based
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
License-File: LICENSES/GPL-3.0-or-later.txt
Requires-Dist: matplotlib>=3.8
Requires-Dist: vpype<2,>=1.15
Requires-Dist: vpype-gcode>=0.13
Requires-Dist: pyserial>=3.5
Requires-Dist: tomli-w>=1.0
Requires-Dist: rich>=13
Dynamic: license-file

.. SPDX-FileCopyrightText: 2026 Julien Rippinger
..
.. SPDX-License-Identifier: CC-BY-4.0

svg2plot
========

.. start-svg2plot

**svg2plot turns a vector drawing into a drawing on paper.**

A terminal interface that converts SVG files into G-code and streams them over USB to a pen plotter running GRBL.
It is the interface of the *Chelonograph*, the in-house pen plotter of the AlICe laboratory.

📖 **Documentation:** https://svg2plot.readthedocs.io — tutorial, how-to guides, and an explanation of how a drawing travels from file to paper.

Install
-------

Linux, Python 3.11 to 3.13:

.. code:: sh

   uv tool install svg2plot   # or: pipx install svg2plot
   svg2plot                   # optional: svg2plot <path_limit>, default 75

The user needs write access to the serial port (``/dev/ttyUSB0``), e.g. ``sudo gpasswd -a <username> uucp`` (``dialout`` on Debian).

How it works
------------

.. code:: text

   file.svg → read → check → optimise → G-code → USB stream → GRBL → motors

The conversion is equivalent to this vpype command, with a generated ``chelonograph`` profile that writes the pen pressure into the Z moves:

.. code:: sh

   vpype read in.svg linesimplify reloop linemerge linesort write in_optimized.svg \
         gwrite -p chelonograph in_optimized_p07.gcode

Streaming is send-and-wait: one line, then wait for GRBL's ``ok``.

Development
-----------

.. code:: sh

   git clone https://codeberg.org/mononym/svg2plot.git
   cd svg2plot
   uv sync                    # package + dev dependencies

.. list-table::
   :widths: 30 70

   * - Lint
     - ``uv run ruff check src && uv run ruff format --check src``
   * - Type check
     - ``uv run --with mypy mypy --ignore-missing-imports src/svg2plot``
   * - Docs
     - ``uv run sphinx-autobuild docs/source docs/build``
   * - Build
     - ``uv build && uvx twine check --strict dist/*``

CI (Woodpecker) runs the same checks on Python 3.11, 3.12 and 3.13.

Layout:

.. code:: text

   src/svg2plot/
     tui.py                 interface, conversion and streaming
     gcode_highlighter.py   terminal colours for G-code
   docs/source/             Sphinx docs (tutorial, how-to, explanation, reference)

Issues and contributions: https://codeberg.org/mononym/svg2plot/issues

Acknowledgements
----------------

- `vpype <https://github.com/abey79/vpype>`__ and `vpype-gcode <https://github.com/plottertools/vpype-gcode>`__
- `GRBL <https://github.com/gnea/grbl>`__ and its `simple_stream.py <https://github.com/gnea/grbl/blob/master/doc/script/simple_stream.py>`__

Licenses
--------

- svg2plot: `GNU General Public License v3.0 or later <https://www.gnu.org/licenses/gpl-3.0-standalone.html>`__
- documentation & images: `Creative Commons Attribution 4.0 International <https://creativecommons.org/licenses/by/4.0/>`__
- sphinx files: `2-Clause BSD License <https://opensource.org/license/BSD-2-Clause>`__
- miscellaneous: `CC0 1.0 Universal <https://creativecommons.org/publicdomain/zero/1.0>`__

.. end-svg2plot
