svg2plot.tui#
Terminal user interface (TUI) that allows users to select SVG files, convert them to G-Code, and send the G-Code to the plotter.
Key features include:
File Browser: Allows users to navigate through directories and select files.
SVG to G-Code Conversion: Converts SVG graphics into G-Code commands using the vpype library, with options for path optimization, movement speed and pen pressure settings.
Plotting: Connects to the plotter via serial interface, performs a homing cycle if necessary, and sends G-Code commands to start plotting.
Error Handling: Includes checks for path length limits and SVG file properties (e.g., dimensions, respect of dpi conventions).
Functions
|
|
|
Creates a tempfile.NamedTemporaryFile object for data. |
|
|
|
|
|
TODO: add some parameters (/dev/ttyUSB0, baudrate, etc.) |
|
Check in header if svg file has been generated by Adobe Illustrator. |
|
|
|
|
|
Check in header if svg file has a width/height value. |
Prompt selection of pressure value. |
|
|
|
|
Get metadate from SVG file, particularly the number of segments. |
Classes
|
Class to communicate with the plotter's controller. |
- class Controller(*args: Any, **kwargs: Any)[source]#
Bases:
SerialClass to communicate with the plotter’s controller.
- send(console: rich.console.Console, commands: str | list[str]) str[source]#
- stream(console: rich.console.Console, commands: str | list[str]) None[source]#
- connect(console: rich.console.Console) None[source]#
- disconnect(console: rich.console.Console) None[source]#
- get_files_in_directory(directory: str) tuple[rich.table.Table, dict[int, str]][source]#
- header(console: rich.console.Console) None[source]#
TODO: add some parameters (/dev/ttyUSB0, baudrate, etc.)
- file_browser(console: rich.console.Console, current_directory: str) str[source]#
- too_many_lines(drawing: vpype.Document, console: rich.console.Console) bool[source]#
Get metadate from SVG file, particularly the number of segments.
- no_size(svg: str) bool[source]#
Check in header if svg file has a width/height value.
Adobe Illustrator tends not to.
- is_adobe_svg(file: str, head: int = 10) bool[source]#
Check in header if svg file has been generated by Adobe Illustrator.
- create_temporary_file(data: str, suffix: str = '') str[source]#
Creates a tempfile.NamedTemporaryFile object for data.
source:https://programtalk.com/vs4/python/Aguila-team/aguila_nlu/rasa_nlu/utils/__init__.py/
- convert_svg_gcode(console: rich.console.Console, svg_file: str) str | None[source]#
- setup_plotter(console: rich.console.Console, gcode_file: str) None[source]#