feat: add svg to gcode parser
This commit is contained in:
25
svg_to_gcode.py
Executable file
25
svg_to_gcode.py
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import shlex
|
||||
import vpype
|
||||
import vpype_cli
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Convert SVG files to G-code.")
|
||||
parser.add_argument("input", type=str, help="Input SVG file path")
|
||||
parser.add_argument("output", type=str, help="Output G-code file path")
|
||||
vpype_args = parser.parse_args()
|
||||
|
||||
svg_collection, width, height = vpype.read_svg(vpype_args.input, 4)
|
||||
doc = vpype.Document(svg_collection, page_size=(width, height))
|
||||
|
||||
@vpype_cli.cli.command(group="vsketch")
|
||||
@vpype_cli.global_processor
|
||||
def vsketchinput(document):
|
||||
document.extend(doc)
|
||||
return document
|
||||
|
||||
vpype_args = "vsketchinput gwrite -p hp7044b {}".format(vpype_args.output)
|
||||
vpype.config_manager.load_config_file("config.toml")
|
||||
vpype_cli.cli.main(prog_name="vpype", args=shlex.split(vpype_args), standalone_mode=False)
|
||||
Reference in New Issue
Block a user