PES-Embroidery/LOG.md

11 KiB

12/5

Intersections seem to fail if the shape is too large and also made of curves? I'm not sure why, but I'm pretty sure it's a bug within the svgPathTools library.

Yeah, I have no idea why it does this. That's okay.

12/4

I think the sewing machine might actually follow PES commands and not PEC commands. That's kinda weird, because the PEC commands are supposed to be for the machine and the PES commands for like, desktop embroidery applications. This machine DOES have its own touch screen though, so maybe times have changed.

Ah, well now the design is just showing up as a single little line for some reason. The machine will go back and forth on it until it breaks -_-

I think it's getting caught by the bounds! That's why it goes back and forth against one wall. That's also whhy my embroidered square came out smaller than it should've.

Yep that was it. I don't know whether I should be upset or impressed that they designed their firmware to that level.

I think I also need the short format for most of them otherwise I think it tries to backstitch each time which is too much.

12/3

If I write my PES header with TrueSizer's PEC section, the embroidery machine recognizes it. That means I'm not writing the PEC section correctly. Time for some more reverse engineering.

FINALLY got something to show up. Yesssss. It turns out there's a main icon and then one for each color. I forgot that detail.

12/2

Whoops, I was looking at a design that I found and embroidered, and the stitches don't just go from endpoint to endpoint. There are multiple intermediate stitches. I need to fix that in my program too. Wow, there's really too much to do.

12/1

Wilcom adds 12116 - 11369 = 747 extra bytes to my file. I think the machine needs the PES section. I tried loading a PEC file and the machine didn't even bother recognizing it. I'll add minimum PES section stuff and see if it helps.

