# Creates stitch outlines for each shape if args.noOutline is not True: subshapeLineGroups = prependShapeTraces(paths, subshapeLineGroups, maxStitchDistance=maxStitchDistance) #DEBUG lines: [[[Line(0+0j, 300+0j), Line(300+0j, 300+300j), Line(300+300j, 0+300j) , Line(0+300j, 0+0j)]]] PECCommands = createPECStitchRoutines(subshapeLineGroups, fillColors, threadWidth, maxStitchDistance=maxStitchDistance) left, right, bottom, top = shape.bbox() pec = PEC(label="simple", colors=PECColors, commands=PECCommands, size=complex(right - left, top - bottom)) # Render the PEC commands renderPEC(pec) pes = PES(PEC=pec, shape=shape) encodedPES = pes.encode() with open(args.outputFile, "w") as f: f.write(encodedPES) print("Wrote {} to disk.".format(args.outputFile)) if args.debugRendering: loadedPES = pyembroidery.read(args.outputFile) if loadedPES is not None: print("Generating debug image.") debugImagePath = replaceFilenameAndExtensionFromPath(args.outputFile, "debugPicture" + getFilenameAndExtensionFromPath(args.outputFile)[0], "png") pyembroidery.write_png(loadedPES, debugImagePath) print("Image written to disk: {}".format(debugImagePath)) else: print("Couldn't find output file.")