quilt_knit.swatch.course_boundary_instructions module
Module containing structure that define course-wise boundary instructions of swatch programs.
- class Course_Side(*args)[source]
Bases:
Swatch_Side,EnumEnumeration of the side of a swatch an instruction exists on. Used to differentiate between entrance-exit seam directions.
- Parameters:
args (
tuple)
- Left = 'Left'
- Right = 'Right'
- static entrance_by_direction(direction)[source]
- Parameters:
direction (Carriage_Pass_Direction) – The direction of a carriage pass to find the entrance side of a course.
- Returns:
The side of the course that would be entered by the given carriage pass direction
- Return type:
- static exit_by_direction(direction)[source]
- Parameters:
direction (Carriage_Pass_Direction) – The direction of a carriage pass to find the exit side of a course.
- Returns:
The side of the course that would be exited by the given carriage pass direction
- Return type:
- property opposite: Course_Side
Returns: Course_Side: The opposite of this course side.
- classmethod __contains__(member)
Return True if member is a member of this enum raises TypeError if member is not an enum member
note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum
- classmethod __getitem__(name)
Return the member matching name.
- classmethod __iter__()
Return members in definition order.
- classmethod __len__()
Return the number of members (no aliases)
- class Course_Boundary_Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumEnumeration of the course-wise boundary entrance/exit types.
- exit_boundary = 'exit'
- entrance = 'entrance'
- entrance_exit = 'entrance-exit'
- blocked = 'blocked'
- property opposite: Course_Boundary_Type
Returns: Course_Boundary_Type: The opposite of this boundary type. Entrance-Exits and blocked boundaries remain unchanged.
- classmethod __contains__(member)
Return True if member is a member of this enum raises TypeError if member is not an enum member
note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum
- classmethod __getitem__(name)
Return the member matching name.
- classmethod __iter__()
Return members in definition order.
- classmethod __len__()
Return the number of members (no aliases)
- class Course_Boundary_Instruction(instruction, source_swatch_name, left_boundary_type, right_boundary_type, carriage_pass_rack, carriage_pass_is_all_needle, carriage_pass_index)[source]
Bases:
Swatch_Boundary_InstructionA class to represent instructions on the course-wise boundary of a swatch program.
- Parameters:
instruction (
Needle_Instruction)source_swatch_name (
str)left_boundary_type (
Course_Boundary_Type)right_boundary_type (
Course_Boundary_Type)carriage_pass_rack (
int)carriage_pass_is_all_needle (
bool)carriage_pass_index (
int)
-
left_boundary_type:
Course_Boundary_Type
-
right_boundary_type:
Course_Boundary_Type
- property is_left: bool
Returns: bool: True if the boundary instruction can enter or exit the left side of its carriage pass.
- property is_right: bool
Returns: bool: True if the boundary instruction can enter or exit the right side of its carriage pass.
- property is_left_exit: bool
Returns: bool: True if the boundary instruction can exit the left side of its carriage pass.
- property is_right_exit: bool
Returns: bool: True if the boundary instruction can exit the right side of its carriage pass.
- property is_left_entrance: bool
Returns: bool: True if the boundary instruction can enter the left side of its carriage pass.
- property is_right_entrance: bool
Returns: bool: True if the boundary instruction can enter the right side of its carriage pass.
- has_potential_left_to_right_connection(right_boundary_instruction)[source]
- Parameters:
right_boundary_instruction (Course_Boundary_Instruction) – The boundary instruction to find potential connection to, presuming it is on the right side of the boundary.
- Returns:
True if the boundaries are on opposite course sides, proceed in the same carriage pass direction, and are an entrance exit pair. False, otherwise.
- Return type:
- __str__()[source]
- Returns:
A string expressing the entrance-exit direction and blocked status of this boundary instruction.
- Return type:
- __init__(instruction, source_swatch_name, left_boundary_type, right_boundary_type, carriage_pass_rack, carriage_pass_is_all_needle, carriage_pass_index)
- Parameters:
instruction (
Needle_Instruction)source_swatch_name (
str)left_boundary_type (
Course_Boundary_Type)right_boundary_type (
Course_Boundary_Type)carriage_pass_rack (
int)carriage_pass_is_all_needle (
bool)carriage_pass_index (
int)
- __lt__(other)
- Parameters:
other (Needle | Needle_Instruction | Swatch_Boundary_Instruction) – The needle or instruction containing a needle to sort these instructions leftward and rightward.
- Returns:
True if this instruction is on a needle left of the other needle. False, otherwise.
- Return type:
- property carrier_set: Yarn_Carrier_Set | None
Returns: Yarn_Carrier_Set | None: The carrier set of this boundary instruction or None if the instruction does not use a carrier set.
- property direction: Carriage_Pass_Direction | None
Returns: Carriage_Pass_Direction | None: The direction this instruction forms a loop or None if xfer instruction.
- property instruction_index: int | None
Returns: int | None: Index of the instruction in the original swatch program. None if the instruction does have a line number defined.
- property needle: Needle
Returns: Needle: The needle that is activated by this boundary instruction.
-
instruction:
Needle_Instruction