Projects/Liberty/File Formats/Viking Pfaff: Difference between revisions

From KDE Community Wiki
(→‎Displacement: clarify)
(→‎Other References: added another reference)
Line 496: Line 496:


The [http://www.jasonweiler.com/VP3FileFormatInfo.html VP3 File Format] external page contains an overview of this format.
The [http://www.jasonweiler.com/VP3FileFormatInfo.html VP3 File Format] external page contains an overview of this format.
The page [http://www.knitandsew.demon.nl/p2c/current.htm PES2Card utility] implies that VP3 files can contain both multiple designs and multiple hoops.

Revision as of 01:21, 3 September 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-run packet.

The file format could logically contain several embroideries, and each embroidery contain more than one hoop, but this has not been seen. If these facilities were used, 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 stitch-table


stitch-table = { Escaped-command | 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


Move command's disp-x and disp-y are 16 bit displacements used in the move/jump stitch, they are unlikely to be in the range -32768 to -32513 in 0.1 mm or 0x8000 to 0x80FF, so unlikely confused with the escape-command.


Other References

The VP3 File Format external page contains an overview of this format. The page PES2Card utility implies that VP3 files can contain both multiple designs and multiple hoops.