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

From KDE Community Wiki
(Tajima Ternary format)
 
(→‎Header: remove unnecessary duplication)
 
(3 intermediate revisions by the same user not shown)
Line 24: Line 24:
|-
|-
| 0
| 0
| 3
| 20
| ASCII
| = "LA:" label label
|-
| 3
| 16
| ASCII
| ASCII
| Name padded with spaces 0x20, sometimes terminated with nul 0x00
| = "LA:" (label) Name padded with spaces 0x20, sometimes terminated with nul 0x00
|-
| 19
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
|-
| 20
| 20
| 3
| 11
| ASCII
| ASCII
| = "ST:" stitch count label
| = "ST:" (stitch count) decimal number padded with zero or space
|-
|-
| 23
| 31
| 7
| 7
| ASCII
| ASCII
| decimal number padded with zero or space
| = "CO:" (colour count) decimal number
|-
| 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
| 38
| 3
| 9
| ASCII
| = "+X:" maximum X extent label in tenths of a millimetre
|-
| 41
| 5
| ASCII
| decimal number padded with zero or space
|-
| 46
| 1
| ASCII
| ASCII
| = carriage-return 0x0D terminator
| = "+X:" (maximum X extent) decimal number in tenths of a millimetre
|-
|-
| 47
| 47
| 3
| 9
| ASCII
| ASCII
| = "-X:" minimum X extent label in tenths of a millimetre
| = "-X:" (minimum X extent) decimal number in tenths of a millimetre
|-
| 50
| 5
| ASCII
| decimal number padded with zero or space
|-
| 55
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
|-
| 56
| 56
| 3
| 9
| ASCII
| = "+Y:" maximum Y extent label in tenths of a millimetre
|-
| 59
| 5
| ASCII
| decimal number padded with zero or space
|-
| 64
| 1
| ASCII
| ASCII
| = carriage-return 0x0D terminator
| = "+Y:" (maximum Y extent) decimal number in tenths of a millimetre
|-
|-
| 65
| 65
| 3
| 9
| ASCII
| ASCII
| = "-Y:" minimum Y extent label in tenths of a millimetre
| = "-Y:" (minimum Y extent) decimal number in tenths of a millimetre
|-
| 68
| 5
| ASCII
| decimal number padded with zero or space
|-
| 73
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
|-
| 74
| 74
| 3
| 10
| ASCII
| = "AX:" needle end point X label in tenths of a millimetre
|-
| 77
| 1
| ASCII
| ASCII
| plus "+" or minus "-" sign of following number
| = "AX:" (needle end point X) "+" or "-" decimal number in tenths of a millimetre
|-
| 78
| 5
| ASCII
| decimal number padded with zero or space
|-
| 83
| 1
| ASCII
| = carriage-return 0x0D terminator
|-
|-
| 84
| 84
| 3
| 10
| ASCII
| ASCII
| = "AY:" needle end point Y label in tenths of a millimetre
| = "AY:" (needle end point Y) "+" or "-" decimal number 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
| 94
| 3
| 10
| ASCII
| ASCII
| = "MX:" previous file needle end point X label in tenths of a millimetre
| = "MX:" (previous file needle end point X) "+" or "-" decimal number 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
| 104
| 3
| 10
| 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
| ASCII
| = carriage-return 0x0D terminator
| = "MY:" (previous file needle end point Y) "+" or "-" decimal number in tenths of a millimetre
|-
|-
| 114
| 114
| 3
| 10
| ASCII
| = "PD:" previous file  label
|-
| 117
| 6
| ASCII
| = "******" if single file
|-
| 123
| 1
| ASCII
| ASCII
| = carriage-return 0x0D terminator
| = "PD:" (previous file) "******" if single file
|-
|-
| 124
| 124
Line 233: Line 93:
| = spaces 0x20 or sometimes contains colour information
| = spaces 0x20 or sometimes contains colour information
|}
|}




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


= Stitch =
= Stitch =
Line 320: Line 180:
|-
|-
| 4
| 4
| Y -= 81
| Y -= 81, the end-of-pattern code sets both Y += 81 and Y -= 81 which cancel each other
|-
|-
| 3
| 3
Line 329: Line 189:
|-
|-
| 1
| 1
| = 1
| = 1 synchronization bit
|-
|-
| 0
| 0
| = 1
| = 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).
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