gcode_reader.emulate.statistics

Functions

bounds_of_gcode_df(→ tuple | None)

Compute the XYZ bounding box of a G-code DataFrame. For AM-specific bounds, use AdditivePart instead.

gcode_statistics(→ dict)

Quick statistics for any G-code DataFrame. For AM-specific stats (layer count, deposition volume, etc.), use AdditivePart instead.

Module Contents

gcode_reader.emulate.statistics.bounds_of_gcode_df(gcode: pandas.DataFrame, tag=None) tuple | None[source]

Compute the XYZ bounding box of a G-code DataFrame. For AM-specific bounds, use AdditivePart instead.

Parameters:
  • gcode (pd.DataFrame) – G-code DataFrame with absolute position columns.

  • tag (str, optional) – If provided, filter to rows whose tags string contains this tag before computing bounds.

Returns:

((x_min, y_min, z_min), (x_max, y_max, z_max)), or None if position columns are missing.

Return type:

tuple

gcode_reader.emulate.statistics.gcode_statistics(gcode: pandas.DataFrame, flavor: dict = flavors['default'], words: Iterable = None) dict[source]

Quick statistics for any G-code DataFrame. For AM-specific stats (layer count, deposition volume, etc.), use AdditivePart instead.

Parameters:
  • gcode (pd.DataFrame) – Cleaned and tagged G-code DataFrame.

  • flavor (dict, optional) – Syntax definition for G-code. Defaults to flavors[“default”].

  • words (Iterable, optional) – Words (e.g. "G1", ("G", 1)) to count occurrences of. Defaults to [].

Returns:

Statistics including line/word/command counts, positioning mode, units, bounding box, and elapsed time.

Return type:

dict