Machine Operations๏ƒ

Detailed guide to machine control operations in KnitScript.

๐Ÿงถ Basic Stitching Operations๏ƒ

Knitting๏ƒ

The knit operation creates new loops and stitches them through old ones on the specified needle:

// Knit all loops on Front bed
in Rightward direction:{ knit Front_Loops; }

// Knit specific needles
in Leftward direction:{ knit Front_Needles[0:10]; }

// Knit all loops regardless of bed
in reverse direction:{ knit Loops; }

Tucking๏ƒ

The tuck operation creates new loops while keeping old ones on the specified needle:

// Alternating tuck cast-on
in Leftward direction:{
    tuck Front_Needles[0:width:2];  // Even needles
}
in Rightward direction:{
    tuck Front_Needles[1:width:2];  // Odd needles
}

Missing๏ƒ

The miss operation moves carriers to a specified needle without forming loops:

// Miss needles to position carrier
in Rightward direction:{
    miss Front_Needles[5:15];
}

๐Ÿ”„ Transfer Operations๏ƒ

Across-Bed Transfers๏ƒ

Transfer loops directly between front and back beds:

// Transfer all front loops to Back bed
xfer Front_Loops across to Back bed;

// Transfer specific needles
xfer Front_Needles[0:10] across to Back bed;

// Transfer to Front bed
xfer Back_Loops across to Front bed;

// Transfer all loops only to Back bed. Back bed loops stay in place
xfer Loops across to Back bed;

Offset Transfers๏ƒ

Transfer with horizontal offset (Racking localized to xfers):

// Transfer 2 needles to the Right
xfer Front_Needles[0:8] 2 to Right to Back bed;

// Transfer 1 needle to the Left
xfer Back_Needles[10:20] 1 to Left to Front bed;

// Variable offset
offset = 3;
xfer Front_Loops offset to Right to Back bed;

Slider Transfers๏ƒ

Transfer to slider needles for temporary holding:

// Transfer to sliders
xfer Front_Needles[0:5] across to sliders;

// Transfer loops moved to sliders back to Front bed.
xfer Last_Pass.values() across to Front bed;

Split Operations๏ƒ

The split operation creates loops on one needle while moving existing loops to another:

in Rightward direction:{
    split Front_Needles[5:10];  // Splits loops and creates new ones on the opposite position
}

๐Ÿ—‘๏ธ Drop Operations๏ƒ

Basic Dropping๏ƒ

Remove loops from needles:

// Drop specific needles
drop Front_Needles[0:5];

// Drop all loops on a bed
drop Front_Loops;
drop Back_Loops;

// Drop everything
drop Loops;

๐ŸŽจ Carrier Management๏ƒ

Setting Active Carrier๏ƒ

// Single carrier
Carrier = c1;

// Multiple carriers for platting
Carrier = [c1, c2];

// Using with statement for scoped carrier work
with Carrier as c2:{
    in reverse direction:{ knit Loops; }
}

Carrier Operations๏ƒ

// Cut carriers (outhook)
cut c1;              // Cut specific carrier
cut [c1, c2];        // Cut multiple carriers
cut Carrier;         // Cut current working carrier

// Release yarn hook
releasehook;         // Release current hooked carrier. If no yarn is hooked, this is a safe no-op.

๐ŸŽฏ Direction Control๏ƒ

Direction Keywords๏ƒ

// Explicit directions
in Rightward direction:{ knit Loops; }
in Leftward direction:{ knit Loops; }

// Contextual directions
in reverse direction:{ knit Loops; }    // Opposite of last directed carriage pass (ignores xfer passes)
in current direction:{ knit Loops; }    // Same as last directed carriage pass (ignores xfer passes)

 //Preserve a direction in a variable
 var_dir = current;
     with Carrier as c1:{
             in Leftward direction: {knit Front_Loops;}
     }
     with Carrier as c2:{
             in var_dir: {knit Back_Loops;}
     }

๐Ÿ“ Racking and Positioning๏ƒ

Racking Control๏ƒ

// Set racking position
Racking = 0.0;    // Aligned beds. This is the default racking
Racking = 1.0;    // Front bed 1 needle Right
Racking = -2.0;   // Front bed 2 needles Left

All-Needle Operations๏ƒ

If operations require all-needle racking, KnitScript will automatically adjust the racking for that carriage pass.

// Operations that might need all-needle racking
in Rightward direction:{
    knit Front_Needles[10];
    knit Back_Needles[10];  // Same position - needs all-needle
}

๐Ÿ“Š Multi-Sheet Operations๏ƒ

Use Gauge and sheets to independently knit structures with multiple layers.

Common example is knitting a tube in half-gauge to use knit-purl patterns such as ribbing.

Seetting the gauge will determine the number of working sheets. Each sheet will work on needle slots with spacing defined by the gauge.

Gauge Configuration๏ƒ

// Set number of sheets
Gauge = 2;    // 2 sheets (a.k.a., half-gauge)

// Sheet selection
Sheet = 0;    // First sheet knit on even needle slots
Sheet = 1;    // Second sheet knit on odd needle slots

Sheet-Scoped Operations๏ƒ

// comment fixes with warning in pycharm?
     with Gauge as 2:{
        // Work on sheet 0
        with Sheet as s0:{
            in Leftward direction:{
             tuck Front_Needles[0:width:2]; // note that front_needles is localized to the working sheet
             tuck Back_Needles[1:width:2]; // note that back_needles is localized to the working sheet
            }
        }

        // Work on sheet 1
        with Sheet as s1:{
            in reverse direction:{
             tuck Front_Needles[0:width:2]; // note that front_needles is localized to the working sheet
             tuck Back_Needles[1:width:2]; // note that back_needles is localized to the working sheet
            }
        }

        // Knit both sheets alternately to form a tube
        for row in range(height):{
            with Sheet as s0:{
                in reverse direction:{ knit Loops; }
            }
            with Sheet as s1:{
                in reverse direction:{ knit Loops; }
            }
        }
    }

Layer Management๏ƒ

Control the layering order of sheets:

 Gauge = 2;
     Sheet = 0;
 // Push needles to different layers
push Front_Needles[0:10] to Front;    // Bring to first 10 needle slots of this sheet to the front of the sheet layers.
push Front_Needles[10:20] to Back;    // Send the next 10 needle slots of this sheet to the back of the sheet layers.

Gauge = 3;
Sheet = 0;
// Push by distance
push Front_Needles[5:15] 1 Backward;  // Move 1 layers backward (to be in the center at these layers
Sheet = 2;
push Back_Needles[0:5] 2 Forward;   // Move 2 layers forward to be in front of all other sheets.

// Swap layer positions
swap Front_Needles[0:5] with layer 2; // Set to be 2nd layer over these needle slots.
swap Front_Needles[10:15] with sheet s1; // Set to trade the layer of sheet 1 at these slots.

๐Ÿ› ๏ธ Machine Control๏ƒ

Pause Operations๏ƒ

// Pause for manual intervention
pause;

// Pause with context
print "Please check tension";
pause;
print "Continuing pattern...";

๐Ÿ“‹ Operation Reference๏ƒ

KnitScript Machine Operations๏ƒ

Operation

Syntax

Description

Knit

knit needles

Form new loops, consume old ones

Tuck

tuck needles

Form new loops, keep old ones

Miss

miss needles

Move carrier without forming loops

Split

split needles

Create loop and move existing loops

Transfer

xfer needles [offset] to bed

Move loops between needles

Drop

drop needles

Remove loops from needles

Cut

cut carriers

Permanently remove carriers

Remove

remove carriers

Temporarily remove carriers

Release

releasehook

Release yarn inserting hook

Pause

pause

Stop machine execution

Next: Learn about knit-script API Documentation for detailed API documentation.