-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Knit / Purl Rib causes unnecessary transfers every row #5
Comments
I confirm the behavior. But this is unfortunately a machine-specific (and program specific) case of scheduling that is not taken care of by the current implementation. The Knit Sketching project was initially targeted at whole garment knitting and thus mostly tubular structures (in most of my cases, ribs were through half-gauge knitting). In tubular mode, purls are safer to knit if they go back to their original side, because when you knit one part of a tubular structure, having the other side sit across its original bed can lead to the yarn catching the other side (especially if using multiple ends that can separate from static charges). Thus my base implementation of purl done as a three-part program per stitch. To make it work, you'd need to have logic that knows whether the sample is tubular or flat to choose between a variant of purl (in Shima, there are different behaviors for link processing, one of which leading to what you describe -- keeping the stitch on its side -- and another moving it between each change of side). Instead, a simpler fix is to program the pattern with the On a flat rectangle, a minimal 2x2 ribs example would be:
Unfortunately, as you realized, the basic purl implementation gives you a back and forth transfer sequence:
The simplest solution for your specific case is to register three types of actions through the
Then you apply the first action in the initial row, the second in the intermediary rows and the last one in the last row: const startPurl = Action.register({
pre: ({ k, n, rn }) => k.xfer(n, rn),
main: ({ k, d, rn, cs }) => k.knit(d, rn, cs),
});
const purl = Action.register({
main: ({ k, d, rn, cs }) => k.knit(d, rn, cs),
});
const endPurl = Action.register({
main: ({ k, d, rn, cs }) => k.knit(d, rn, cs),
post: ({ k, n, rn }) => k.xfer(rn, n),
});
const ribsPat = prog.strToGrid(`
kkpp
`);
const ribsMap = (purl) => ({
k: Action.Knit,
p: purl,
})
const height = 1000; // sufficient high to cover the whole height
// main ribs
prog.filter(s => s.countPrevWales() === 0).waleGrid(0:end, height).tileMap(ribsPat, ribsMap(purl))
// pre-ribs
prog.filter(s => s.countPrevWales() === 0).waleGrid(0:end, 1).tileMap(ribsPat, ribsMap(startPurl))
// post-ribs
prog.filter(s => s.countNextWales() === 0).waleGrid(0:end, -2).tileMap(ribsPat, ribsMap(endPurl))
// note: the last row at -1 does not trigger proper actions as it is normalized for the bindoff
// => back-to-front transfers must happen on the row before But there are two additional program colors (one at the first row and one at the top visible row). And the output Knitout only does transfers as you'd expect. So it's doable, but it's obviously not as user-friendly. |
Hi
Not sure if you are still monitoring your repo but if you are would be great to get a fix...
Knit is setup for Stitch Layer - Knit / Purl.
Write out to knitout causes every row to transfer the back stitches back to the front, and then back to the back. This causes unnecessary transfers and on a kniterate causes dropped stitches due to the constant transfer...
Knitout Visualisation
Knitout
Knitout.k.txt
KnitSketching File
KnitSketching.json.txt
The text was updated successfully, but these errors were encountered: