quilt_knit.swatch.Merge_Process module

Module containing the Merge_Process class

exception Failed_Merge_Release_Exception(release)[source]

Bases: Knitting_Machine_Exception

Exception raised when a release required by the merge program cannot be executed.

Parameters:

release (Releasehook_Instruction)

__init__(release)[source]

Initialize a knitting machine exception with formatted message.

Parameters:
  • message (str) – The descriptive error message about the machine state or operation failure.

  • release (Releasehook_Instruction)

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class Merge_Process(swatch_connection, starting_swatch_side, seam_search_space)[source]

Bases: object

Super class for swatch merging processes that tracks the merged machine state.

merged_instructions

The ordered list of knitout instructions that result from the merge.

Type:

list[Knitout_Line]

Parameters:
__init__(swatch_connection, starting_swatch_side, seam_search_space)[source]
Parameters:
property from_swatch: Swatch

Returns: Swatch: The first swatch in the connection.

property to_swatch: Swatch

Returns: Swatch: The second swatch in the connection.

property current_swatch_rack: int

Returns: int: The rack value of the machine state of the current swatch.

property current_swatch_all_needle_rack: bool

Returns: bool: True if the machine state of the current swatch is set to all needle rack. False, otherwise.

property merged_and_current_racks_match: bool

Returns: bool: True if the racking values of the merged program state and the current swatch state match. False, otherwise.

instruction_requires_release(next_instruction)[source]
Parameters:

next_instruction (Knitout_Line) – The next instruction to test if it requires a releasehook.

Returns:

True if the specified next instruction would trigger a releasehook from the current merged program machine state.

Return type:

bool

get_merged_instructions()[source]

Updates the merged instructions with comments specifying the origin swatch and updated line numbers for the merged program.

Returns:

List of instructions in the merged program.

Return type:

list[Knitout_Line]

write_knitout(merge_name=None)[source]

Creates a knitout file of the given merge name of the merged instructions from this merger.

Parameters:

merge_name (str, optional) – The name of the merged swatch knitout file. Defaults to cwm_<the left_swatch’s name>_to_<the right_swatch’s name>.

Return type:

None

compile_to_dat(merge_name=None)[source]

Creates a knitout file and compiled DAT file of the given merge name of the merged instructions from this merger.

Parameters:

merge_name (str, optional) – The name of the merged swatch knitout file. Defaults to cwm_<the left_swatch’s name>_to_<the right_swatch’s name>.

Return type:

None