mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
Fixed regression bugs regarding print validation,
fixed crashes when loading a config.ini with "compatible_printers" disabled export of "compatible_printers" into gcode and config.ini Enabled compatibility of printing multiple objects with support / no support with a wipe tower.
This commit is contained in:
parent
354408c7e6
commit
ca0626b168
5 changed files with 32 additions and 9 deletions
|
@ -794,6 +794,7 @@ bool GCode::_do_export(Print &print, FILE *file)
|
||||||
for (size_t i = 0; i < sizeof(configs) / sizeof(configs[0]); ++ i) {
|
for (size_t i = 0; i < sizeof(configs) / sizeof(configs[0]); ++ i) {
|
||||||
StaticPrintConfig *cfg = configs[i];
|
StaticPrintConfig *cfg = configs[i];
|
||||||
for (const std::string &key : cfg->keys())
|
for (const std::string &key : cfg->keys())
|
||||||
|
if (key != "compatible_printers")
|
||||||
fprintf(file, "; %s = %s\n", key.c_str(), cfg->serialize(key).c_str());
|
fprintf(file, "; %s = %s\n", key.c_str(), cfg->serialize(key).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ inline bool equal_layering(const SlicingParameters &sp1, const SlicingParameters
|
||||||
sp1.layer_height == sp2.layer_height &&
|
sp1.layer_height == sp2.layer_height &&
|
||||||
sp1.min_layer_height == sp2.min_layer_height &&
|
sp1.min_layer_height == sp2.min_layer_height &&
|
||||||
sp1.max_layer_height == sp2.max_layer_height &&
|
sp1.max_layer_height == sp2.max_layer_height &&
|
||||||
sp1.max_suport_layer_height == sp2.max_suport_layer_height &&
|
// sp1.max_suport_layer_height == sp2.max_suport_layer_height &&
|
||||||
sp1.first_print_layer_height == sp2.first_print_layer_height &&
|
sp1.first_print_layer_height == sp2.first_print_layer_height &&
|
||||||
sp1.first_object_layer_height == sp2.first_object_layer_height &&
|
sp1.first_object_layer_height == sp2.first_object_layer_height &&
|
||||||
sp1.first_object_layer_bridging == sp2.first_object_layer_bridging &&
|
sp1.first_object_layer_bridging == sp2.first_object_layer_bridging &&
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//#undef NDEBUGc
|
//#undef NDEBUG
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "PresetBundle.hpp"
|
#include "PresetBundle.hpp"
|
||||||
|
@ -217,6 +217,8 @@ DynamicPrintConfig PresetBundle::full_config() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.erase("compatible_printers");
|
||||||
|
|
||||||
static const char *keys[] = { "perimeter", "infill", "solid_infill", "support_material", "support_material_interface" };
|
static const char *keys[] = { "perimeter", "infill", "solid_infill", "support_material", "support_material_interface" };
|
||||||
for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++ i) {
|
for (size_t i = 0; i < sizeof(keys) / sizeof(keys[0]); ++ i) {
|
||||||
std::string key = std::string(keys[i]) + "_extruder";
|
std::string key = std::string(keys[i]) + "_extruder";
|
||||||
|
@ -278,8 +280,19 @@ void PresetBundle::load_config_file(const std::string &path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load a config file from a boost property_tree. This is a private method called from load_config_file.
|
// Load a config file from a boost property_tree. This is a private method called from load_config_file.
|
||||||
void PresetBundle::load_config_file_config(const std::string &path, const DynamicPrintConfig &config)
|
void PresetBundle::load_config_file_config(const std::string &path, DynamicPrintConfig &&config)
|
||||||
{
|
{
|
||||||
|
// The "compatible_printers" field should not have been exported into a config.ini or a G-code anyway,
|
||||||
|
// but some of the alpha versions of Slic3r did.
|
||||||
|
{
|
||||||
|
ConfigOption *opt_compatible = config.optptr("compatible_printers");
|
||||||
|
if (opt_compatible != nullptr) {
|
||||||
|
assert(opt_compatible->type() == coStrings);
|
||||||
|
if (opt_compatible->type() == coStrings)
|
||||||
|
static_cast<ConfigOptionStrings*>(opt_compatible)->values.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 1) Create a name from the file name.
|
// 1) Create a name from the file name.
|
||||||
// Keep the suffix (.ini, .gcode, .amf, .3mf etc) to differentiate it from the normal profiles.
|
// Keep the suffix (.ini, .gcode, .amf, .3mf etc) to differentiate it from the normal profiles.
|
||||||
std::string name = boost::filesystem::path(path).filename().string();
|
std::string name = boost::filesystem::path(path).filename().string();
|
||||||
|
@ -310,7 +323,7 @@ void PresetBundle::load_config_file_config(const std::string &path, const Dynami
|
||||||
if (other_opt->is_scalar()) {
|
if (other_opt->is_scalar()) {
|
||||||
for (size_t i = 0; i < configs.size(); ++ i)
|
for (size_t i = 0; i < configs.size(); ++ i)
|
||||||
configs[i].option(key, false)->set(other_opt);
|
configs[i].option(key, false)->set(other_opt);
|
||||||
} else {
|
} else if (key != "compatible_printers") {
|
||||||
for (size_t i = 0; i < configs.size(); ++ i)
|
for (size_t i = 0; i < configs.size(); ++ i)
|
||||||
static_cast<ConfigOptionVectorBase*>(configs[i].option(key, false))->set_at(other_opt, 0, i);
|
static_cast<ConfigOptionVectorBase*>(configs[i].option(key, false))->set_at(other_opt, 0, i);
|
||||||
}
|
}
|
||||||
|
@ -368,6 +381,14 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const
|
||||||
}
|
}
|
||||||
assert(! preset_name_dst.empty());
|
assert(! preset_name_dst.empty());
|
||||||
// Save preset_src->config into collection_dst under preset_name_dst.
|
// Save preset_src->config into collection_dst under preset_name_dst.
|
||||||
|
// The "compatible_printers" field should not have been exported into a config.ini or a G-code anyway,
|
||||||
|
// but some of the alpha versions of Slic3r did.
|
||||||
|
ConfigOption *opt_compatible = preset_src->config.optptr("compatible_printers");
|
||||||
|
if (opt_compatible != nullptr) {
|
||||||
|
assert(opt_compatible->type() == coStrings);
|
||||||
|
if (opt_compatible->type() == coStrings)
|
||||||
|
static_cast<ConfigOptionStrings*>(opt_compatible)->values.clear();
|
||||||
|
}
|
||||||
collection_dst.load_preset(path, preset_name_dst, std::move(preset_src->config), activate).is_external = true;
|
collection_dst.load_preset(path, preset_name_dst, std::move(preset_src->config), activate).is_external = true;
|
||||||
return preset_name_dst;
|
return preset_name_dst;
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
void update_compatible_with_printer(bool select_other_if_incompatible);
|
void update_compatible_with_printer(bool select_other_if_incompatible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void load_config_file_config(const std::string &path, const DynamicPrintConfig &config);
|
void load_config_file_config(const std::string &path, DynamicPrintConfig &&config);
|
||||||
void load_config_file_config_bundle(const std::string &path, const boost::property_tree::ptree &tree);
|
void load_config_file_config_bundle(const std::string &path, const boost::property_tree::ptree &tree);
|
||||||
bool load_compatible_bitmaps();
|
bool load_compatible_bitmaps();
|
||||||
|
|
||||||
|
|
|
@ -215,10 +215,11 @@ _constant()
|
||||||
bool has_infinite_skirt();
|
bool has_infinite_skirt();
|
||||||
bool has_skirt();
|
bool has_skirt();
|
||||||
std::vector<unsigned int> extruders() const;
|
std::vector<unsigned int> extruders() const;
|
||||||
void validate() %code%{
|
int validate() %code%{
|
||||||
std::string err = THIS->validate();
|
std::string err = THIS->validate();
|
||||||
if (! err.empty())
|
if (! err.empty())
|
||||||
throw std::invalid_argument(err.c_str());
|
croak("Configuration is not valid: %s\n", err.c_str());
|
||||||
|
RETVAL = 1;
|
||||||
%};
|
%};
|
||||||
Clone<BoundingBox> bounding_box();
|
Clone<BoundingBox> bounding_box();
|
||||||
Clone<BoundingBox> total_bounding_box();
|
Clone<BoundingBox> total_bounding_box();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue