-
-
Notifications
You must be signed in to change notification settings - Fork 919
Expand file tree
/
Copy pathGcodeTemplateResolver.h
More file actions
31 lines (25 loc) · 1.43 KB
/
GcodeTemplateResolver.h
File metadata and controls
31 lines (25 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2026 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher
#ifndef GCODETEMPLATERESOLVER_H
#define GCODETEMPLATERESOLVER_H
#include <cura-formulae-engine/eval.h>
#include <optional>
#include <string>
#include <unordered_map>
namespace cura::GcodeTemplateResolver
{
/*!
* Resolve a raw GCode template that can contains conditional code and complex formulas
* @param input The raw GCode template text
* @param context_extruder_nr The default contextual extruder number, which should be the current extruder number when dealing when an extruder start/end GCode, and nullopt when
* dealing with the global machine start/end gcode
* @param extra_settings Extra settings to be used locally for the resolving, even though they don't exist as actual settings
* @return The fully resolved GCode template, or the raw template if an error occurred. Also, if the given input is empty, the result will also be fully empty. However, if it
* has some content, the function ensures that the result contains and end-of-line at the end so that it can be inserted directly in a GCode without having to insert one.
*/
std::string resolveGCodeTemplate(
const std::string& input,
const std::optional<int> context_extruder_nr = std::nullopt,
const std::unordered_map<std::string, CuraFormulaeEngine::eval::Value>& extra_settings = {});
} // namespace cura::GcodeTemplateResolver
#endif