virtual_knitting_machine.machine_components.yarn_management.Yarn_Carrier_Set module
Representation module for yarn carrier sets on knitting machines. This module provides the Yarn_Carrier_Set class which represents a collection of yarn carriers that can be operated together in knitting operations. It manages multiple carriers as a single unit for positioning and operations.
- class Yarn_Carrier_Set(carrier_ids)[source]
Bases:
object
A structure to represent a collection of yarn carriers that operate together as a single unit. This class manages multiple carriers for coordinated operations, positioning, and state management. It provides methods for accessing carrier positions, managing duplicates, and converting to various representation formats.
- Parameters:
carrier_ids (
list
[int
|Yarn_Carrier
] |int
|Yarn_Carrier
)
- __init__(carrier_ids)[source]
Initialize a yarn carrier set with one or more carrier identifiers.
- Parameters:
carrier_ids (list[int | Yarn_Carrier] | int | Yarn_Carrier) – The carrier IDs for this yarn carrier set, can be a single carrier or list of carriers.
- Warns:
Duplicate_Carriers_In_Set – If duplicate carrier IDs are found in the input list.
- positions(carrier_system)[source]
Get the positions of all carriers in this set from the carrier system.
- Parameters:
carrier_system (Yarn_Insertion_System) – The carrier system to reference position data from.
- Returns:
The list of positions of each carrier in the carrier set.
- Return type:
- get_carriers(carrier_system)[source]
Get the actual carrier objects that correspond to the IDs in this carrier set.
- Parameters:
carrier_system (Yarn_Insertion_System) – Carrier system referenced by set.
- Returns:
Carriers that correspond to the ids in the carrier set.
- Return type:
- position_carriers(carrier_system, position, direction=None)[source]
Set the position of all involved carriers to the given position.
- Parameters:
carrier_system (Yarn_Insertion_System) – Carrier system referenced by set.
position (Needle | int | None) – The position to move the carrier set to, if None this means the carrier is not active.
direction (Carriage_Pass_Direction, optional) – The direction of the carrier movement. If this is not provided, the direction will be inferred.
- Return type:
- property many_carriers: bool
Check if this carrier set involves multiple carriers.
- Returns:
True if this carrier set involves multiple carriers, False if single carrier.
- Return type:
- __str__()[source]
Return string representation of the carrier set.
- Returns:
String representation showing all carrier IDs separated by spaces.
- Return type:
- __hash__()[source]
Return hash value for the carrier set.
- Returns:
Hash value based on single carrier ID or string representation for multiple carriers.
- Return type:
- __repr__()[source]
Return string representation of the carrier set.
- Returns:
String representation of the carrier set.
- Return type:
- __eq__(other)[source]
Check equality with another carrier set, carrier, or list of carriers.
- Parameters:
other (None | Yarn_Carrier | int | list[Yarn_Carrier | int] | Yarn_Carrier_Set) – The object to compare with.
- Returns:
True if the carrier sets contain the same carrier IDs, False otherwise.
- Return type:
- __iter__()[source]
Iterate over the carrier IDs in this set.
- Returns:
Iterator over carrier IDs.
- Return type:
Iterator[int]
- __len__()[source]
Get the number of carriers in this set.
- Returns:
Number of carriers in the set.
- Return type:
- __contains__(carrier_id)[source]
Check if a carrier ID is contained in this set.
- Parameters:
carrier_id (int | Yarn_Carrier) – Carrier ID to check for membership.
- Returns:
True if carrier ID is in this set, False otherwise.
- Return type: