OOFEM 3.0
Loading...
Searching...
No Matches
GCodeParser Class Reference

The GCodeParser class is used to parse G-code files. More...

#include <GCodeParser.h>

Public Member Functions

std::vector< GCodeCommandparseFile (const std::string &filename)
 Parses a file and returns a vector of GCodeCommand objects.

Private Member Functions

void removeComments (std::string &line)
 Removes comments from a line of G-code.
GCodeCommand parseLine (const std::string &line)
 Parses a line of G-code and returns a GCodeCommand object.

Detailed Description

The GCodeParser class is used to parse G-code files.

Definition at line 15 of file GCodeParser.h.

Member Function Documentation

◆ parseFile()

std::vector< GCodeCommand > GCodeParser::parseFile ( const std::string & filename)
inline

Parses a file and returns a vector of GCodeCommand objects.

Parameters
filenameThe name of the file to parse.
Returns
A vector of GCodeCommand objects representing the parsed G-code commands.

Definition at line 23 of file GCodeParser.h.

References parseLine(), and removeComments().

Referenced by oofem::AdditiveManufacturingProblem::initializeFrom().

◆ parseLine()

GCodeCommand GCodeParser::parseLine ( const std::string & line)
inlineprivate

Parses a line of G-code and returns a GCodeCommand object.

Parameters
lineThe line of G-code to parse.
Returns
A GCodeCommand object representing the parsed G-code command.

Definition at line 69 of file GCodeParser.h.

References GCodeCommand::addParameter(), and GCodeCommand::setCode().

Referenced by parseFile().

◆ removeComments()

void GCodeParser::removeComments ( std::string & line)
inlineprivate

Removes comments from a line of G-code.

Parameters
lineThe line of G-code to remove comments from.

Definition at line 55 of file GCodeParser.h.

Referenced by parseFile().


The documentation for this class was generated from the following file:

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011