Skip to content

Create LayerConfig dataclass to reduce layer parameter sprawl #60

@TravisBumgarner

Description

@TravisBumgarner

Description

Similar to PlotterConfig, the _AbstractLayer.__init__ takes 10 parameters that are repeated in Layer2D/Layer3D. Create a LayerConfig dataclass.

Current Problem

Layer constructors have long parameter lists:

def __init__(
    self,
    plotter_x_min: float,
    plotter_y_min: float,
    plotter_x_max: float,
    plotter_y_max: float,
    feed_rate: float,
    handle_out_of_bounds: THandleOutOfBounds,
    color: Optional[str],
    line_width: float,
    include_comments: bool,
    preview_only: bool = False,
): ...

Proposed Solution

@dataclass  
class LayerConfig:
    plotter_x_min: float
    plotter_x_max: float
    plotter_y_min: float
    plotter_y_max: float
    feed_rate: float
    handle_out_of_bounds: HandleOutOfBounds
    include_comments: bool
    color: Optional[str] = None
    line_width: float = 2.0
    preview_only: bool = False

Acceptance Criteria

  • Create LayerConfig dataclass in config.py
  • Update _AbstractLayer to use the config internally
  • Layer2D and Layer3D use simplified constructors
  • Docstrings reference the config class
  • All existing tests pass

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions