Difference between revisions of "Projects/Liberty/File Formats/Viking Pfaff"

(→‎Thread: add total displacement)
Line 1: Line 1:
 
== Viking/Husqvarna Pfaff/Singer 3 VP3 ==
 
== Viking/Husqvarna Pfaff/Singer 3 VP3 ==
  
The VP3 file format appears to be series of nested sections. Most sections contain tagged records.
+
The VP3 file format appears to be series of nested tagged sections. The files seen so far, start with a header of signature bytes and "Produced by..." string; followed by a tagged embroidery-summary packet. Like Russian dolls, the embroidery-summary packet contains a tagged hoop-centred packet after some information about stitched area, stitching time, etc. The hoop-centred packet expresses a centred stitch extent and contains several tagged thread packets. Each thread packet has colour and weight information, also containing one stitch-rum packet.
  
In the style of Backus–Naur Form,  
+
The file format could logically contain several embroideries, and each embroidery contain more then one hoop, but this has not been seen. Perhaps to contain a library of patterns, or to split a large design over several hoops.
  
File = File-header Extent
+
The tags seen, so far, are,
 +
* 0 2 0 - Embroidery-summary packet
 +
* 0 3 0 - Hoop-centred packet
 +
* 0 5 0 - Thread packet
 +
* 0 1 0 - Stitch-run packet
  
Extent = Extent-header {Hoop}
 
  
Hoop = Hoop-header Canvas Threads
+
In the style of Backus–Naur Form,
 
 
Threads = Threads-header {Thread}
 
  
Thread = Thread-header Colours Thread-text Thread-detail Stitches Thread-end
+
File = File-header Embroidery-summary
  
Colours = {Colour-detail}
+
Embroidery-summary = Summary-details {Hoop-centred}
  
Stitches = Stitches-header {Stitch}
+
Hoop-centred = Hoop-details {Thread}
  
Stitch = Escaped-command | Displacement
+
Thread = Thread-details Stitch-run
  
 
===File-header===
 
===File-header===
Line 36: Line 37:
 
| N1
 
| N1
 
| N-WStr
 
| N-WStr
| Producer 16 bit big-endian length in bytes followed by 16 bit characters
+
| Producer-string 16 bit big-endian length in bytes followed by 16 bit characters
 
|-
 
|-
 
| 6+N1
 
| 6+N1
Line 44: Line 45:
 
|}
 
|}
  
===Extent-header===
+
===Embroidery Summary-details===
 
{| class="wikitable"
 
{| class="wikitable"
 
| Offset
 
| Offset
Line 54: Line 55:
 
| 3
 
| 3
 
| Tag
 
| Tag
| Extent-tag 00 02 00 three bytes
+
| embroidery-tag 0 2 0 three bytes
 
|-
 
|-
 
| 3
 
| 3
 
| 4
 
| 4
 
| Length
 
| Length
| Extent-len remaining bytes in file
+
| embroidery-len remaining bytes in this packet
 
|-
 
|-
| 3
+
| 7
 
| N2
 
| N2
 
| N-WStr
 
| N-WStr
| Settings human readable debugging notes
+
| settings-string human readable debugging notes
 
|-
 
|-
 
| 7+N2
 
| 7+N2
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Extent-top top edge of stitching in um
+
| extent-right right edge of stitching in um starting from 0,0
 
|-
 
|-
 
| 11+N2
 
| 11+N2
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Extent-right
+
| extent-top
 
|-
 
|-
 
| 15+N2
 
| 15+N2
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Extent-bottom
+
| extent-left
 
|-
 
|-
 
| 19+N2
 
| 19+N2
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Extent-left
+
| extent-bottom
 
|-
 
|-
 
| 23+N2
 
| 23+N2
 
| 4
 
| 4
 
| Count
 
| Count
| Total-stitch-count
+
| stitch-time-count time estimate in stitches
 
|-
 
|-
 
| 27+N2
 
| 27+N2
 
| 2
 
| 2
 
| Count
 
| Count
| Total-thread-count
+
| thread-change-count
 
|-
 
|-
 
| 29+N2
 
| 29+N2
Line 107: Line 108:
 
|}
 
|}
  
===Hoop-header===
+
===Hoop-details===
 
{| class="wikitable"
 
{| class="wikitable"
 
| Offset
 
| Offset
Line 117: Line 118:
 
| 3
 
| 3
 
| Tag
 
| Tag
| Hoop-tag = 00 03 00
+
| hoop-tag = 0 3 0
 
|-
 
|-
 
| 3
 
| 3
 
| 4
 
| 4
 
| Length
 
| Length
| Hoop-len
+
| hoop-len
 
|-
 
|-
 
| 7
 
| 7
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Centre-X
+
| centre-x of summary extent above
 
|-
 
|-
 
| 11
 
| 11
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Centre-Y
+
| centre-Y
 
|-
 
|-
 
| 15
 
| 15
 
| 3
 
| 3
| Tag
+
| Bytes
| Canvas-tag = 00 00 00 (or unknown)
+
| unknown = 00 00 00 may include empty string
 
|-
 
|-
 
| 18
 
| 18
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Hoop-left
+
| hoop-left
 
|-
 
|-
 
| 22
 
| 22
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Hoop-right
+
| hoop-right
 
|-
 
|-
 
| 26
 
| 26
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Hoop-bottom
+
| hoop-bottom
 
|-
 
|-
 
| 30
 
| 30
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Hoop-top
+
| hoop-top
 
|-
 
|-
 
| 34
 
| 34
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Hoop-width
+
| hoop-width
 
|-
 
|-
 
| 38
 
| 38
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Hoop-height
+
| hoop-height
 
|-
 
|-
 
| 42
 
| 42
 
| N3
 
| N3
 
| N-WStr
 
| N-WStr
| Settings-2 second copy of Settings
+
| settings-2 second copy of settings-string
 
|-
 
|-
 
| 42+N3
 
| 42+N3
Line 203: Line 204:
 
| int
 
| int
 
| unknown = 4096
 
| unknown = 4096
|}
 
 
===Threads-header===
 
{| class="wikitable"
 
| Offset
 
| Length
 
| Type
 
| Description
 
 
|-
 
|-
| 0
+
| 60+N3
| 6
+
| 1
| Bytes
+
| Byte
| Threads-sig = 120 120 80 80 1 0
+
| unknown = 120 or 'x'
 +
|-
 +
| 61+N3
 +
| 1
 +
| Byte
 +
| unknown = 120 or 'x'
 +
|-
 +
| 62+N3
 +
| 1
 +
| Byte
 +
| unknown = 80 or 'P'
 +
|-
 +
| 63+N3
 +
| 1
 +
| Byte
 +
| unknown = 80 or 'P'
 +
|-
 +
| 64+N3
 +
| 1
 +
| Byte
 +
| unknown = 1
 +
|-
 +
| 65+N3
 +
| 1
 +
| Byte
 +
| unknown = 0
 
|-
 
|-
| 6
+
| 66+N3
 
| N4
 
| N4
 
| N-WStr
 
| N-WStr
| Producer-2 copy of producer text
+
| producer-2 second copy of producer-string
 
|-
 
|-
| 6+N4
+
| 66+N3+N4
 
| 2
 
| 2
 
| Count
 
| Count
| Thread-count
+
| thread-count
 
|}
 
|}
  
===Thread===
+
===Thread-details===
 
{| class="wikitable"
 
{| class="wikitable"
 
| Offset
 
| Offset
Line 238: Line 256:
 
| 3
 
| 3
 
| Tag
 
| Tag
| Thread-tag = 00 05 00
+
| thread-tag = 0 5 0
 
|-
 
|-
 
| 3
 
| 3
 
| 4
 
| 4
 
| Length
 
| Length
| Thread-len bytes to next thread
+
| thread-len bytes to next thread
 
|-
 
|-
 
| 7
 
| 7
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Start-X
+
| start-x move needle
 
|-
 
|-
 
| 11
 
| 11
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| Start-Y
+
| start-y
 
|-
 
|-
 
| 15
 
| 15
 
| 1
 
| 1
 
| Count
 
| Count
| Colours-per-thread
+
| colours-per-thread
 
|-
 
|-
 
| 16
 
| 16
 +
| N5
 +
| Table
 +
| colour-table = {colour-detail}
 +
|-
 +
| 16+N5
 
| 1
 
| 1
 
| Byte
 
| Byte
| unknown = 0
+
| unknown = 0 or 10 for multicoloured
|-
 
| 17
 
| N5
 
| Table
 
| Colours
 
 
|-
 
|-
 
| 17+N5
 
| 17+N5
 
| 1
 
| 1
 
| Code
 
| Code
| Thread-type-tension (5 rayon, 1 metallic)
+
| thread-type-tension (5 rayon, 1 metallic)
 
|-
 
|-
 
| 18+N5
 
| 18+N5
 
| 1
 
| 1
 
| Byte
 
| Byte
| Thread-weight
+
| thread-weight (km/kg)
 
|-
 
|-
 
| 19+N5
 
| 19+N5
 
| N6
 
| N6
 
| Record
 
| Record
| Thread-text human readable thread description
+
| thread-description human readable thread description
 
|-
 
|-
 
| 19+N5+N6
 
| 19+N5+N6
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| unknown-X (appears to be total displacement)
+
| total-displacement-x sum of stitches and jump stitches
 
|-
 
|-
 
| 23+N5+N6
 
| 23+N5+N6
 
| 4
 
| 4
 
| MicroM
 
| MicroM
| unknown-Y (appears to be total displacement)
+
| total-displacement-y
 
|-
 
|-
 
| 27+N5+N6
 
| 27+N5+N6
 
| N7
 
| N7
 
| Record
 
| Record
| Stitches
+
| stitche-run
 
|-
 
|-
 
| 27+N5+N6+N7
 
| 27+N5+N6+N7
Line 314: Line 332:
 
|-
 
|-
 
| 0
 
| 0
 +
| 1
 +
| Byte
 +
| unknown = 0 or 20 for multicoloured
 +
|-
 +
| 1
 
| 3
 
| 3
 
| RRGGBB
 
| RRGGBB
| Colour-RGB
+
| colour-RGB
 
|-
 
|-
| 3
+
| 4
 
| 1
 
| 1
 
| Byte
 
| Byte
| unknown = 0 or 10
+
| unknown = 0 or 10 for multicoloured
 
|-
 
|-
| 4
+
| 5
 
| 1
 
| 1
 
| Byte
 
| Byte
 
| unknown = 0
 
| unknown = 0
 +
|}
 +
 +
 +
===Thread Tension Code===
 +
{| class="wikitable"
 +
| Code
 +
| Description
 
|-
 
|-
 
| 5
 
| 5
 +
| Rayon
 +
|-
 
| 1
 
| 1
| Byte
+
| Metallic
| unknown = 0, 20, or 10
 
 
|}
 
|}
  
===Thread-text===
+
===Thread Description===
 
{| class="wikitable"
 
{| class="wikitable"
 
| Offset
 
| Offset
Line 357: Line 388:
 
|}
 
|}
  
===Stitches-header===
+
===Stitch-run===
 
{| class="wikitable"
 
{| class="wikitable"
 
| Offset
 
| Offset
Line 367: Line 398:
 
| 3
 
| 3
 
| Tag
 
| Tag
| Stitches-tag = 00 01 00
+
| stitch-tag = 00 01 00
 
|-
 
|-
 
| 3
 
| 3
 
| 4
 
| 4
 
| Length
 
| Length
| Stitches-len
+
| stitches-len
 
|-
 
|-
 
| 7
 
| 7
 
| 1
 
| 1
 
| Byte
 
| Byte
| Scale-X = 10
+
| scale-x = 10
 
|-
 
|-
 
| 8
 
| 8
 
| 1
 
| 1
 
| Byte
 
| Byte
| Scale-Y = -10
+
| scale-y = -10 the y displacement is negative
 
|-
 
|-
 
| 9
 
| 9
Line 388: Line 419:
 
| Byte
 
| Byte
 
| unknown = 0
 
| unknown = 0
 +
|-
 +
| 10
 +
| N8
 +
| Table
 +
| stitch-table = {Escaped-command | Displacement | disp-x | disp-y}
 
|}
 
|}
 +
  
 
===Escaped-command===
 
===Escaped-command===
Line 407: Line 444:
 
| Command-code
 
| Command-code
 
|}
 
|}
 +
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 416: Line 454:
 
|-
 
|-
 
| 1
 
| 1
| Move followed by 16 bit displacement-X and 16 bit displacement-Y
+
| Move followed by 16 bit displacement-x and 16 bit displacement-y
 
|-
 
|-
 
| 2
 
| 2
| End-move
+
| End-move preceded  by 16 bit displacement-y and 16 bit displacement-x for reverse stitching
 
|-
 
|-
 
| 3
 
| 3
Line 435: Line 473:
 
| 1
 
| 1
 
| Byte
 
| Byte
| Displacement-X -127 to 127 in 0.1 mm
+
| displacement-x -127 to 127 in 0.1 mm
 
|-
 
|-
 
| 1
 
| 1
 
| 1
 
| 1
 
| Byte
 
| Byte
| Displacement-Y -127 to 127 in -0.1 mm
+
| displacement-y -127 to 127 in -0.1 mm
 
|}
 
|}
  

Revision as of 01:43, 24 August 2012

Viking/Husqvarna Pfaff/Singer 3 VP3

The VP3 file format appears to be series of nested tagged sections. The files seen so far, start with a header of signature bytes and "Produced by..." string; followed by a tagged embroidery-summary packet. Like Russian dolls, the embroidery-summary packet contains a tagged hoop-centred packet after some information about stitched area, stitching time, etc. The hoop-centred packet expresses a centred stitch extent and contains several tagged thread packets. Each thread packet has colour and weight information, also containing one stitch-rum packet.

The file format could logically contain several embroideries, and each embroidery contain more then one hoop, but this has not been seen. Perhaps to contain a library of patterns, or to split a large design over several hoops.

