Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MakerBot plugin #5

Merged
merged 91 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
df9b0b5
Add CTRE as dep
jellespijker Oct 16, 2023
03b4512
Add IO utilities for file reading
jellespijker Oct 15, 2023
0a546e7
fix incorrect path io header
jellespijker Oct 16, 2023
4a338f1
Add GCode parsing functionality
jellespijker Oct 16, 2023
cc1eba9
Applied clang-format.
jellespijker Oct 16, 2023
d9a9f28
Refactor G-Code AST classes and added translation functionality
jellespijker Oct 16, 2023
3e43412
Applied clang-format.
jellespijker Oct 16, 2023
a8e0443
Modify code for better traversal of GCode AST
jellespijker Oct 16, 2023
98e0afd
Applied clang-format.
jellespijker Oct 16, 2023
2d9dc21
Revert "Applied clang-format."
jellespijker Oct 17, 2023
01c2c33
Revert "Modify code for better traversal of GCode AST"
jellespijker Oct 17, 2023
1f7a92a
Introduce a universal proto language
jellespijker Oct 17, 2023
d021414
Applied clang-format.
jellespijker Oct 17, 2023
8d36970
improve Gcode parsing
jellespijker Oct 17, 2023
15eb0de
Rename file and enhance parse error messages
jellespijker Oct 18, 2023
94eb3f1
Combine g1 and g2 into one command
casperlamboo Oct 24, 2023
2ddc6c4
Add delay and comment commands
casperlamboo Oct 24, 2023
3681de5
Add ranges dependency
casperlamboo Oct 24, 2023
13dda18
Implement basic translation from gcode ast to command list
casperlamboo Oct 24, 2023
6ebc114
Applied clang-format.
casperlamboo Oct 24, 2023
2e8244e
Fix G92 command
casperlamboo Oct 25, 2023
93a2660
Allow for relative positioning in move command
casperlamboo Oct 25, 2023
19ab560
Use string to locally copy string views
casperlamboo Oct 25, 2023
446baef
Fix parsing floats on mac
casperlamboo Oct 25, 2023
04b9cc6
Applied clang-format.
casperlamboo Oct 25, 2023
8dc6295
Disable comments
casperlamboo Oct 25, 2023
8d1307a
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 25, 2023
4a0aaef
Also write to json in example code
casperlamboo Oct 25, 2023
d51d1dc
Fix write file ultilty
casperlamboo Oct 25, 2023
574de0e
Applied clang-format.
casperlamboo Oct 25, 2023
55e4da0
Add tags to move commands
casperlamboo Oct 25, 2023
394c803
Applied clang-format.
casperlamboo Oct 25, 2023
71d55e2
Add support io support to pyDulcificum
jellespijker Oct 26, 2023
e1f75c4
Add translation functionality to pyDulcificum
jellespijker Oct 26, 2023
2dc556a
Add translation functionality to pyDulcificum
jellespijker Oct 26, 2023
4e93fde
Add nlohmann/json_fwd and string includes to dulcificum.h
jellespijker Oct 26, 2023
e9989f7
Build CPython shared when compiling with msvc
jellespijker Oct 26, 2023
590d833
Fix function decleration
jellespijker Oct 26, 2023
758571c
Package the Python module and library
jellespijker Oct 26, 2023
9113cb6
Refactor testing condition in conanfile.py
jellespijker Oct 27, 2023
9852b72
Add LayerChange command
casperlamboo Oct 27, 2023
8efce15
Applied clang-format.
casperlamboo Oct 27, 2023
2ac9973
Map layer change to comment
casperlamboo Oct 27, 2023
01f73f3
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 27, 2023
ad56e31
Print each line on seperate line
casperlamboo Oct 27, 2023
b4444b6
Applied clang-format.
casperlamboo Oct 27, 2023
5838f06
Fix printing gcode on different lines
casperlamboo Oct 27, 2023
ec1b28f
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 27, 2023
39291fe
Applied clang-format.
casperlamboo Oct 27, 2023
235b548
Fix printing gcode on different lines
casperlamboo Oct 27, 2023
00067e2
Applied clang-format.
casperlamboo Oct 27, 2023
d6eeab6
Fix editablemode
casperlamboo Oct 27, 2023
93827ed
Multiple package fixes
jellespijker Oct 27, 2023
5b2c9b1
fix typo
jellespijker Oct 27, 2023
809f42e
Fixed multiple compiler clang-tidy warnings
jellespijker Oct 28, 2023
16e6cd7
Refactor gcode_to_command.cpp for modular code
jellespijker Oct 28, 2023
47874f4
Move declaration of VisitCommand out of cpp
jellespijker Oct 28, 2023
9dc5c92
Fixed GCC-13 compiler crash
jellespijker Oct 28, 2023
158f75c
Allow for shared libs on Windows
jellespijker Oct 28, 2023
2197857
No `constexpr`
jellespijker Oct 28, 2023
b2e8a6e
No need to link directly with cpython
jellespijker Oct 28, 2023
6afeaea
Also run workflow when pyDulcificum is changed
jellespijker Oct 28, 2023
8e057bd
Return protopath in toCommand fn
casperlamboo Oct 29, 2023
01a5f9a
Add support for `T`, `Layer` and `Comment` commands in to proto
casperlamboo Oct 29, 2023
3070271
Revert "Allow for shared libs on Windows"
jellespijker Oct 29, 2023
3711f75
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 29, 2023
3c52e38
package pyd
jellespijker Oct 29, 2023
12df764
Use correct unit
casperlamboo Oct 29, 2023
a9c9136
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 29, 2023
84c77ab
Applied clang-format.
casperlamboo Oct 29, 2023
1c32f66
use cpp comment
jellespijker Oct 29, 2023
a8328c0
Set temperature commands in integers
casperlamboo Oct 29, 2023
079c573
Applied clang-format.
casperlamboo Oct 29, 2023
8b0921a
Offset negative raft layer index
jellespijker Oct 29, 2023
01648f8
Applied clang-format.
jellespijker Oct 29, 2023
d7182d8
Set temperature of correct target
casperlamboo Oct 29, 2023
e70fe1d
Update value extraction from optional command parameters
jellespijker Oct 29, 2023
45001ab
Add initial temperature to protopath
casperlamboo Oct 29, 2023
1ff1164
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 29, 2023
f73ad27
Refactor command naming for clearer code readability
jellespijker Oct 29, 2023
048b151
Set temperature of correct tool
casperlamboo Oct 29, 2023
ed12e00
Wait for temperature
casperlamboo Oct 29, 2023
3c9e886
Parsing the P index for Fan
jellespijker Oct 30, 2023
a830455
Allow for P parameter for M106 and M107
jellespijker Oct 30, 2023
76c942c
Applied clang-format.
jellespijker Oct 30, 2023
99b1842
Use rel E and store origins
jellespijker Oct 31, 2023
480a555
Applied clang-format.
jellespijker Oct 31, 2023
3f55bf0
Fix bug where temp was updating wrong extruder
casperlamboo Oct 31, 2023
8ddd06f
Get tool from command
casperlamboo Oct 31, 2023
d755576
Merge remote-tracking branch 'origin/CURA-10561_regex_gcode_parser' i…
casperlamboo Oct 31, 2023
46917cf
Fix error
casperlamboo Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,28 @@ message(STATUS "Configuring Dulcificum version: ${DULCIFICUM_VERSION}")
find_package(nlohmann_json REQUIRED)
find_package(spdlog REQUIRED)
find_package(range-v3 REQUIRED)
find_package(ctre REQUIRED)

