# Getting Started ## Installation G-code Reader requires Python 3.10+ and [Poetry](https://python-poetry.org/). ```bash git clone https://gitlab.com/composites-maine-edu/advancing-rapid-prototyping/modeling-and-simulation/gcode-reader.git cd gcode-reader poetry install ``` To also install optional extras (matplotlib, Jupyter, plotly): ```bash poetry install --with extras ``` ## Basic Usage ### Parse to a DataFrame The simplest way to extract G-code data is via a Pandas DataFrame: ```python import gcode_reader as gr df = gr.gcode_file_to_dataframe("my_part.gcode") print(df[["x", "y", "z", "time"]].head()) ``` ### Parse to an Operation Object For machine-aware emulation, use `gcode_to_operation`: ```python import gcode_reader as gr operation = gr.gcode_to_operation("my_part.gcode", machine="cead") # Iterate over individual commands for cmd in operation.commands: print(cmd) ``` ### Specify a Machine Type Pass a machine alias to select machine-specific process emulation: ```python operation = gr.gcode_to_operation("my_part.gcode", machine="cincinnati") ``` List all supported aliases at runtime: ```python machines = gr.list_supported_machines() print(list(machines.keys())) ``` ### Use a Machine Class Directly For more control, instantiate a machine class directly: ```python from gcode_reader.emulate.machines import CEADAMFlexbot machine = CEADAMFlexbot() operation = machine.gcode_file_to_operation("my_part.gcode") ``` ### Parse an Additive Part For additive manufacturing workflows, parse directly to an `AdditivePart`: ```python import gcode_reader as gr part = gr.gcode_to_additive_part("my_part.gcode", machine="juggerbot") ``` ## Reading Individual Lines ```python from gcode_reader import read_gcode_line, read_gcode_file # Parse a single line cmd = read_gcode_line("G1 X10.5 Y20.3 F3000") # Read an entire file into a list of raw lines lines = read_gcode_file("my_part.gcode") ```