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

From KDE Community Wiki
No edit summary
(→‎Hoop-details: Added though on hoop rotation)
 
(18 intermediate revisions by 2 users not shown)
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-run packet.


In the style of Backus–Naur Form,  
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.


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 31: Line 32:
| 6
| 6
| ASCIIZ
| ASCIIZ
| Signature = "%vsn%"
| Signature = "%vsm%"
|-
|-
| 6
| 6
| 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===
 
The position of this hoop (of multiple hoop pattern) in relation to the whole design appears to be given in centre-x and centre-y, but what about the angle of this hoop to the whole design, it would probably only need a code for 0°, 90°, 180° and 270°.
 
{| class="wikitable"
{| class="wikitable"
| Offset
| Offset
Line 117: Line 121:
| 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
| 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 207:
| 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 259:
| 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
| 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
| total-displacement-x sum of stitches and jump stitches
|-
|-
| 23+N5+N6
| 23+N5+N6
| 4
| 4
| MicroM
| MicroM
| unknown-Y
| total-displacement-y
|-
|-
| 27+N5+N6
| 27+N5+N6
| N7
| N7
| Record
| Record
| Stitches
| stitch-run
|-
|-
| 27+N5+N6+N7
| 27+N5+N6+N7
Line 314: Line 335:
|-
|-
| 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
|}
The boundary of the colour table is uncertain, each colour entry has six bytes, but there is a spare byte either before or after the table. A sample thread of two different colour strands twisted together, starting from the count, has:
2<br/>
00 R1 G1 B1 10 00<br/>
20 R2 G2 B2 10 00<br/>
10
or
2<br/>
00<br/>
R1 G1 B1 10 00 20<br/>
R2 G2 B2 10 00 10
A single colour counterpart has:
1<br/>
00 R1 G1 B1 00 00<br/>
00
or
1<br/>
00<br/>
R1 G1 B1 00 00 00
This file-format seems to have the list/table immediate after the count, so until more is known about the unknown values, I will assume the list/table is followed by an unknown byte.
===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 419:
|}
|}


===Stitches-header===
===Stitch-run===
{| class="wikitable"
{| class="wikitable"
| Offset
| Offset
Line 367: Line 429:
| 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 450:
| Byte
| Byte
| unknown = 0
| unknown = 0
|-
| 10
| N8
| Table
| stitch-table
|}
|}
stitch-table = { Escaped-command | Displacement | disp-x | disp-y }


===Escaped-command===
===Escaped-command===
Line 406: Line 476:
| Byte
| Byte
| Command-code
| Command-code
|}
{| class="wikitable"
| 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
|}
|}


Line 418: Line 506:
| 1
| 1
| Byte
| Byte
| Displacement-X -127 to 127  
| displacement-x -127 to 127 in 0.1 mm
|-
|-
| 1
| 1
| 1
| 1
| Byte
| Byte
| Displacement-Y -127 to 127
| 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.




{{Prevnext2
{{Prevnext2
| prevpage= Projects/Liberty/File_Formats/Janome_Embroidery_Format|| nextpage=Projects/Liberty/File_Formats/Next Format
| prevpage= Projects/Liberty/File_Formats/Husqvarna_HUS|| nextpage=Projects/Liberty/File_Formats/Tajima_Ternary
| prevtext=JEF Format | nexttext=Next format
| prevtext=Husqvarna HUS | nexttext=Tajima Ternary DST
| index= Projects/Liberty/File_Formats | indextext=Index of Formats
| index= Projects/Liberty/File_Formats | indextext=Index of Formats
}}
}}
=== Other References ===
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.

Latest revision as of 17:57, 27 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

The position of this hoop (of multiple hoop pattern) in relation to the whole design appears to be given in centre-x and centre-y, but what about the angle of this hoop to the whole design, it would probably only need a code for 0°, 90°, 180° and 270°.

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 stitch-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


The boundary of the colour table is uncertain, each colour entry has six bytes, but there is a spare byte either before or after the table. A sample thread of two different colour strands twisted together, starting from the count, has:

2
00 R1 G1 B1 10 00
20 R2 G2 B2 10 00
10

or

2
00
R1 G1 B1 10 00 20
R2 G2 B2 10 00 10

A single colour counterpart has:

1
00 R1 G1 B1 00 00
00

or

1
00
R1 G1 B1 00 00 00

This file-format seems to have the list/table immediate after the count, so until more is known about the unknown values, I will assume the list/table is followed by an unknown byte.

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.