virtual_knitting_machine.visualizer.diagram_settings module
Module containing the Diagram_Settings class.
- class Diagram_Settings(Needle_Height=20, Needle_Width=20, Loop_Stack_Overlap=0.6, White_Space_Padding_Proportional_to_Needle=0.25, Minimum_Loop_Portion_of_Needle=0.2, Carriage_Height_in_Needles=1.5, Carriage_Width_in_Needles=2.0, Slider_Background_Color='lightgrey', Carriage_Color='grey', Yarn_Fill_Lightening_Factor=0.3, Needle_Stroke_Color='black', font_family='Arial', font_size=14, Needle_Stroke_Width=1, Loop_Stroke_Width=1, Carrier_Stroke_Width=1, Left_Needle_Buffer=0, Right_Needle_Buffer=0, render_front_labels=True, render_back_labels=True, render_left_labels=True, render_right_labels=True, render_empty_sliders=False, render_carriers=True, render_carriage=True, render_legend=True)[source]
Bases:
objectA data class containing the settings for a virtual knitting machine visualization.
- property label_height: int
Returns: int: The reserved vertical spacing for a label including whitespace padding.
- all_needle_shift(is_all_needle_rack, carriage_direction)[source]
- Parameters:
is_all_needle_rack (bool) – If True, the back beds are shifted to align with the carriage direction.
carriage_direction (Carriage_Pass_Direction) – Direction of the carriage.
- Returns:
The amount to shift back bed x coordinates for a given all needle shift
- Return type:
Notes
If not all needle racking, this is the same as the front-bed’s x-coordinate. In a leftward all needle alignment, the bed is shifted leftward. In a rightward all needle alignment, the bed is shifted rightward
- property minimum_loop_diameter: float
Returns: float: The minimum diameter to render a loop on a needle box.
- property loop_radius: float
Returns: float: The radius of loop circles based on their proportion of a needle box.
- property loop_stack_shift_portion: float
Returns: float: The portion of a loops diameter to shift by when stacking multiple loops on a single needle box.
- property loop_stack_top: float
Returns: float: The distance from the top edge of the needle to the top of the top loop stack.
- stacked_loop_diameter(loop_count)[source]
- Parameters:
loop_count (int) – The number of loops to stack on a needle box.
- Returns:
The diameter of the stacked loops adjusted for the number overlapping loops in the stack.
- Return type:
Notes
The diameter is based on the number of loops in a stack, however a minimum diameter is set to ensure that loops are clearly rendered.
- property carrier_size: int
Returns: int: The side length of carrier triangles. Set to 1/3 of the needle width.
- __init__(Needle_Height=20, Needle_Width=20, Loop_Stack_Overlap=0.6, White_Space_Padding_Proportional_to_Needle=0.25, Minimum_Loop_Portion_of_Needle=0.2, Carriage_Height_in_Needles=1.5, Carriage_Width_in_Needles=2.0, Slider_Background_Color='lightgrey', Carriage_Color='grey', Yarn_Fill_Lightening_Factor=0.3, Needle_Stroke_Color='black', font_family='Arial', font_size=14, Needle_Stroke_Width=1, Loop_Stroke_Width=1, Carrier_Stroke_Width=1, Left_Needle_Buffer=0, Right_Needle_Buffer=0, render_front_labels=True, render_back_labels=True, render_left_labels=True, render_right_labels=True, render_empty_sliders=False, render_carriers=True, render_carriage=True, render_legend=True)