-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvpype.py
More file actions
34 lines (24 loc) · 799 Bytes
/
vpype.py
File metadata and controls
34 lines (24 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import subprocess
# This script takes an svg drawing and outputs it into gcode using vpype
def svg_to_gcode(input_file, output_gcode):
try:
# Run Vpype commands
commands = [
"vpype",
"read", input_file,
"gwrite",
"--profile",
"gcode_maker_select",
output_gcode
]
# Execute commands
result = subprocess.run(commands, check=True, capture_output=True, text=True)
print(result.stdout)
print(f"G-code saved to: {output_gcode}")
except subprocess.CalledProcessError as e:
print(f"Error: {e.stderr}")
def main():
svg_in = "./svgs/snowflake-hex-svgrepo-com.svg"
output_file = "./gcodes/output.gcode"
svg_to_gcode(svg_in, output_file)
main()