Embroidermodder / libembroidery

Library for reading/writing/manipulating machine and design embroidery files
https://www.libembroidery.org
zlib License
45 stars 13 forks source link

Clarification of CSV format, JUMP vs COLOR vs TRIM? #131

Closed hariedo closed 2 years ago

hariedo commented 10 years ago

I was able to successfully convert a CSV file to a DST file, and make use of it on a Brother SE-400 machine. Hooray! However, I ran into a couple issues; this is one of them.

I constructed the CSV file based on examples found in the sample and test areas.

I thought that a JUMP would just be a longer version of STITCH, where perhaps the machine would prepare for a JUMP by making a couple of additional loops of the bobbin to anchor each end. However, the Brother seems to interpret the encoded JUMP as starting a new layer (new graphical layout preview box on the machine's screen) without cutting the thread; the user has to press the button to resume the pattern.

So, on the Brother anyway, JUMP is encoded to make a stitch to the given coordinates, start a new preview layer, and wait for the user to resume the pattern; the thread is not cut.

COLOR is encoded to start a new preview layer, and cut the thread, and wait for the user to resume after they have threaded the needle again. In the CSV, the coordinates are completely ignored.

I have not used a TRIM, so I'm not sure what its intended use is, compared to a COLOR change command.

Obviously, different machine models and different formats may handle these commands in varying ways. I'm not saying they behave wrong, so much as I was just capturing my understanding as an opportunity to clarify those differences in general documentation.

redteam316 commented 10 years ago

A JUMP entry will move to the coordinates specified but will not make a stitch. Think of it as being roughly equivalent to a moveTo instruction. To make longer stitches, you would specify a JUMP to the desired coordinate and then follow it with a STITCH instruction using the same coordinate.

There is a embPattern_copyPolylinesToStitchList function in emb-pattern.c in libembroidery which converts polylines to stitches and I think it still needs some work. I fixed several flaws in the logic not long ago but it isn't perfect because it does trim after every object.

Open a file that you have saved as CSV with Embroidermodder 2 and look at the comments describing the machine instructions. They are saved into every file. The spiral samples do not contain this info but any CSV saved with our app or converter will have this. You can also see these comments if you look at our source code here: https://github.com/Embroidermodder/Embroidermodder/blob/master/libembroidery/format-csv.c

Hopefully that helps.

hariedo commented 10 years ago

Yes, I'd read the comments in the CSV files and in the CSV-writing routine. They're pretty minimal which is why I wrote up my comments. I still don't know what TRIM really does or what it's for.

I guess my wording was confusing, in that I have been thinking of the thread I can see over the fabric as "a stitch," when you are referring to the anchoring under the fabric (with bobbin thread) as the actual stitch. So in my terms, I was saying "a long bit of thread joins the old location to the new location" and you were saying "the needle plunges to anchor the thread at the new location." Sorry if I'm a newb at the terminology.

redteam316 commented 10 years ago

Yes, the anchoring of the thread to the fabric using the bobbin is what STITCH refers to. It's the actual plunging of the needle. I initially thought of it the same way as you did when I got involved with this project but it is slightly different because to make a line requires two instructions due to the way the machine must operate :)

TRIM does exactly what you would expect it to do. It trims the thread. The DST format does not have a TRIM instruction so the way that most machines handle this is that it will trim the thread after a specified amount of jumps occur when using the DST format. You have to set this number in the machine itself and refer to the user manual on how to do this. This is something we are going to point out in our documentation because it is confusing to many people. We have a setting for this in Embroidermodder 2 but it isn't fully utilized yet. Aside from this odd quirk, the DST format works very well.

For testing purposes using CSV, I would suggest using libembroidery-convert to convert the files, because then you will bypass any limitations that Embroidermodder 2 may currently have or what it may be hiding from you intentionally. Doing it that way will really help you understand the instructions better.