spectral_galerkin_heat.io_utils.gcode_path ========================================== .. py:module:: spectral_galerkin_heat.io_utils.gcode_path .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: spectral_galerkin_heat.io_utils.gcode_path.GCodeLaserPath Module Contents --------------- .. py:class:: GCodeLaserPath(gcode_file, initial_position=(0.0, 0.0)) Bases: :py:obj:`spectral_galerkin_heat.core.laser.LaserPath` Abstract laser trajectory: position and power as a function of time. Implementations return a :class:`LaserState` per time step (consistent units: metres, watts, m/s). Set ``is_on=False`` (or power 0) once the laser leaves the domain. .. rubric:: 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)) .. py:method:: get_state(time, dt) Return the :class:`LaserState` at *time* (called once per time step). :param time: Current simulation time in seconds (monotonically increasing). :type time: float :param dt: Current time-step length in seconds. :type dt: float