# --- Setup the shared C++ mgjtp library ---
set(DULCIFICUM_SRC
src/command_types.cpp
src/gcode/ast/ast.cpp
src/gcode/ast/entries.cpp
src/gcode/parse.cpp

src/miracle_jtp/mgjtp_command_to_json.cpp
src/miracle_jtp/mgjtp_json_to_command.cpp

src/gcode/gcode_to_command.cpp

src/utils/io.cpp
src/utils/svtod.cpp
src/command_types.cpp
)
add_library(dulcificum ${DULCIFICUM_SRC})
target_link_libraries(dulcificum
PUBLIC
nlohmann_json::nlohmann_json
ctre::ctre
PRIVATE
range-v3::range-v3
spdlog::spdlog)
Expand Down
30 changes: 28 additions & 2 deletions apps/translator_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,33 @@
#include <spdlog/spdlog.h>

#include <docopt/docopt.h>
#include <dulcificum/gcode/parse.h>
#include <dulcificum/miracle_jtp/mgjtp_command_to_json.h>
#include <dulcificum/gcode/gcode_to_command.h>
#include <dulcificum/utils/io.h>
#include <map>

#include <nlohmann/json.hpp>

template<typename... Ts>
struct Overload : Ts...
{
using Ts::operator()...;
};
template<class... Ts>
Overload(Ts...) -> Overload<Ts...>;
casperlamboo marked this conversation as resolved.
Show resolved Hide resolved

