mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-30 05:51:59 +08:00
parent
45c8c3722f
commit
d1f475b476
@ -7,7 +7,7 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <regex>
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <stdlib.h> // provides **_environ
|
#include <stdlib.h> // provides **_environ
|
||||||
#else
|
#else
|
||||||
@ -1502,11 +1502,11 @@ void PlaceholderParser::append_custom_variables(std::map<std::string, std::vecto
|
|||||||
|
|
||||||
bool is_array = nb_extruders > 0;
|
bool is_array = nb_extruders > 0;
|
||||||
if (!is_array) nb_extruders = 1;
|
if (!is_array) nb_extruders = 1;
|
||||||
std::regex is_a_name("[a-zA-Z_]+");
|
SLIC3R_REGEX_NAMESPACE::regex is_a_name("[a-zA-Z_]+");
|
||||||
for (const auto& entry : name2var_array) {
|
for (const auto& entry : name2var_array) {
|
||||||
if (entry.first.empty())
|
if (entry.first.empty())
|
||||||
continue;
|
continue;
|
||||||
if (!std::regex_match(entry.first, is_a_name))
|
if (!SLIC3R_REGEX_NAMESPACE::regex_match(entry.first, is_a_name))
|
||||||
continue;
|
continue;
|
||||||
const std::vector<std::string>& values = entry.second;
|
const std::vector<std::string>& values = entry.second;
|
||||||
//check if all values are empty
|
//check if all values are empty
|
||||||
@ -1555,7 +1555,7 @@ void PlaceholderParser::append_custom_variables(std::map<std::string, std::vecto
|
|||||||
//check if all values are numeric
|
//check if all values are numeric
|
||||||
bool is_not_numeric = !is_not_string || !is_not_bool;
|
bool is_not_numeric = !is_not_string || !is_not_bool;
|
||||||
std::vector<double> double_values;
|
std::vector<double> double_values;
|
||||||
//std::regex("\\s*[+-]?([0-9]+\\.[0-9]*([Ee][+-]?[0-9]+)?|\\.[0-9]+([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)");
|
//SLIC3R_REGEX_NAMESPACE::regex("\\s*[+-]?([0-9]+\\.[0-9]*([Ee][+-]?[0-9]+)?|\\.[0-9]+([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)");
|
||||||
if (!is_not_numeric) {
|
if (!is_not_numeric) {
|
||||||
for (int extruder_id = 0; extruder_id < nb_extruders; ++extruder_id) {
|
for (int extruder_id = 0; extruder_id < nb_extruders; ++extruder_id) {
|
||||||
if (!values[extruder_id].empty()) {
|
if (!values[extruder_id].empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user