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:

str

__repr__()[source]

Return string representation of the machine type.

Returns:

String representation of the machine type.

Return type:

str

__hash__()[source]

Return hash value for the machine type.

Returns:

Hash value based on string representation.

Return type:

int

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:

str

__repr__()[source]

Return string representation of the knitting position.

Returns:

String representation of the knitting position.

Return type:

str

__hash__()[source]

Return hash value for the knitting position.

Returns:

Hash value based on string representation.

Return type:

int

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 = 'SWG091N2'

The type of knitting machine being represented

gauge: int = 15

The gauge of the knitting machine needles

position: Knitting_Position = 'Right'

The positioning configuration for knitting operations

carrier_count: int = 10

Number of yarn carriers available on the machine

needle_count: int = 540

Total number of needles on each bed of the machine

maximum_rack: int = 4

Maximum racking distance the machine can achieve

maximum_float: int = 20

Maximum float length allowed (for future long float warnings)

maximum_loop_hold: int = 4

Maximum number of loops a single needle can hold

hook_size: int = 5

Size of the yarn insertion hook in needle positions

__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: