Projects/Liberty/File Formats/Tajima Ternary

From KDE Community Wiki

Tajima Ternary DST

This is based on an old paper tape format, thread colour is not usually stored in the file. At each thread change stop, the thread colour has to be found in an external source; the embroidery machine usually gives needle number or stitch count at each stop.

The file is in two parts: a textual header part of 512 bytes and a binary stitches part. Each stitch has attributes indicating: normal stitch, jump stitch, colour change stop, and end of pattern stop.

The textual part is said not to be very accurate and is more user information. It does have data to link to a previous tape or file which is rarely used.

Appliqué is used extensively in commercial embroidery (probably to save time), I think the colour change stop is also used for cutting the pieces (or placing precut pieces) before embroidering their edges. In home appliqué a baste stitch is often used to the pieces in place.

In the style of Backus-Naur Form,

file = header {stitch}

Header

The header is 512 ASCII characters containing fields, although the fields could be variable length, they appear to be fixed width and fixed offset. A field is labelled by a two letter code and a colon, then the value and terminated by an ASCII carriage-return CR (0/13). The fields are terminated by ASCII Control-Z (1/10) and sometimes the space following is used for colour information, otherwise it is padded with ASCII space (2/0).

Offset Size Type Description
0 20 ASCII = "LA:" (label) Name padded with spaces 0x20, sometimes terminated with nul 0x00
20 11 ASCII = "ST:" (stitch count) decimal number padded with zero or space
31 7 ASCII = "CO:" (colour count) decimal number
38 9 ASCII = "+X:" (maximum X extent) decimal number in tenths of a millimetre
47 9 ASCII = "-X:" (minimum X extent) decimal number in tenths of a millimetre
56 9 ASCII = "+Y:" (maximum Y extent) decimal number in tenths of a millimetre
65 9 ASCII = "-Y:" (minimum Y extent) decimal number in tenths of a millimetre
74 10 ASCII = "AX:" (needle end point X) "+" or "-" decimal number in tenths of a millimetre
84 10 ASCII = "AY:" (needle end point Y) "+" or "-" decimal number in tenths of a millimetre
94 10 ASCII = "MX:" (previous file needle end point X) "+" or "-" decimal number in tenths of a millimetre
104 10 ASCII = "MY:" (previous file needle end point Y) "+" or "-" decimal number in tenths of a millimetre
114 10 ASCII = "PD:" (previous file) "******" if single file
124 4 ASCII = 0x1a 0x20 0x20 0x20 or 0x1a 0x00 0x00 0x00 end of header data
128 384 ASCII = spaces 0x20 or sometimes contains colour information


The multiple file or tape fields: AX, AY, MX, MY, and PD are seldom used.

Stitch

Each stitch is 3 bytes.

Offset Size Type Description
0 3 Code 24 bit big-endian bit set

Stitch Code Bits

The end of pattern has the code value 0x0000F3, otherwise see table below.

Bit Description
23 Y += 1 add 0.1 mm to needle's Y current coordinate
22 Y -= 1 subtract 0.1 mm from the needle's current Y position
21 Y += 9
20 Y -= 9
19 X -= 9
18 X += 9
17 X -= 1
16 X += 1
15 Y += 3
14 Y -= 3
13 Y += 27
12 Y -= 27
11 X -= 27
10 X += 27
9 X -= 3
8 X += 3
7 Jump stitch (not a normal stitch)
6 Stop for colour change or end of pattern
5 Y += 81
4 Y -= 81, the end-of-pattern code sets both Y += 81 and Y -= 81 which cancel each other
3 X -= 81
2 X += 81
1 = 1 synchronization bit
0 = 1 synchronization bit, two LSB only set in byte 3


Several jump stitches may be run together to span distances greater than 12.1 mm, the following normal stitch is the start of the next run of stitches (don't draw a line from the last move stitch to the following normal stitch).

References