gcode_read — PRINTPATH gcode op

• Data kinds: text → table

• Call: import fullseye as fs; fs.ledger.gcode_read(path: 'str', layer_from: 'str' = 'auto') -> 'dict[str, np.ndarray]' (to call the implementation directly, import printpath; printpath.gcode_read(path: 'str', layer_from: 'str' = 'auto') -> 'dict[str, np.ndarray]'; from the registry, opsprintpath.get("gcode_read"))

Usage

Reads G-code (RepRap / Marlin family) into a table of line segments table: columns x0 y0 z0 x1 y1 z1 (mm), e (filament length extruded on that segment in mm, 0 for a travel-only move), f (feed rate mm/min), layer (layer number).

Interpreted are G0 / G1 (linear moves), G90 / G91 (absolute / relative coordinates), M82 / M83 (absolute / relative E), G92 (coordinate reset), G28 (homing: puts the given axes -- if none given, all of X/Y/Z -- at 0. Marlin's default min endstop and home offset 0 are assumed, so machines homing on the max side must supply coordinates with G92 right afterwards), G20 / G21 (inch / mm), and ; comments. A G91 relative move leaves the position undetermined on axes whose start point is undetermined (a relative amount is not read as an absolute coordinate). Arcs G2 / G3 are not handled (ValueError instead of silently making a straight line -- expand them into straight lines in the slicer before output). Layers are cut at ;LAYER:n comments with layer_from="tag", or with "z" at increases of Z accompanied by extrusion. "auto" uses tags if present, otherwise Z. A line that extrudes before any coordinate has ever been given raises ValueError (gaps in a dialect are not silently filled with 0).

>>> t = gcode_read("part.gcode")

>>> t["e"].sum() # total length of extruded filament [mm]

Detailed usage guide

• printpath family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_print_layer_inspection — py -3.11 examples/poc_print_layer_inspection.py

Ops the type connects to (they accept table as input)

gcode_write · gcode_extrusion_volume · gcode_time_estimate · gcode_layer_image · contours_to_gcode

Same category (gcode)

gcode_write · gcode_extrusion_volume · gcode_time_estimate · gcode_layer_image


*Provenance: printpath.py — PRINTPATH operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.