Overview of the pyembroidery workflow
mainThe library follows a specific data flow for reading, writing, and converting embroidery files. The core data structure is the EmbPattern object.
Data Flow Models
- Read:
File$\rightarrow$Reader$\rightarrow$Pattern(AnEmbPatternis created from a file object/stream). - Write:
Pattern$\rightarrow$Encoder$\rightarrow$Pattern$\rightarrow$Writer$\rightarrow$File(The encoder ensures data is coherent for the specific writer/format). - Convert:
File$\rightarrow$Reader$\rightarrow$Pattern$\rightarrow$Encoder$\rightarrow$Pattern$\rightarrow$Writer$\rightarrow$File(A full round-trip conversion).
Key Components
- Reader: Parses files and populates an
EmbPatternwith metadata, threads, and stitches. - EmbPattern: The central object containing all pattern data.
- Encoder: Converts low-level and middle-level commands into a format suitable for the writer. It can be called directly on a pattern using
.get_normalized_pattern()to return a new, encoded pattern without modifying the original.