Overview[edit | edit source]

I made this page to document the .exp file format. With this, I hope it will be easier for others to work with .exp files and write their own as needed.

Basic info / framework for .exp[edit | edit source]

.exp files are embroidery files designed for use with Melco or Bravo systems.

These files are written in binary code. The code is written in sets of 8 bits. A bit is the binary number 0 or 1. These sets of 8 bits are called bytes. These bytes contain the information for each stitch operation. There are 256 possible combinations of bits to make a byte. These bytes represent numbers ranging from 0 to 255. Each of these numbers signifies a command to the embroidery machine.

Bytes are written to the file in pairs of 2. These pairs are usually the commands for a movement in the x (left/right) and y (up/down) directions. The first byte is the movement command for x and the second byte is for y.

The minimum resolution of a stitch movement in the .exp file format is 0.1mm. As the movements are all based upon this resolution, it is most convenient to consider 0.1mm as the base unit of measurement when working with data to be written to embroidery.

The maximum movement in one stitch command is 12.7mm. Any desired movement larger than this length between stitches must be created with one or more "jump" movements, explained below.

Movement / Stitch Commands[edit | edit source]

Stitch command table for quick access

A movement of 0 in x or y is represented by the byte value 0.

A positive movement in x or y in mm*10^-1 is represented by the same byte value. For example, a movement of +0.3mm is represented by the byte value 3, a movement of +7.1mm is represented by the byte value of 71, etc.

A negative movement in x or y in mm*10^-1 is represented by the movement's absolute value subtracted from 256. For example, a movement of -0.3mm is represented by the byte value 253, a movement of -7.1mm is represented by the byte value of 185, etc.

Special operations are also given as a set of 2 bytes. These special operations include "change color / stop", "jump", and "end / cut thread". These special operations always start with 128 as the first byte, and the second byte signifies which of the special operations to take.

  • "Change color / stop" tells the machine to pause so that the operator can change colors of the embroidery thread or adjust machine settings as desired midway through a print.
    • Byte representation - (128,1)* *followed by movement command (0,0) if no jump is desired with the command. Followed with another command of (0,0) to signify to create a stitch at this point to start the next commands from.
  • "Jump" signifies that the following set of x and y movement commands should not receive a stitch. This lets the machine put larger spacing between stitches or allows separate objects to be made without stitching the fabric between.
    • Byte representation - (128,4)* *followed by the (x,y) coordinate command for the intended jump. String together the jump and jump coordinate commands in succession to travel a further distance. Upon completion of the jump or series of jumps, use coordinate stitch command (0,0) for creating the origin for the next stitch operation.
  • "End / cut thread" signifies that the thread should be cut. It can be used when finishing a part of an embroidery process and/or at the end of the file. used It is recommended to always end a file with this command. It gives a clean cut at the end of the embroidery process to avoid having any loose threads.
    • Byte representation - (128,128)* *needs to be followed with a (0,0) command.

Refer to the Stitch command table for a more visual explanation of the stitch commands.

Writing process explanation[edit | edit source]

Example of the process of writing stitches to .exp file

The .exp file always starts at the coordinate center (0,0) and then lists the series of commands to trace the stitch pattern. Unless a special operation is read, the machine will follow the instructions for the (x,y) movement and create a normal stitch. When the machine comes to a special operation command, it will complete the following movement command after the special operation byte set then comply with the special operation.

A visual example to relate physical commands to byte representation is given in the image above.

Converted to binary this series of stitches would be written as a continuous string like: chr(7),chr(0),chr(0),chr(244),chr(253),chr(0),chr(0),chr(251),chr(128),chr(128),chr(0),chr(0)

^as a reminder, the "chr(0),chr(0)" is listed after the "cut/end" command, because the special command needs to be followed by a double zero

Encoding[edit | edit source]

One important note with writing .exp files is that the encoding language used for writing the data to the file can cause many glitches. If the languages "ASCII" or "UTF-8" are used, the file will be completely botched. Using Python 3.8 to write .exp files, the best results came from the encoding language "latin-1". Even with this language there are some glitches, most notably with the number 10. Using the command 10 causes a movement and stitch of (+1.3,+1.0)mm for (x,y) in one byte command if given in the place of x. It then resets it's reading of bytes as pairs of two. So the following y command is then read as an x and that bias continues for the rest of the file. If 10 is received as a y command, two stitches are created from the command. The first is a (0,+1.3)mm movement and stitch, the second is a (+1.0,0)mm movement and stitch. The stitches that follow these stitches will also be completely different than the commands given, even if the commands normally work completely fine. Usually with a large jump in an unwanted direction. So in conclusion, always use the encoding language "latin-1" when writing files with Python and do not write the command 10.

Writing EXP files to fabricate electrical resistors on fabric[edit | edit source]

Embroidered Electrical Resistor Generation

^Here is an application of EXP writing. Use it as an example if you want to see how to write EXP files in Python. This is the project I was working on which required that I learn how to create EXP files. See the page for more information.

Resources[edit | edit source]

I used the page edutech wiki Embroidery Format EXP to get an initial understanding of the EXP file format. At least at the time of this posting, that page is fairly incomplete but it did give me a helpful start in creating a more thorough set of documentation. So thank you to the original author.

FA info icon.svg Angle down icon.svg Page data
Keywords embroidery, electronics, binary code
Authors Somerset R. Schrock
License CC-BY-SA-4.0
Organizations MOST
Language English (en)
Translations Spanish, French
Related 2 subpages, 5 pages link here
Impact 508 page views
Created July 1, 2021 by Somerset R. Schrock
Modified January 29, 2024 by StandardWikitext bot
Cookies help us deliver our services. By using our services, you agree to our use of cookies.