int main(int argc, const char** argv)
{
constexpr bool show_help = true;
const std::map<std::string, docopt::value> args
= docopt::docopt(fmt::format(apps::cmdline::USAGE, apps::cmdline::NAME), { argv + 1, argv + argc }, show_help, apps::cmdline::VERSION_ID);

if (args.contains("--quiet"))
if (args.at("--quiet").asBool())
{
spdlog::set_level(spdlog::level::err);
}
else if (args.contains("--verbose"))
else if (args.at("--verbose").asBool())
{
spdlog::set_level(spdlog::level::debug);
}
Expand All @@ -24,4 +38,16 @@ int main(int argc, const char** argv)
spdlog::set_level(spdlog::level::info);
}
spdlog::info("Tasting the menu");

auto input{ dulcificum::utils::readFile(args.at("INPUT").asString()).value() };
auto gcode_ast = dulcificum::gcode::parse(input);
auto command_list = dulcificum::gcode::toCommand(gcode_ast);

auto json_commands = nlohmann::json::array();
for (const auto& command: command_list)
{
json_commands.emplace_back(dulcificum::miracle_jtp::toJson(*command));
}

auto x = 1;
}
2 changes: 2 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def requirements(self):
self.requires("nlohmann_json/3.11.2", transitive_headers = True)
self.requires("range-v3/0.12.0")
self.requires("spdlog/1.10.0")
self.requires("ctre/3.7.2")
self.requires("range-v3/0.12.0")
casperlamboo marked this conversation as resolved.
Show resolved Hide resolved
if self.options.with_apps:
self.requires("docopt.cpp/0.6.3")
if self.options.with_python_bindings:
Expand Down
6 changes: 3 additions & 3 deletions include/dulcificum/command_types.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DULCIFICUM_COMMAND_TYPES_H
#define DULCIFICUM_COMMAND_TYPES_H
#ifndef INCLUDE_DULCIFICUM_COMMAND_TYPES_H
#define INCLUDE_DULCIFICUM_COMMAND_TYPES_H

#include <cmath>
#include <memory>
Expand Down Expand Up @@ -153,4 +153,4 @@ CommandPtr spawnCommandPtr(const CommandType& type) noexcept;
} // namespace botcmd
} // namespace dulcificum

#endif // DULCIFICUM_COMMAND_TYPES_H
#endif // INCLUDE_DULCIFICUM_COMMAND_TYPES_H
45 changes: 45 additions & 0 deletions include/dulcificum/gcode/ast/acceleration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef INCLUDE_DULCIFICUM_GCODE_AST_ACCELERATION_H
#define INCLUDE_DULCIFICUM_GCODE_AST_ACCELERATION_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AST?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstract Syntax Tree, Although this tree basically consist of a single trunk

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ahahaha that wouldn't have occured to me. TAC (Threeletter Acronyms Confuse) :P


#include "dulcificum/gcode/ast/entry.h"

#include <optional>

namespace dulcificum::gcode::ast
{
/*!
* /brief Set the starting acceleration for moves by type.
* P = Printing acceleration. Used for moves that include extrusion
* T = Travel acceleration. Used for moves that include no extrusion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about S ?

*/
class M204 : public Entry<R"(M204((?:\sP(?<P>\d+(?:\.\d+)?))|(?:\sT(?<T>\d+(?:\.\d+)?))|(?:\sS(?<S>\d+(?:\.\d+)?)))*$)">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of M204 is public and non-virtual

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra capture group that takes the last parameter occurence, and can be removed for faster processing

Suggested change
class M204 : public Entry<R"(M204((?:\sP(?<P>\d+(?:\.\d+)?))|(?:\sT(?<T>\d+(?:\.\d+)?))|(?:\sS(?<S>\d+(?:\.\d+)?)))*$)">
class M204 : public Entry<R"(M204(?:(?:\sP(?<P>\d+(?:\.\d+)?))|(?:\sT(?<T>\d+(?:\.\d+)?))|(?:\sS(?<S>\d+(?:\.\d+)?)))*$)">

I guess it is the same for all REs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This RE matches something likeM204 P1 P4, is it on prupose ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise ordering of the parameters would be enforced. Now it doesn't matter if we write

M204 S1 P1

or

M204 S1 P1

{
public:
M204() = delete;
M204(size_t index, std::string line);
std::optional<double> P;
std::optional<double> T;
std::optional<double> S;
};

/*!
* /brief Set various motion settings.
* X = X max jerk (units/s)
* Y = Y max jerk (units/s)
* Z = Z max jerk (units/s)
* E = E max jerk (units/s)
*/
class M205 : public Entry<R"(M205((?:\sX(?<X>-?\d+(?:\.\d+)?))|(?:\sY(?<Y>-?\d+(?:\.\d+)?))|(?:\sZ(?<Z>-?\d+(?:\.\d+)?))|(?:\sE(?<E>-?\d+(?:\.\d+)?)))*$)">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of M205 is public and non-virtual

{
public:
M205() = delete;
M205(size_t index, std::string line);
std::optional<double> X;
std::optional<double> Y;
std::optional<double> Z;
std::optional<double> E;
};

} // namespace dulcificum::gcode::ast

