Jump to content

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

From KDE Community Wiki
 
Hoop-details: Added though on hoop rotation
 
(21 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}
File = File-header {Embroidery-summary}


Thread = Thread-header Colours Thread-text Thread-detail Stitches Thread-end
Embroidery-summary = Summary-details {Hoop-centred}


Colours = {Colour}
Hoop-centred = Hoop-details {Thread}


Stitches = Stitches-header {Stitch}
Thread = Thread-details Stitch-run


===File-header===
===File-header===
Line 29: 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 40: Line 43:
|
|
|
|
|}


===Embroidery Summary-details===
{| class="wikitable"
| 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
|}
|}


This file format appears to describe a stitch out similar to that used in [[Projects/Liberty/File_Formats/Janome_Embroidery_Format|JEF]] files.
===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"
| 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===
{| class="wikitable"
| 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===
{| class="wikitable"
| 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<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
| Rayon
|-
| 1
| Metallic
|}
 
===Thread Description===
{| class="wikitable"
| 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===
{| class="wikitable"
| 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===
{| class="wikitable"
| Offset
| Length
| Type
| Description
|-
| 0
| 1
| Byte
| Escape = -128 or 0x80
|-
| 1
| 1
| Byte
| 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
|}
 
===Displacement===
{| class="wikitable"
| 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.




{{Prevnext2
{{Prevnext2
| prevpage= Projects/Liberty/File_Formats/Janome_Embroidery_Format|| nextpage= 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.