Projects/Liberty/File Formats/Tajima Ternary: Difference between revisions

From KDE Community Wiki
(→‎Header: simplified description)
(→‎Header: remove unnecessary duplication)
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:


= Header =
= 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).


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).
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).
Line 96: Line 94:
|}
|}


{| class="wikitable"
! Offset
! Size
! Type
! Description
|-
| 0
| 3
| ASCII
| = "LA:" label label
|-
| 3
| 16
| ASCII
| Name padded with spaces 0x20, sometimes terminated with nul 0x00
|-
| 19
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 20
| 3
| ASCII
| = "ST:" stitch count label
|-
| 23
| 7
| ASCII
| decimal number padded with zero or space
|-
| 30
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 31
| 3
| ASCII
| = "CO:" colour count label
|-
| 34
| 3
| ASCII
| decimal number padded with zero or space
|-
| 37
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 38
| 3
| ASCII
| = "+X:" maximum X extent label in tenths of a millimetre
|-
| 41
| 5
| ASCII
| decimal number padded with zero or space
|-
| 46
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 47
| 3
| ASCII
| = "-X:" minimum X extent label in tenths of a millimetre
|-
| 50
| 5
| ASCII
| decimal number padded with zero or space
|-
| 55
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 56
| 3
| ASCII
| = "+Y:" maximum Y extent label in tenths of a millimetre
|-
| 59
| 5
| ASCII
| decimal number padded with zero or space
|-
| 64
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 65
| 3
| ASCII
| = "-Y:" minimum Y extent label in tenths of a millimetre
|-
| 68
| 5
| ASCII
| decimal number padded with zero or space
|-
| 73
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 74
| 3
| ASCII
| = "AX:" needle end point X label in tenths of a millimetre
|-
| 77
| 1
| ASCII
| plus "+" or minus "-" sign of following number
|-
| 78
| 5
| ASCII
| decimal number padded with zero or space
|-
| 83
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 84
| 3
| ASCII
| = "AY:" needle end point Y label in tenths of a millimetre
|-
| 87
| 1
| ASCII
| plus "+" or minus "-" sign of following number
|-
| 88
| 5
| ASCII
| decimal number padded with zero or space
|-
| 93
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 94
| 3
| ASCII
| = "MX:" previous file needle end point X label in tenths of a millimetre
|-
| 97
| 1
| ASCII
| plus "+" or minus "-" sign of following number
|-
| 98
| 5
| ASCII
| decimal number padded with zero or space
|-
| 103
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 104
| 3
| ASCII
| = "MY:" previous file needle end point Y label in tenths of a millimetre
|-
| 107
| 1
| ASCII
| plus "+" or minus "-" sign of following number
|-
| 108
| 5
| ASCII
| decimal number padded with zero or space
|-
| 113
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 114
| 3
| ASCII
| = "PD:" previous file  label
|-
| 117
| 6
| ASCII
| = "******" if single file
|-
| 123
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
| 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
|}




Line 416: Line 197:


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).
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 =
* [http://www.fineemb.com/blog/archives/dst-file-encoding.html DST FineEmb Studio]
* [http://www.achatina.de/sewing/main/TECHNICL.HTM Technical Info at Achatina]
* [http://embroidermodder.svn.sourceforge.net/viewvc/embroidermodder/dst.cpp?revision=25&view=markup embroidermodder]
* [http://code.google.com/p/pyembroidery/source/browse/trunk/pyembroidery.py pyembroidery]





Latest revision as of 01:10, 15 January 2013

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