#endif // INCLUDE_DULCIFICUM_GCODE_AST_ACCELERATION_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having one class per header is usually good practice

59 changes: 59 additions & 0 deletions include/dulcificum/gcode/ast/ast.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does AST stand for ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstract Syntax Tree

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#ifndef INCLUDE_DULCIFICUM_GCODE_AST_AST_H
#define INCLUDE_DULCIFICUM_GCODE_AST_AST_H

#include "dulcificum/gcode/ast/acceleration.h"
#include "dulcificum/gcode/ast/bed_temperature.h"
#include "dulcificum/gcode/ast/comment_commands.h"
#include "dulcificum/gcode/ast/delay.h"
#include "dulcificum/gcode/ast/entry.h"
#include "dulcificum/gcode/ast/extruder_temperature.h"
#include "dulcificum/gcode/ast/fan.h"
#include "dulcificum/gcode/ast/position.h"
#include "dulcificum/gcode/ast/positioning_mode.h"
#include "dulcificum/gcode/ast/purge.h"
#include "dulcificum/gcode/ast/toolchange.h"
#include "dulcificum/gcode/ast/translate.h"

#include <cstddef>
#include <string>
#include <variant>
#include <vector>

namespace dulcificum::gcode::ast
{

using Unknown = Entry<R"((.*))">;

using node_t = std::variant<
G0_G1,
G4,
G90,
G91,
G92,
G280,
M82,
M83,
M104,
M106,
M107,
M109,
M140,
M190,
M204,
M205,
Layer,
Mesh,
FeatureType,
InitialTemperatureExtruder,
InitialTemperatureBuildPlate,
BuildVolumeTemperature,
Comment,
T,
Unknown>;
using ast_t = std::vector<node_t>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is definitely not explicit...


node_t factory(size_t index, const std::string& line);

} // namespace dulcificum::gcode::ast

#endif // INCLUDE_DULCIFICUM_GCODE_AST_AST_H
37 changes: 37 additions & 0 deletions include/dulcificum/gcode/ast/bed_temperature.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef INCLUDE_DULCIFICUM_GCODE_AST_BED_TEMPERATURE_H
#define INCLUDE_DULCIFICUM_GCODE_AST_BED_TEMPERATURE_H

#include "dulcificum/gcode/ast/entry.h"

#include <optional>

namespace dulcificum::gcode::ast
{
/*!
* /brief Set a new target bed temperature (non-blocking).
* S = Target temperature
*/
class M140 : public Entry<R"(M140((?:\sS(?<S>\d+(?:\.\d+)?)))*$)">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of M140 is public and non-virtual

{
public:
M140() = delete;
M140(size_t index, std::string line);
std::optional<double> S;
};

/*!
* /brief Wait for the bed to reach target temperature (blocking).
* R = Target temperature (wait for cooling or heating).
* S = Target temperature (wait only when heating)
*/
class M190 : public Entry<R"(M190((?:\sS(?<S>\d+(?:\.\d+)?))|(?:\sR(?<R>\d+(?:\.\d+)?)))*$)">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of M190 is public and non-virtual

{
public:
M190() = delete;
M190(size_t index, std::string line);
std::optional<double> S;
std::optional<double> R;
};
} // namespace dulcificum::gcode::ast

