From f7a9419e629006f2c2a02ac03dcce75d5c43f752 Mon Sep 17 00:00:00 2001 From: Tatarize Date: Mon, 31 Jan 2022 20:33:10 -0800 Subject: [PATCH] Somewhat correct some more of cnd --- pyembroidery/CndReader.py | 18 +++++++++--------- pyembroidery/EmbPattern.py | 21 +++++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/pyembroidery/CndReader.py b/pyembroidery/CndReader.py index 0bb2036..216d23e 100644 --- a/pyembroidery/CndReader.py +++ b/pyembroidery/CndReader.py @@ -1,4 +1,4 @@ -from .ReadHelper import read_int_16le, read_int_8 +from .ReadHelper import read_int_16be, read_int_8 def read_cnd_stitches(f, out): @@ -6,18 +6,18 @@ def read_cnd_stitches(f, out): control = read_int_8(f) if control is None: break - x = read_int_16le(f) - y = read_int_16le(f) - # if control & 0x20 == 0x20: - # y = -y - # if control & 0x40 == 0x40: - # x = -x + x = read_int_16be(f) + y = -read_int_16be(f) + if control & 0x20: + y = -y + if control & 0x40: + x = -x if y is None: break if control & 0xF == 0x07: # Jump - out.move(x, y) + out.trim() continue - elif control & 0xF == 0x01: + if control & 0xF == 0x01: out.stitch_abs(x, y) continue break # Uncaught Control diff --git a/pyembroidery/EmbPattern.py b/pyembroidery/EmbPattern.py index 4a081c5..4424bd8 100644 --- a/pyembroidery/EmbPattern.py +++ b/pyembroidery/EmbPattern.py @@ -5,6 +5,7 @@ import pyembroidery.A100Reader as A100Reader # import pyembroidery.ArtReader as ArtReader import pyembroidery.BroReader as BroReader +import pyembroidery.CndReader as CndReader import pyembroidery.ColReader as ColReader import pyembroidery.ColWriter as ColWriter import pyembroidery.CsvReader as CsvReader @@ -932,16 +933,16 @@ class EmbPattern: "writer": ExpWriter, } ) - # yield ( - # { - # "description": "Melco Condensed Embroidery Format", - # "extension": "cnd", - # "extensions": ("cnd",), - # "mimetype": "application/x-cnd", - # "category": "embroidery", - # "reader": CndReader, - # } - # ) + yield ( + { + "description": "Melco Condensed Embroidery Format", + "extension": "cnd", + "extensions": ("cnd",), + "mimetype": "application/x-cnd", + "category": "embroidery", + "reader": CndReader, + } + ) yield ( { "description": "Tajima Embroidery Format",