def debug(): debug = [] blah = [] for section in points: for p in section: blah.append(p) debug.append(list(blah)) count = 0 for section in debug: emb = stitchcode.Embroidery() for p in section: emb.addStitch(straight_stitch.copy(p)) write_to_file(emb, "A" + str(count)) count = count + 1
else: usage() sys.exit() if len(infile) == 0: print "options required." usage() sys.exit(2) if __name__ == '__main__': process_args() if not outfile: outfile = infile emb = stitchcode.Embroidery() emb.load(infile) emb.scale(zoom) emb.translate_to_origin() if to_triple_stitches: print "convert to triple stitches" emb.to_triple_stitches(distance * 10) if to_red_work: print "convert to red work stitches" emb.to_red_work(distance * 10) if show_stitches and (outfile[-3:]).lower() == "png": emb.save_as_png(outfile, show_stitches) else:
def clear_data(self): self.emb = stitchcode.Embroidery() self.points = [] self.last_point = 0
graph1[-1].color = 1 #unknown2.reverse() graph2.extend(unknown2) graph2[-1].color = 1 return graph1, graph2 def write_to_file(emb, name): emb.translate_to_origin() #emb.scale(1) emb.flatten() emb.save("Output/" + name + ".exp") emb.save("Output/" + name + ".png") if __name__ == "__main__": points = [] vis = Vis() vis.read_file() points1, points2 = vis.generate() emb1 = stitchcode.Embroidery() emb2 = stitchcode.Embroidery() for p in points1: emb1.addStitch(p) for p in points2: emb2.addStitch(p) write_to_file(emb1, "mes6_in") write_to_file(emb2, "mes6_out")