Knitout Extensions

The knitout language can be extended to support machine-specific features through the use of extension operations and headers. Extension operations are operations that start with x-; extension headers are headers that start with X-; the format and meaning of extension operation arguments and extension header data are left to extension developers.

Extensions are not necessarily supported or recognized by all knitout backends; though a specification-compliant backend will produce a warning for any extension it does not know it can safely ignore.

Many extensions are documented in the Knitout Specification. A partial list:

General Extensions

These extensions support machine-specific features that may exist on more than one machine.

  • Stitch Number

    x-stitch-number N

    On machines with a table of stitch sizes, this command sets the table index for subsequent knit and tuck operations to N. Valid N ranges and its meaning depends on the machine (Shima SWGN2: 1-120; Kniterate: 0-9A-F).

  • Xfer Stitch Number

    x-xfer-stitch-number N

    Like x-stitch-number but for subsequent transfer operations.

  • Speed Number

    x-speed-number N

    On machines with a table of speeds, sets the speed number for subsequent operations to N; changing speeds in the middle of a course will generally require starting a new pass and may produce kickbacks. Valid N and its meaning depends on the machine (Shima SWGN2: 0-15; Kniterate: 0-600).

  • End Pass

    x-end-pass

    Ends the current pass, even if the backend thinks it is able to add more stitches. Useful for debugging and for forcing certain machine behaviors.

Visualizer Extensions

These extensions exist to help with pattern visualization in the live visualizer.

  • Visualizer Color

    x-vis-color H CS

    Sets the current color of carrier set CS to CSS color specification H (generally, a 6-digit hex color like '#ff00ff'); color changes take effect on the next operation.

  • Loop In

    x-loop-in D N CS

    Tells the visualizer to create an existing starter loop so we can visualize a stitch with just one call to knit.

  • Yarn In

    x-yarn-in D N CS

    Tells the visualizer to bring a yarn in so we can use it.

  • Loop Out

    x-yarn-out N

    Tells the visualizer to take the "yarn" used for the started loop out, since we are no longer using it.

  • Yarn Out

    x-yarn-out D N CS

    Tells the visualizer to take a yarn out, since we are no longer using it.

  • End

    x-end

    Instructs the visualizer to stop reading the file here.

Shima SWGN2 Extensions

These extensions pertain to specific functionality provided by the Shima SWGN2 knitting machine.

  • Fabric Presser Mode

    x-presser-mode M

    Sets the fabric presser mode M to off (no fabric presser), auto (fabric presser on passes with only front or only back stitches), or on (break passes so that fabric presser can always be used). The default mode is off.

Kniterate Extensions

  • Set Roller Advance

    x-roller-advance D

    Sets the distance, D, the take-down roller will advance after each pass. The default value is 100.

  • Add Roller Advance

    x-add-roller-advance A

    Adds an additional take-down roller advance amount, A, to the current pass. The effect is cumulative over multiple calls and resets every pass; thus, calling x-roller-advance 200 x-add-roller-advance 25 x-add-roller-advance -75 will result in an advance of 150 after the current pass and (assuming no other calls) an advance of 200 on every pass thereafter.

  • Carrier Spacing

    x-carrier-spacing N

    If a carrier would have stopped at the same location as another carrier, it will instead be moved by N additional needles. This value is set for all subsequent operations and will start a new pass if needed. The default value is 2.

  • Carrier Stopping Distance

    x-carrier-stopping-distance N

    Sets carriers to stop N needles past the last needle they worked on a pass; N should end in 0.5 to reflect the fact that we think of carriers as stopping between needles. This value is set for all subsequent operations and will start a new pass if needed. The default value is 2.5.

  • Transfer Style

    x-xfer-style S

    Sets style, S, in which subsequent transfers are allocated to passes; four-pass (the default) divides even and odd front-to-back and back-to-front transfers into their own passes, which is generally more reliable; two-pass just divides front and back transfers into their own passes, which is required by the hardware but may be unreliable. Use x-xfer-style two-pass along with x-end-pass when you need to allocate transfers specifically to passes. This value is set for all subsequent operations and will start a new pass if needed.