make the converted folder automatically

This commit is contained in:
iou1name 2018-03-22 11:59:35 -04:00
parent 7f66638003
commit 884a183910

View File

@ -38,7 +38,7 @@ F_SobelX = {
(1,0): -2, (1,0): -2,
(-1,1): 1, (-1,1): 1,
(0,1): 0, (0,1): 0,
(1,1): -1} (1,1): -1}
F_SobelY = { F_SobelY = {
(-1,-1): 1, (-1,-1): 1,
@ -283,6 +283,7 @@ def sketch(path, export_path=None, resolution=1024, hatch_size=16, contour_simpl
export_path = path.replace("received", "converted") export_path = path.replace("received", "converted")
export_path = os.path.splitext(export_path)[0] export_path = os.path.splitext(export_path)[0]
os.mkdir(os.path.split(path)[0], exist_ok=True)
with open(export_path + ".svg", "w") as file: with open(export_path + ".svg", "w") as file:
file.write(makePathSvg(lines)) file.write(makePathSvg(lines))
with open(export_path + ".ngc", "w") as file: with open(export_path + ".ngc", "w") as file:
@ -339,7 +340,7 @@ def makeGcode(lines, paper_size="letter"):
scale = min(d_x, d_y) scale = min(d_x, d_y)
print("generating gcode file...") print("generating gcode file...")
out = "$X\n$32=1\nM03\nF600\nG17 G21 G90 G54\nG01\n\n" out = "$X\n$32=1\nM03\nF800\nG17 G21 G90 G54\nG01\n\n"
for line in lines: for line in lines:
start = line.pop(0) start = line.pop(0)
out += "S1000\n" out += "S1000\n"