gcode_reader.emulate.tools

Classes

MillingTool

A subtractive tool, such as a CNC mill, controlled by a spindle speed.

Tool

A base class representing a generic tool on a manufacturing machine.

Module Contents

class gcode_reader.emulate.tools.MillingTool(options, diameter: float = 1.0)[source]

Bases: Tool

A subtractive tool, such as a CNC mill, controlled by a spindle speed.

spindle_speed

The current rotational speed of the spindle in RPM.

Type:

float

diameter

The diameter of the milling tool.

Type:

float

Initializes a new Tool instance.

Parameters:

options (MachineOptions) – An instance of the MachineOptions class containing machine and tool configuration.

process_command(command: gcode_reader.emulate.commands.Command, process_data: gcode_reader.emulate.operations.SubtractiveProcessData)[source]

Propagates spindle speed into process_data on every command.

Updates self.spindle_speed if a Mill command provides an explicit speed, then writes the current speed to process_data whenever the spindle is on.

Parameters:
Returns:

The updated SubtractiveProcessData object.

diameter = 1.0
spindle_speed = 0.0
class gcode_reader.emulate.tools.Tool(options: gcode_reader.emulate.machine_options.MachineOptions = None)[source]

A base class representing a generic tool on a manufacturing machine.

This class manages the tool’s fundamental state. It provides a common interface for processing commands and can be extended by specific tool types.

on

Indicates if the tool is currently active.

Type:

bool

options

Configuration options for the machine and tool.

Type:

MachineOptions

Initializes a new Tool instance.

Parameters:

options (MachineOptions) – An instance of the MachineOptions class containing machine and tool configuration.

process_command(command: gcode_reader.emulate.commands.Command, process_data: gcode_reader.emulate.operations.ProcessData)[source]

Processes a command to update the tool’s state and record data.

Subclasses should extend this to handle tool-specific command attributes (e.g. spindle speed, extrusion volume). Tool direction is tracked by the machine via _tool_rotate and does not need to be set here.

Parameters:
  • command (Command) – The command to be processed.

  • process_data (ProcessData) – The data object to populate with post-processing information.

Returns:

The updated ProcessData object.

reset_history()[source]
on = True
property options