virtual_knitting_machine.Knitting_Machine_Specification module
A module containing the class structures needed to define a knitting machine specification.
This module provides enumerations for machine types and knitting positions, as well as a dataclass specification that defines all the parameters and constraints for configuring a virtual knitting machine.
- class Knitting_Machine_Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
An enumeration of supported knitting machine types that can be represented by this library.
Currently, supports the SWG091N2 whole garment knitting machine model with potential for additional machine types in the future.
- SWG091N2 = 'SWG091N2'
- __str__()[source]
Return string representation of the machine type.
- Returns:
The name of the machine type.
- Return type:
- __repr__()[source]
Return string representation of the machine type.
- Returns:
String representation of the machine type.
- Return type:
- __hash__()[source]
Return hash value for the machine type.
- Returns:
Hash value based on string representation.
- Return type:
- 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 Knitting_Position(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
The position configuration for knitting operations executed on the virtual machine.
This enumeration defines where knitting operations are positioned on the machine bed, affecting how the machine interprets needle positions and carriage movements.
- Left = 'Left'
- Right = 'Right'
- Center = 'Center'
- Keep = 'Keep'
- __str__()[source]
Return string representation of the knitting position.
- Returns:
The name of the knitting position.
- Return type:
- __repr__()[source]
Return string representation of the knitting position.
- Returns:
String representation of the knitting position.
- Return type:
- __hash__()[source]
Return hash value for the knitting position.
- Returns:
Hash value based on string representation.
- Return type:
- 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 Knitting_Machine_Specification(machine=SWG091N2, gauge=15, position=Right, carrier_count=10, needle_count=540, maximum_rack=4, maximum_float=20, maximum_loop_hold=4, hook_size=5)[source]
Bases:
object
The complete specification of a knitting machine including machine type, physical constraints, and operational parameters.
This dataclass defines all the configurable parameters that determine machine capabilities, limitations, and behavior during knitting operations.
- Parameters:
machine (
Knitting_Machine_Type
)gauge (
int
)position (
Knitting_Position
)carrier_count (
int
)needle_count (
int
)maximum_rack (
int
)maximum_float (
int
)maximum_loop_hold (
int
)hook_size (
int
)
-
machine:
Knitting_Machine_Type
= 'SWG091N2' The type of knitting machine being represented
-
position:
Knitting_Position
= 'Right' The positioning configuration for knitting operations
- __init__(machine=SWG091N2, gauge=15, position=Right, carrier_count=10, needle_count=540, maximum_rack=4, maximum_float=20, maximum_loop_hold=4, hook_size=5)
- Parameters:
machine (
Knitting_Machine_Type
)gauge (
int
)position (
Knitting_Position
)carrier_count (
int
)needle_count (
int
)maximum_rack (
int
)maximum_float (
int
)maximum_loop_hold (
int
)hook_size (
int
)