knitout_interpreter.knitout_operations.needle_instructions module
Needle operations
- class knitout_interpreter.knitout_operations.needle_instructions.Needle_Instruction(instruction_type, needle, direction=None, needle_2=None, carrier_set=None, comment=None)[source]
Bases:
Knitout_Instruction
- property has_second_needle: bool
Check if this instruction has a second needle.
- Returns:
True if it has a second needle.
- property has_direction: bool
Check if this instruction has a direction value.
- Returns:
True if it has a direction value.
- class knitout_interpreter.knitout_operations.needle_instructions.Loop_Making_Instruction(instruction_type, needle, direction=None, needle_2=None, carrier_set=None, comment=None)[source]
Bases:
Needle_Instruction
Base class for instructions that create loops.
- class knitout_interpreter.knitout_operations.needle_instructions.Knit_Instruction(needle, direction, cs, comment=None)[source]
Bases:
Loop_Making_Instruction
Instruction for knitting a loop on a needle.
- execute(machine_state)[source]
Execute the instruction on the machine state.
- Parameters:
machine_state (Knitting_Machine) – The machine state to update.
- Returns:
True if the process completes an update.
- Return type:
- static execute_knit(machine_state, needle, direction, cs, comment=None)[source]
Execute a knit instruction on the machine.
- Parameters:
machine_state (Knitting_Machine) – The current machine model to update.
needle (Needle) – The needle to execute on.
direction (str | Carriage_Pass_Direction) – The direction to execute in.
cs (Yarn_Carrier_Set) – The yarn carriers set to execute with.
comment (str | None) – Additional details to document in the knitout.
- Returns:
The instruction that was executed.
- Return type:
- class knitout_interpreter.knitout_operations.needle_instructions.Tuck_Instruction(needle, direction, cs, comment=None)[source]
Bases:
Loop_Making_Instruction
Instruction for tucking yarn on a needle without dropping existing loops.
- execute(machine_state)[source]
Execute the instruction on the machine state.
- Parameters:
machine_state (Knitting_Machine) – The machine state to update.
- Returns:
True if the process completes an update.
- Return type:
- static execute_tuck(machine_state, needle, direction, cs, comment=None)[source]
Execute a tuck instruction on the machine.
- Parameters:
machine_state (Knitting_Machine) – The current machine model to update.
needle (Needle) – The needle to execute on.
direction (str | Carriage_Pass_Direction) – The direction to execute in.
cs (Yarn_Carrier_Set) – The yarn carriers set to execute with.
comment (str | None) – Additional details to document in the knitout.
- Returns:
The instruction that was executed.
- Return type:
- class knitout_interpreter.knitout_operations.needle_instructions.Split_Instruction(needle, direction, n2, cs, comment=None)[source]
Bases:
Loop_Making_Instruction
Instruction for splitting a loop between two needles.
- execute(machine_state)[source]
Execute the instruction on the machine state.
- Parameters:
machine_state (Knitting_Machine) – The machine state to update.
- Returns:
True if the process completes an update.
- Return type:
- static execute_split(machine_state, needle, direction, cs, n2, comment=None)[source]
Execute a split instruction on the machine.
- Parameters:
machine_state (Knitting_Machine) – The current machine model to update.
needle (Needle) – The needle to execute on.
direction (str | Carriage_Pass_Direction) – The direction to execute in.
cs (Yarn_Carrier_Set) – The yarn carriers set to execute with.
n2 (Needle) – The second needle to execute to.
comment (str | None) – Additional details to document in the knitout.
- Returns:
The instruction that was executed.
- Return type:
- class knitout_interpreter.knitout_operations.needle_instructions.Drop_Instruction(needle, comment=None)[source]
Bases:
Needle_Instruction
Instruction for dropping loops from a needle.
- execute(machine_state)[source]
Execute the instruction on the machine state.
- Parameters:
machine_state (Knitting_Machine) – The machine state to update.
- Returns:
True if the process completes an update.
- Return type:
- static execute_Drop(machine_state, needle, comment=None)[source]
Execute a drop instruction on the machine.
- Parameters:
machine_state (Knitting_Machine) – The current machine model to update.
needle (Needle) – The needle to execute on.
comment (str | None) – Additional details to document in the knitout.
- Returns:
The instruction that was executed.
- Return type:
- class knitout_interpreter.knitout_operations.needle_instructions.Xfer_Instruction(needle, n2, comment=None, record_location=True)[source]
Bases:
Needle_Instruction
Instruction for transferring loops between needles.
- add_loop_crossing(left_loop, right_loop)[source]
Update loop crossing to show transfers crossing loops.
- Parameters:
left_loop (Machine_Knit_Loop) – The left loop involved in the crossing.
right_loop (Machine_Knit_Loop) – The right loop involved in the crossing.
- execute(machine_state)[source]
Execute the instruction on the machine state.
- Parameters:
machine_state (Knitting_Machine) – The machine state to update.
- Returns:
True if the process completes an update.
- Return type:
- static execute_xfer(machine_state, needle, n2, comment=None)[source]
Execute a transfer instruction on the machine.
- Parameters:
machine_state (Knitting_Machine) – The current machine model to update.
needle (Needle) – The needle to execute on.
n2 (Needle) – The second needle to execute to.
comment (str | None) – Additional details to document in the knitout.
- Returns:
The instruction that was executed.
- Return type:
- class knitout_interpreter.knitout_operations.needle_instructions.Miss_Instruction(needle, direction, cs, comment=None)[source]
Bases:
Needle_Instruction
Instruction for positioning carriers above a needle without forming loops.
- execute(machine_state)[source]
Position the carrier above the given needle.
- Parameters:
machine_state (Knitting_Machine) – The machine state to update.
- Returns:
True indicating the operation completed successfully.
- Return type:
- static execute_miss(machine_state, needle, direction, cs, comment=None)[source]
Execute a miss instruction on the machine.
- Parameters:
machine_state (Knitting_Machine) – The current machine model to update.
needle (Needle) – The needle to execute on.
direction (str | Carriage_Pass_Direction) – The direction to execute in.
cs (Yarn_Carrier_Set) – The yarn carriers set to execute with.
comment (str | None) – Additional details to document in the knitout.
- Returns:
The instruction that was executed.
- Return type: