virtual_knitting_machine.visualizer.visualizer_elements.diagram_elements.needle_bed_visualizer_group module
Module containing the Needle Bed Group class.
- class Needle_Bed_Group(leftmost_slot, rightmost_slot, render_sliders, diagram_settings, machine_state)[source]
Bases:
Visualizer_GroupWrapper class for the groupings that form the Needle Bed diagram.
- settings
The machine diagram settings.
- Type:
- __init__(leftmost_slot, rightmost_slot, render_sliders, diagram_settings, machine_state)[source]
Constructor for the Needle Bed Group class. :param leftmost_slot: The leftmost needle slot to render from. :type leftmost_slot: int :param rightmost_slot: The rightmost needle slot to render to. :type rightmost_slot: int :param render_sliders: True if the slider beds are rendered, False otherwise. :type render_sliders: bool :param diagram_settings: The machine diagram settings. :type diagram_settings: Diagram_Settings :param machine_state: The machine state being displayed. :type machine_state: Knitting_Machine_State
- property all_needle_rack: bool
Returns: bool: True if the machine state is set for all needle rack. False otherwise.
- property carriage_direction: Carriage_Pass_Direction
Returns: Carriage_Pass_Direction: The last direction of movement of the carriage.
- property back_leftmost: int
- Returns:
The leftmost position on the back bed.
- Return type:
Notes
Racking Calculations: * R = F - B * F = R + B * B = F - R.
- property back_rightmost: int
- Returns:
The rightmost position on the back bed.
- Return type:
Notes
Racking Calculations: * R = F - B * F = R + B * B = F - R.
- property width: float
Returns: float: The width of the needle bed element including any rendered labels.
- property height: float
Returns: float: The height of the needle bed element including any rendered labels.
- get_needle_box(needle)[source]
- add_child(child)
Add the given child element as a sub element to this element. :param child: The child element to add. :type child: Visualizer_Element
- add_to_drawing(drawing)
Adds this element to the given svg drawing. :param drawing: The drawing to add. :type drawing: Drawing
- static darken_color(color='none', factor=0.7)
Darken a hex or named color.
- Parameters:
- Returns:
The color-string of the darkened color. If “none” color is given, this will return “black”.
- Return type:
- static fill_from_stroke(stroke, lighten_factor=0.3)
- property global_x: float
Returns: float: The global x coordinate of this element based on its parent’s coordinates.
- global_x_position(x)
- property global_y: float
Returns: float: The global y coordinate of this element based on its parent’s coordinates.
- global_y_position(y)
- static lighten_color(color='none', factor=0.3)
Lighten a hex or named color.
- Parameters:
- Returns:
The color-string of the lightened color. If “none” color is given, this will return “black”.
- Return type:
- property name: str
Returns: str: The unique name of this element. This will match the id of the svg element being wrapped.
- static stroke_from_fill(fill, darken_factor=0.7)