quilt_knit.swatch.wale_wise_merging.Wale_Seam_Connection module

Module containing the Wale_Seam_Connection class.

class Wale_Seam_Connection(_exit_instruction, _entrance_instruction)[source]

Bases: Seam_Connection

A Class representing the effects of connecting an exit and entrance instruction between two swatches.

Parameters:
property exit_instruction: Wale_Boundary_Instruction

Returns: Wale_Boundary_Instruction: The instruction that exits a wale boundary.

property entrance_instruction: Wale_Boundary_Instruction

Returns: Wale_Boundary_Instruction: The instruction that enters a wale boundary.

property can_satisfy_connection: bool

Returns: bool: True if this connection can satisfy alignment of loops. False, otherwise.

minimum_instructions_to_connect_to_entrance(max_rack=3)[source]
Parameters:

max_rack (int, optional) – Maximum racking distance allowed to form a connection. Defaults to 3.

Returns:

List knitout instructions needed to form this connection or None if the connection cannot be formed. An empty list indicates that the connection is already aligned. Otherwise, instructions will be returned in teh following order:

  1. An optional transfer to a slider needle to hold loops on opposite bed for transfer.

  2. An optional racking instruction to align loops on the opposite bed of the entrance with the entrance instruction.

  3. A transfer from the opposite bed to the entrance instruction to place the exit loop on the entrance needle.

Return type:

list[Knitout_Instruction]

minimum_instructions_required_to_front_entrance(max_rack=3)[source]
Parameters:

max_rack (int, optional) – Maximum racking distance allowed to form a connection. Defaults to 3.

Returns:

List knitout instructions needed to form this connection for the front needle or None if that connection cannot be formed. An empty list indicates that the connection is already aligned. Otherwise, instructions will be returned in teh following order:

  1. An optional transfer to a slider needle to hold loops on opposite bed for transfer.

  2. An optional racking instruction to align loops on the opposite bed of the entrance with the entrance instruction.

  3. A transfer from the opposite bed to the entrance instruction to place the exit loop on the entrance needle.

Return type:

list[Knitout_Instruction]

minimum_instructions_required_to_back_entrance(max_rack=3)[source]
Parameters:

max_rack (int, optional) – Maximum racking distance allowed to form a connection. Defaults to 3.

Returns:

List knitout instructions needed to form this connection for the back needle or None if that connection cannot be formed. An empty list indicates that the connection is already aligned. Otherwise, instructions will be returned in teh following order:

  1. An optional transfer to a slider needle to hold loops on opposite bed for transfer.

  2. An optional racking instruction to align loops on the opposite bed of the entrance with the entrance instruction.

  3. A transfer from the opposite bed to the entrance instruction to place the exit loop on the entrance needle.

Return type:

list[Knitout_Instruction]

required_rack()[source]
Returns:

The racking required to perform the minimum alignment between this exit and entrance instruction.

Return type:

int

Notes

  • This does not check that the instructions require alignment (e.g., exit drops or entrance tucks).

better_connection(other)[source]
Parameters:

other (Wale_Seam_Connection) – The other connection to compare to.

Returns:

True if this connection is better than the other connection. Connections are better if they can form a connection and do so with fewer operations.

Return type:

bool

__lt__(other)[source]
Parameters:

other (Wale_Seam_Connection) – The other connection to compare to.

Returns:

True if this connection is strictly better than the other connection. A connection is better if it can form a connection in fewer operations.

Return type:

bool

__contains__(item)
Parameters:

item (Swatch_Boundary_Instruction) – The instruction to find in the connection.

Returns:

True if the given item is one of the boundary instructions involved in the connection. False, otherwise.

Return type:

bool

__eq__(other)
Parameters:

other (Course_Seam_Connection) – The other connection to compare to.

Returns:

True if both connections connect the same entrance-exit pairs.

Return type:

bool

__hash__()
Returns:

Hash of the tuple of the exit and entrance instruction.

Return type:

int

__init__(_exit_instruction, _entrance_instruction)
Parameters:
property seam_entrance: Swatch_Boundary_Instruction

Returns: Swatch_Boundary_Instruction: The instruction that enters the merging swatch

property seam_exit: Swatch_Boundary_Instruction

Returns: Swatch_Boundary_Instruction: The instruction that exits the merging swatch.

static sort_connections(connections)
Parameters:

connections (set[Seam_Connection]) – The list of connections to sort.

Returns:

The sorted list of connections.

Return type:

List[Seam_Connection]