diff --git a/pyembroidery/U01Reader.py b/pyembroidery/U01Reader.py index 93b44537..6e4e3683 100644 --- a/pyembroidery/U01Reader.py +++ b/pyembroidery/U01Reader.py @@ -16,34 +16,57 @@ def read_u01_stitches(f, out): if (ctrl & 0x40) != 0: dy = -dy command = ctrl & 0b11111 - #print(str(count), " ", str("{0:b}").format(ctrl), " 0x%0.2X " % ctrl, str(command), " " + str(dx), " ", str(dy)) + # print(str(count), " ", str("{0:b}").format(ctrl), " 0x%0.2X " % ctrl, str(command), " " + str(dx), " ", str(dy)) if command == 0x0: + # Stitch out.stitch(dx, dy) continue - if command == 0x1: + if command == 0x01: + # Jump out.move(dx, dy) continue - if command == 0x2: + if command == 0x02: + # Fast out.add_stitch_relative(FAST) if dx != 0 or dy != 0: out.stitch(dx, dy) continue - if command == 0x4: + if command == 0x03: + # Fast, Jump + out.add_stitch_relative(FAST) + if dx != 0 or dy != 0: + out.move(dx, dy) + continue + if command == 0x04: + # Slow out.add_stitch_relative(SLOW) if dx != 0 or dy != 0: out.stitch(dx, dy) continue - if command == 0x7: + if command == 0x05: + # Slow, Jump + out.add_stitch_relative(SLOW) + if dx != 0 or dy != 0: + out.move(dx, dy) + continue + if command == 0x06: + # T1 Top Thread Trimming, TTrim. + out.trim(dx, dy) + continue + if command == 0x07: + # T2 Bobbin Threading out.trim(dx, dy) continue - if command == 0x8: # ww, stop file had proper A8 rather than E8 and displacement + if command == 0x08: # ww, stop file had proper A8 rather than E8 and displacement + # C00 Stop out.stop(dx, dy) continue - if 0xE9 <= ctrl <= 0xEF: + if 0x09 <= command <= 0x17: + # C01 - C14 if count > 1: out.color_change(dx, dy) continue - if ctrl == 0xF8: + if command == 0x18: break break # Uncaught Command out.end()