The tags seen, so far, are,

  • 0 2 0 - Embroidery-summary packet
  • 0 3 0 - Hoop-centred packet
  • 0 5 0 - Thread packet
  • 0 1 0 - Stitch-run packet


In the style of Backus–Naur Form,

File = File-header Embroidery-summary

Embroidery-summary = Summary-details {Hoop-centred}

Hoop-centred = Hoop-details {Thread}

Thread = Thread-details Stitch-run

File-header

Offset Length Type Description
0 6 ASCIIZ Signature = "%vsm%"
6 N1 N-WStr Producer-string 16 bit big-endian length in bytes followed by 16 bit characters
6+N1

Embroidery Summary-details

Offset Length Type Description
0 3 Tag embroidery-tag 0 2 0 three bytes
3 4 Length embroidery-len remaining bytes in this packet
7 N2 N-WStr settings-string human readable debugging notes
7+N2 4 MicroM extent-right right edge of stitching in um starting from 0,0
11+N2 4 MicroM extent-top
15+N2 4 MicroM extent-left
19+N2 4 MicroM extent-bottom
23+N2 4 Count stitch-time-count time estimate in stitches
27+N2 2 Count thread-change-count
29+N2 1 Byte unknown = 12
30+N2 2 Count unknown = 1 may be hoop-count

Hoop-details

Offset Length Type Description
0 3 Tag hoop-tag = 0 3 0
3 4 Length hoop-len
7 4 MicroM centre-x of summary extent above
11 4 MicroM centre-Y
15 3 Bytes unknown = 00 00 00 may include empty string
18 4 MicroM hoop-left
22 4 MicroM hoop-right
26 4 MicroM hoop-bottom
30 4 MicroM hoop-top
34 4 MicroM hoop-width
38 4 MicroM hoop-height
42 N3 N-WStr settings-2 second copy of settings-string
42+N3 1 Byte unknown = 100
43+N3 1 Byte unknown = 100
44+N3 4 int unknown = 4096
48+N3 4 int unknown = 0
52+N3 4 int unknown = 0
56+N3 4 int unknown = 4096
60+N3 1 Byte unknown = 120 or 'x'
61+N3 1 Byte unknown = 120 or 'x'
62+N3 1 Byte unknown = 80 or 'P'
63+N3 1 Byte unknown = 80 or 'P'
64+N3 1 Byte unknown = 1
65+N3 1 Byte unknown = 0
66+N3 N4 N-WStr producer-2 second copy of producer-string
66+N3+N4 2 Count thread-count

Thread-details

Offset Length Type Description
0 3 Tag thread-tag = 0 5 0
3 4 Length thread-len bytes to next thread
7 4 MicroM start-x move needle
11 4 MicroM start-y
15 1 Count colours-per-thread
16 N5 Table colour-table = {colour-detail}
16+N5 1 Byte unknown = 0 or 10 for multicoloured
17+N5 1 Code thread-type-tension (5 rayon, 1 metallic)
18+N5 1 Byte thread-weight (km/kg)
19+N5 N6 Record thread-description human readable thread description
19+N5+N6 4 MicroM total-displacement-x sum of stitches and jump stitches
23+N5+N6 4 MicroM total-displacement-y
27+N5+N6 N7 Record stitche-run
27+N5+N6+N7 1 Byte unknown = 0

Colour-detail

Offset Length Type Description
0 1 Byte unknown = 0 or 20 for multicoloured
1 3 RRGGBB colour-RGB
4 1 Byte unknown = 0 or 10 for multicoloured
5 1 Byte unknown = 0


Thread Tension Code

Code Description
5 Rayon
1 Metallic

Thread Description

Offset Length Type Description
0 N6a N-Str Thread-code 16 bit length followed by ASCII characters part-number
0+N6a N6b N-Str Thread-name human readable name of thread
0+N6a+N6b N6c N-Str Thread-manu maker, material and weight

Stitch-run

Offset Length Type Description
0 3 Tag stitch-tag = 00 01 00
3 4 Length stitches-len
7 1 Byte scale-x = 10
8 1 Byte scale-y = -10 the y displacement is negative
9 1 Byte unknown = 0
10 N8 Table Displacement | disp-x | disp-y}


Escaped-command

Offset Length Type Description
0 1 Byte Escape = -128 or 0x80
1 1 Byte Command-code


Command-code Description
0 Deleted or null stitch
1 Move followed by 16 bit displacement-x and 16 bit displacement-y
2 End-move preceded by 16 bit displacement-y and 16 bit displacement-x for reverse stitching
3 Deleted or null stitch

Displacement

Offset Length Type Description
0 1 Byte displacement-x -127 to 127 in 0.1 mm
1 1 Byte displacement-y -127 to 127 in -0.1 mm


Other References

The VP3 File Format external page contains an overview of this format.


Content is available under Creative Commons License SA 4.0 unless otherwise noted.