EmbroidePy / vpype-embroidery

Vpype plugin for embroidery
MIT License
21 stars 5 forks source link

Can we add the ability to let the user pass in a stitch angle? #8

Closed coryortega closed 9 months ago

coryortega commented 9 months ago

It'd be awesome if we could graph lines that aren't just horizontal. I've tried implementing this myself and while I had some success, I'm no expert in graph theory and my approach was pretty hacky. Would love to see how this would be correctly implemented, or how one would go about implementing it? I'd even be happy to open a PR myself, given some guidance

tatarize commented 9 months ago

The lack of this feature is somewhat in error, but I think maybe I didn't include because you could cover the situation with vpype. The way to do this is to rotate the design before it gets to you, then rotate it back when you're done. Both of these are absolutely permitted in vpype. Just rotate by 20 degrees. Do the efill then rotate by -20 degrees.

tatarize commented 9 months ago

Really this is very largely the best methodology for doing a fill like this, the alternative is to actually do the longer lines, then a polycut and fill in the edges every-other per the regular algorithm. But, here using the vector-mononizer code with a scanline to figure out where the particular rung should be placed, is such a great shortcut that it would be very notably harder to use a different methodology.

abey79 commented 9 months ago

This sequence of command does what @tatarize suggests:

vpype read input.svg rotate -o 0 0 -- -20deg efill rotate -o 0 0 20deg show

Note the -- trick that's needed when an argument looks like an option, in this case "-20deg" starting with a "-".

coryortega commented 9 months ago

Oh wow, worked like magic. Really appreciate the help!