I think it needs a thumbnail. I figured out how their image system works from the documentation I found (it didn't explain it very well, but they literally use one bit per pixel.)

Okay, nope, my machine straight up just doesn't want to recognize it. It's probably related to me missing the PES section?

000000000000000000000000000000000000000000000000 000001110111111101111111011111110111111101111000 000010000000000000000000000000000000000000000100 000100000000000000000011011000000000000000000010 001000000000000000000100000110000000000000000001 001000000000000000001000001110000000000000000001 001000000000000000001000000001000000000000000001 001000000000000000001010011001000000000000000001 001000000000000000001111011101000000000000000001 001000000000000000001111011101000000000000000001 001000000000000000001111011101000000000000000001 001000000000000000001100001101000000000000000001 001000000000000000001110011100100000000000000001 001000000000000000001111011101100000000000000001 001000000000000000001110010110010000000000000001 001000000000000000011011000011010000000000000001 001000000000000000011000000011000000000000000001 001000000000000000111000000011010100000000000001 001000000000000001111000000001110100000000000001 001000000000000001110000000000100010000000000001 001000000000000000110000000000100010000000000001 001000000000000000100000000000110001000000000001 001000000000000101100000000000110001000000000001 001000000000000101100000000000110001000000000001 001000000000000101000000000000110001000000000001 001000000000000101100000000001100001000000000001 001000000000001101110000000001110111000000000001 001000000000111000111000000001110101000000000001 001000000001110000110100000001100001100000000001 001000000001100000011100000011100000110000000001 001000000001100000001100001111100000011000000001 001000000001100000001111011101100001110000000001 001000000001111100001110000101100111000000000001 001000000000001101111111011011110100000000000001 000100000000000001111000000000110000000000000010 000010000000000000000000000000000000000000000100 000001110111111101111111011111110111111101111000 000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000 000001110111111101111111011111110111111101111000 000010000000000000000000000000000000000000000100 000100000000000000000000000000000000000000000010 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000011010000000000000000000001 001000000000000000000111011100000000000000000001 001000000000000000000011011100000000000000000001 001000000000000000000011010000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000000000000000000000000000000000001 001000000000000100000000000000000000000000000001 001000000000000101000000000000100011000000000001 001000000000001101100000000000110111000000000001 001000000000111101100000000000110111000000000001 001000000000111101110000000000110111110000000001 001000000000111101111000000000110111110000000001 001000000000111101111000000000110111100000000001 001000000000011101111000000000110110000000000001 001000000000000001111000000000110000000000000001 000100000000000000000000000000000000000000000010 000010000000000000000000000000000000000000000100 000001110111111101111111011111110111111101111000 000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000 000001110111111101111111011111110111111101111000 000010000000000000000000000000000000000000000100 000100000000000000000011011000000000000000000010 001000000000000000000111011110000000000000000001 001000000000000000001111011110000000000000000001 001000000000000000001111011111000000000000000001 001000000000000000001111011111000000000000000001 001000000000000000001101000111000000000000000001 001000000000000000001111011111000000000000000001 001000000000000000001110011111000000000000000001 001000000000000000001100000111000000000000000001 001000000000000000001100011111100000000000000001 001000000000000000001111011111100000000000000001 001000000000000000001011000011110000000000000001 001000000000000000011001000001110000000000000001 001000000000000000010000000001110000000000000001 001000000000000000110000000001110100000000000001 001000000000000001110000000000110100000000000001 001000000000000001100000000000110110000000000001 001000000000000001100000000000110110000000000001 001000000000000001100000000000010111000000000001 001000000000000101000000000000010111000000000001 001000000000000101000000000000010111000000000001 001000000000000101000000000000010111000000000001 001000000000000001000000000000110111000000000001 001000000000001000100000000001010110000000000001 001000000000111000011000000001000001000000000001 001000000001000000011100000001000000100000000001 001000000001100000001100000001000000010000000001 001000000001100000001000000011000000001000000001 001000000001000000000111011111000000110000000001 001000000001110000000111011111000011000000000001 001000000000001101001111011011100100000000000001 000100000000000001111000000000110000000000000010 000010000000000000000000000000000000000000000100 000001110111111101111111011111110111111101111000 000000000000000000000000000000000000000000000000

11/30

Tried the barrier approach but it didn't solve everything. I think I need to do

11/23

Very good progress. I figured out that paths don't work properly unless you draw them a certain way. I'm not exactly sure what that way is yet. I think you just have to draw shapes counter clockwise.

11/18

Y axis was flipped apparently.

It seems to be mostly working, but it's getting off track somehow. I think I'm missing a key command in these stitches somewhere. Some of the stitches probably have special meaning that I'm using as coordinates and that's distorting things.

I WAS STILL DOING THE TWO'S COMPLEMENT MATH INCORRECTLY AHHHHH

11/17

These documentation pages I found have contradictory information XD. I'm just going to do my best and hope it works and doesn't end up breaking my machine somehow.

I think I need a stitch visualizer like how Simplify3D lets you scrub through GCode. Working with this proprietary format is tough because documentation is just how much people have reverse engineered. If I make a visualizer, I can understand for myself how each stitch works. I think I can use pyglet to accomplish this easily. Either that or I'm going to delve into source code of software that interprets stitches (like the Python package that can generate PNGs from PES files.)

Well, I was doing the code for two's complement incorrectly. I fixed some things and now I at least can see the shape of Tux's foot in the renderer. Progress!

11/16

I haven't had the chance to work on this in a while. That's ok, this weekend is partially dedicated to coding this project (among other things.)

I added a debug flag to generate an image based on the exported PES. This will be my first and most basic testing. I'm starting to really understand the format.

Man, the PEC stitch coordinate system is weird.

Okay, it's less weird after finding this resource which explains it much better. Apparently stitches have a short and long form. I'm going to always use the long form to make things simpler. That way, I won't have to worry about making multiple jumps or not.

I'd like to try to optimize the groups of stitches to minimize jumps and make the jumps optimal if possible.

In version 1 of the .PES format, the PES and PEC sections contain the same data.

I think I'm going to try totally skipping the PES section because it won't be needed for embroidering, which is the purpose of this software.

11/6

Trying to make sense of the "d" string in the path object. I need to be able to parse this myself I think to find intersections.

Found svgpathtools Python library. This can load SVG files and even do intersections. I'm going to try it. I don't regret the research I did on Bezier curves though. Its always cool to know more. Prerequisites are numpy and svgwrite.

I think I'll need to sort the stitches so the regular ones go together and the jump stitches are minimized. This sounds like a ROUTING PROBLEM!

Stitches can be made from the start to end or from the end to the start. The stitch doesn't care and it will look the same in the end. I should use this to my advantage when filling shapes with stitches and also jumping from one stitch group to another. I might want a renderer that shows all this in detail, like how Simplify3D has a GCode visualizer that shows all lines but also retractions and movements.

11/5

It turns out Bezier paths are just interpolations between mutliple points. They're much simpler than I thought.