spectral_galerkin_heat.io_utils.gcode_path
G-code parser for laser path extraction.
This module implements a lightweight G-code interpreter that extracts linear segments, timing, and laser power commands and exposes them via the GCodeLaserPath implementation of LaserPath.
Classes
Abstract laser trajectory: position and power as a function of time. |
Module Contents
- class spectral_galerkin_heat.io_utils.gcode_path.GCodeLaserPath(gcode_file, initial_position=(0.0, 0.0))
Bases:
spectral_galerkin_heat.core.laser.LaserPathAbstract laser trajectory: position and power as a function of time.
Implementations return a
LaserStateper time step (consistent units: metres, watts, m/s). Setis_on=False(or power 0) once the laser leaves the domain.Example
>>> class ConstantVelocityLaser(LaserPath): ... def __init__(self, x0, y0, vx, power): ... self.x0, self.y0, self.vx, self.power = x0, y0, vx, power ... def get_state(self, time, dt): ... return LaserState(self.x0 + self.vx * time, self.y0, ... self.power, is_on=True, v=(self.vx, 0.0))
- Parameters:
gcode_file (str)
- get_state(time, dt)
Return the
LaserStateat time (called once per time step).- Parameters:
time (float) – Current simulation time in seconds (monotonically increasing).
dt (float) – Current time-step length in seconds.
- Return type: