37 lines
909 B
Python
37 lines
909 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Brings together the different components needed to make the drawing
|
|
machine chooch.
|
|
"""
|
|
import os
|
|
|
|
import stream
|
|
import linedraw
|
|
|
|
def draw(rec_filename):
|
|
"""
|
|
Takes the filename received from the bluetooth server, vectorizes
|
|
it and streams the resulting G-code to the GRBL controller.
|
|
"""
|
|
print("Vectorizing " + rec_filename + "...")
|
|
linedraw.sketch(rec_filename)
|
|
gcode_filename = rec_filename.replace("received", "converted")
|
|
gcode_filename = os.path.splitext(gcode_filename)[0] + ".ngc"
|
|
print("Streaming " + gcode_filename + "...")
|
|
stream.stream(gcode_filename)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(
|
|
description="Vectorizes the given image and streams the resultant" \
|
|
+ "G-code to GRBL.")
|
|
parser.add_argument(
|
|
"filename",
|
|
help="The path to the image to be drawn.")
|
|
args = parser.parse_args()
|
|
|
|
draw(args.filename)
|
|
|