inkstitch / pyembroidery

libembroidery/EmbroideryFormats converted to python
MIT License
72 stars 28 forks source link

Implement Sequins. #33

Closed tatarize closed 5 years ago

tatarize commented 6 years ago

I gotta remember this is actually a thing that needs to happen.

lexelby commented 6 years ago

This can definitely be on the back burner. I don't have a machine that can do sequins, and until I have access to one, it's going to be pretty hard to try to design features like sequin fill and whatnot.

tatarize commented 6 years ago

I'm not even sure I understand the schema. I've not actually done such a file before. I could certainly trigger the sequin mode on and off depending on if I want a sequin or a jump. So if I'm doing a genuine jump I toggle it off then if I'm doing a sequin I toggle the mode back on. At least for DSTs but @wwderw mentioned that there's actually kind of two or three different sequin commands namely invoke the sequin bit that brings in the sequin hopper thing and commands that eject sequins. Is there a time delay on that. Is invoke-sequin mode, drop a sequin, disable-sequin mode even a thing? Given the way it works in DST files, shouldn't I break the sequin command into two fundamental blocks anyway. I mean the sequin command turns on sequins it doesn't drop one. Isn't that SEQUIN_MODE and EJECT. I managed to parse the file, but I'm actually not convinced I know what's going on in the file even though I can totally read all the commands.

wwderw commented 6 years ago

On my Barudan (and I can only speak on my Barudan as that is the only one that I have now and ever had that does sequins) at least, we can treat a color change as a way to get it to engage the sequin dispenser. This is using the DST format, Barudans can use their own U?? format to handle sequins, but I don't think that format has much stable support within libembroidery, but I could be wrong.

For instances, when I'm assigning colors C01 - C15 means needle numbers 1- 15. C00 means stop. For sequins to engage the dispenser, I would assign S1, to do a trim, I would do S0. When you have S1 engaged, all jump commands mean "drop sequins", that's why you have to use S0 to command it to trim and disengage dispenser.

So in essence, use a color change to engage (S1 at the machine end for a Barudan atleast) and disengage (S0 at the machine end, again Barudan for sure) and jumps mean drop sequins when S1 is active.

@lexelby, I had sent you a sample file that also had the most basic stitching pattern to reliable hold sequins using a run stitch method. It would be best if that could be automated in some way. Maybe using strokes like we do for regular run stitches, but when using the sequin symbol, it changes it to that stitch out pattern.

I hope that makes sense.

lexelby commented 6 years ago

When you have S1 engaged, all jump commands mean "drop sequins",

@tatarize that's the key: once the sequin dispenser is engaged, JUMP drops a sequin. That's what I saw in the sample files wwderw made for me.

Maybe using strokes like we do for regular run stitches, but when using the sequin symbol, it changes it to that stitch out pattern.

I could give it a try. I'm just thinking that without direct access to a machine, this will involve a ton of tedious back-and-forth.

tatarize commented 6 years ago

I tried to make one from Wilcom but it ate all my pretty DST sequins rather than gave them to me properly. The format encoding doesn't seem too hard. 0x80 bytes of "0" with some implication, 0x80 bytes of what is, I assume, something in a sea of \0. Then at 0x100 we have a triplet code of command, x, y. Where the first nybble of the command is set, -x, -y, no clue. Then the for the second nybble 0 means stitch. 1 means jump 9 (start? ), 8 (end?), B (colorchange), C (another color change?), 7 (trim). Though it might be something like 0b1000 means color change to zero. And and 0b1001 means color change to 1. etc (though that would only be encoding with 3 bits so 8 values which is not the 16 you say you have to specifically encode.

Odds are good libembroidery will read them, though there's no writer.

tatarize commented 6 years ago

I could add CSV support to writing akin to embroidermodder 2's version. Seems like it would be pretty solid for bug checks. and I'm sure the command that engages the sequin dispenser and then the jumps that occur after that need to be treated as different core commands. I could also add some commands for the sequin tie down but this seems beyond the mandate. Some stuff like "bean-stitch mode engage..." seem like they'd be really easy to add but I'm entirely trying to keep it focused on exactly what it needs to do and nothing more.

tatarize commented 6 years ago

Easy peesy. I am loving that list out the readers and writers api thing. Literally just added a new entry and all the code adapted. I'm thinking writing the Sequin just requires dividing up Sequin into Sequin_mode or something and Sequin_eject. Then to write, make sure Sequin_mode is on if you eject, and make sure it's off if you want to jump. If it's in the wrong mode, toggle the mode. Seems like that might cover my bases, assuming I'm not getting anything entirely wrong.

tatarize commented 6 years ago

Thankfully our guesses and hopes and in ww's case giant knowledge base. Paid off. Sequins work. Admittedly stabilizing them strips them out but so do most things. It adds a STRIP_SEQUIN note on the various writers, to trigger the encoder to remove them. And the encoder makes sure to toggle sequin mode between jumps and ejects if you didn't do that manually. So you can just use SEQUIN_EJECT and JUMP all willy-nilly without tracking the state of the sequin mode.