#endif // INCLUDE_DULCIFICUM_GCODE_AST_BED_TEMPERATURE_H
99 changes: 99 additions & 0 deletions include/dulcificum/gcode/ast/comment_commands.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#ifndef INCLUDE_DULCIFICUM_GCODE_AST_COMMENT_COMMANDS_H
#define INCLUDE_DULCIFICUM_GCODE_AST_COMMENT_COMMANDS_H

#include "dulcificum/gcode/ast/entry.h"

#include <optional>

namespace dulcificum::gcode::ast
{
/*!
* /brief The layer index
* L = index
*/
class Layer : public Entry<R"(;LAYER:(?<L>-?\d+))">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of Layer is public and non-virtual

{
public:
Layer() = delete;
Layer(size_t index, std::string line);
std::optional<size_t> L;
};

/*!
* /brief The mesh name
* M = mesh name
*/
class Mesh : public Entry<R"(;MESH:(?<M>.*))">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of Mesh is public and non-virtual

{
public:
Mesh() = delete;
Mesh(size_t index, std::string line);
std::optional<std::string_view> M;
};

/*!
* /brief Feature type
* T = feature type (WALL-OUTER, WALL_INNER, SKIN, SUPPORT, SKIRT, FILL, SUPPORT-INTERFACE, PRIME_TOWER)
*/
class FeatureType : public Entry<R"(;TYPE:(?<T>.*))">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of FeatureType is public and non-virtual

{
public:
FeatureType() = delete;
FeatureType(size_t index, std::string line);
std::optional<std::string_view> T;
};

/*!
* /brief Initial extruder temperature
* T = tool index
* S = Temperature
*/
class InitialTemperatureExtruder : public Entry<R"(;EXTRUDER_TRAIN\.(?<T>\d)\.INITIAL_TEMPERATURE:(?<S>([\d|\.]*)))">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of InitialTemperatureExtruder is public and non-virtual

{
public:
InitialTemperatureExtruder() = delete;
InitialTemperatureExtruder(size_t index, std::string line);
std::optional<size_t> T;
std::optional<double> S;
};

/*!
* /brief Initial build plate temperature
* S = Temperature
*/
class InitialTemperatureBuildPlate : public Entry<R"(;BUILD_PLATE.INITIAL_TEMPERATURE:(?<S>([\d|\.]*)))">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of InitialTemperatureBuildPlate is public and non-virtual

{
public:
InitialTemperatureBuildPlate() = delete;
InitialTemperatureBuildPlate(size_t index, std::string line);
std::optional<double> S;
};

/*!
* /brief Initial build volume temperature
* S = Temperature
*/
class BuildVolumeTemperature : public Entry<R"(;BUILD_VOLUME.TEMPERATURE:(?<S>([\d|\.]*)))">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ cppcoreguidelines-virtual-class-destructor ⚠️
destructor of BuildVolumeTemperature is public and non-virtual

{
public:
BuildVolumeTemperature() = delete;
BuildVolumeTemperature(size_t index, std::string line);
std::optional<double> S;
};

/*!
* /brief A generic comment
* comment = The text of the comment
*/
class Comment : public Entry<R"(;(?<C>\.*))">
{
public:
Comment() = delete;
Comment(size_t index, std::string line);
std::string C;
};


} // namespace dulcificum::gcode::ast

#endif // INCLUDE_DULCIFICUM_GCODE_AST_COMMENT_COMMANDS_H
22 changes: 22 additions & 0 deletions include/dulcificum/gcode/ast/delay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef DULCIFICUM_DELAY_H
#define DULCIFICUM_DELAY_H

#include "dulcificum/gcode/ast/entry.h"

namespace dulcificum::gcode::ast
{
/*!
* /brief Dwell, or delay, for the specified time
casperlamboo marked this conversation as resolved.
Show resolved Hide resolved
*/
class G4 : public Entry<R"(G4((?:\sS(?<S>\d+(?:\.\d+)?))|(?:\sP(?<P>\d+(?:\.\d+)?)))*$)">
{
public:
G4() = delete;
G4(size_t index, std::string line);
std::optional<double> S;
casperlamboo marked this conversation as resolved.
Show resolved Hide resolved
std::optional<double> P;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ clang-diagnostic-error ⚠️
no template named optional in namespace std; did you mean ctre::optional?

Suggested change
std::optional<double> P;
ctre::optional<double> P;

};
} // namespace dulcificum::gcode::ast


#endif // DULCIFICUM_DELAY_H
Loading