8746f84fa2
The PlaceholderParser is currently used by the GCode.cpp and by Printer.cpp to generate a new name for the exported G-code or SVG file. The PlaceholderParser::process() will throw a runtime_error with a comprehensive error message. The G-code export will include these error messages into the G-code text with !!!!!! separators, and the GUI will inform the user, that the G-code export failed.
25 lines
606 B
Plaintext
25 lines
606 B
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <xsinit.h>
|
|
#include <vector>
|
|
#include "libslic3r/PlaceholderParser.hpp"
|
|
%}
|
|
|
|
%name{Slic3r::GCode::PlaceholderParser} class PlaceholderParser {
|
|
PlaceholderParser();
|
|
~PlaceholderParser();
|
|
|
|
void apply_config(DynamicPrintConfig *config)
|
|
%code%{ THIS->apply_config(*config); %};
|
|
void set(std::string key, int value);
|
|
std::string process(std::string str) const
|
|
%code%{
|
|
try {
|
|
RETVAL = THIS->process(str, 0);
|
|
} catch (std::exception& e) {
|
|
croak(e.what());
|
|
}
|
|
%};
|
|
};
|