ENH: add check logic of filament_map when Print::Apply
Change-Id: Ibab353c4b16183611d63d75bcdf5f370cb578f21
This commit is contained in:
parent
e9081ba8d4
commit
bbc4d701bf
|
@ -2279,6 +2279,7 @@ DynamicPrintConfig PresetBundle::full_fff_config(bool apply_extruder, std::vecto
|
||||||
//BBS: add logic for settings check between different system presets
|
//BBS: add logic for settings check between different system presets
|
||||||
add_if_some_non_empty(std::move(different_settings), "different_settings_to_system");
|
add_if_some_non_empty(std::move(different_settings), "different_settings_to_system");
|
||||||
add_if_some_non_empty(std::move(print_compatible_printers), "print_compatible_printers");
|
add_if_some_non_empty(std::move(print_compatible_printers), "print_compatible_printers");
|
||||||
|
out.option<ConfigOptionInts>("extruder_filament_count", true)->values = this->extruder_filament_counts;
|
||||||
|
|
||||||
out.option<ConfigOptionEnumGeneric>("printer_technology", true)->value = ptFFF;
|
out.option<ConfigOptionEnumGeneric>("printer_technology", true)->value = ptFFF;
|
||||||
return out;
|
return out;
|
||||||
|
@ -2496,6 +2497,11 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//no need to parse extruder_filament_count
|
||||||
|
std::vector<int> extruder_filament_count = std::move(config.option<ConfigOptionInts>("extruder_filament_count", true)->values);
|
||||||
|
config.erase("extruder_filament_count");
|
||||||
|
if (this->extruder_filament_counts.empty())
|
||||||
|
this->extruder_filament_counts = extruder_filament_count;
|
||||||
|
|
||||||
// 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.
|
||||||
|
|
|
@ -127,7 +127,7 @@ public:
|
||||||
std::vector<std::vector<std::string>> ams_multi_color_filment;
|
std::vector<std::vector<std::string>> ams_multi_color_filment;
|
||||||
|
|
||||||
// todo multi_extruders: delete mutable
|
// todo multi_extruders: delete mutable
|
||||||
mutable std::vector<int> filament_maps;
|
mutable std::vector<int> extruder_filament_counts;
|
||||||
// Calibrate
|
// Calibrate
|
||||||
Preset const * calibrate_printer = nullptr;
|
Preset const * calibrate_printer = nullptr;
|
||||||
std::set<Preset const *> calibrate_filaments;
|
std::set<Preset const *> calibrate_filaments;
|
||||||
|
|
|
@ -244,6 +244,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||||
|| opt_key == "first_layer_print_sequence"
|
|| opt_key == "first_layer_print_sequence"
|
||||||
|| opt_key == "other_layers_print_sequence"
|
|| opt_key == "other_layers_print_sequence"
|
||||||
|| opt_key == "other_layers_print_sequence_nums"
|
|| opt_key == "other_layers_print_sequence_nums"
|
||||||
|
|| opt_key == "extruder_filament_count"
|
||||||
|
|| opt_key == "filament_map_mode"
|
||||||
|
|| opt_key == "filament_map"
|
||||||
//|| opt_key == "wipe_tower_bridging"
|
//|| opt_key == "wipe_tower_bridging"
|
||||||
|| opt_key == "wipe_tower_no_sparse_layers"
|
|| opt_key == "wipe_tower_no_sparse_layers"
|
||||||
|| opt_key == "flush_volumes_matrix"
|
|| opt_key == "flush_volumes_matrix"
|
||||||
|
@ -2306,6 +2309,19 @@ void Print::finalize_first_layer_convex_hull()
|
||||||
m_first_layer_convex_hull = Geometry::convex_hull(m_first_layer_convex_hull.points);
|
m_first_layer_convex_hull = Geometry::convex_hull(m_first_layer_convex_hull.points);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Print::update_filament_maps_to_config(std::vector<int> f_maps)
|
||||||
|
{
|
||||||
|
std::vector<int>& filament_maps = m_full_print_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||||
|
|
||||||
|
filament_maps = f_maps;
|
||||||
|
m_config.filament_map.values = f_maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> Print::get_filament_maps() const
|
||||||
|
{
|
||||||
|
return m_config.filament_map.values;
|
||||||
|
}
|
||||||
|
|
||||||
// Wipe tower support.
|
// Wipe tower support.
|
||||||
bool Print::has_wipe_tower() const
|
bool Print::has_wipe_tower() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -805,6 +805,9 @@ public:
|
||||||
const WipeTowerData& wipe_tower_data(size_t filaments_cnt = 0) const;
|
const WipeTowerData& wipe_tower_data(size_t filaments_cnt = 0) const;
|
||||||
const ToolOrdering& tool_ordering() const { return m_tool_ordering; }
|
const ToolOrdering& tool_ordering() const { return m_tool_ordering; }
|
||||||
|
|
||||||
|
void update_filament_maps_to_config(std::vector<int> f_maps);
|
||||||
|
std::vector<int> get_filament_maps() const;
|
||||||
|
|
||||||
bool enable_timelapse_print() const;
|
bool enable_timelapse_print() const;
|
||||||
|
|
||||||
std::string output_filename(const std::string &filename_base = std::string()) const override;
|
std::string output_filename(const std::string &filename_base = std::string()) const override;
|
||||||
|
|
|
@ -1028,12 +1028,14 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
new_full_config.option("print_settings_id", true);
|
new_full_config.option("print_settings_id", true);
|
||||||
new_full_config.option("filament_settings_id", true);
|
new_full_config.option("filament_settings_id", true);
|
||||||
new_full_config.option("printer_settings_id", true);
|
new_full_config.option("printer_settings_id", true);
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
int used_filaments = this->extruders(true).size();
|
std::vector <unsigned int> used_filaments = this->extruders(true);
|
||||||
|
std::unordered_set <unsigned int> used_filament_set(used_filaments.begin(), used_filaments.end());
|
||||||
|
|
||||||
//new_full_config.normalize_fdm(used_filaments);
|
//new_full_config.normalize_fdm(used_filaments);
|
||||||
new_full_config.normalize_fdm_1();
|
new_full_config.normalize_fdm_1();
|
||||||
t_config_option_keys changed_keys = new_full_config.normalize_fdm_2(objects().size(), used_filaments);
|
t_config_option_keys changed_keys = new_full_config.normalize_fdm_2(objects().size(), used_filaments.size());
|
||||||
if (changed_keys.size() > 0) {
|
if (changed_keys.size() > 0) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got changed_keys, size=%1%")%changed_keys.size();
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", got changed_keys, size=%1%")%changed_keys.size();
|
||||||
for (int i = 0; i < changed_keys.size(); i++)
|
for (int i = 0; i < changed_keys.size(); i++)
|
||||||
|
@ -1114,6 +1116,40 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
t_config_option_keys object_diff = m_default_object_config.diff(new_full_config);
|
t_config_option_keys object_diff = m_default_object_config.diff(new_full_config);
|
||||||
t_config_option_keys region_diff = m_default_region_config.diff(new_full_config);
|
t_config_option_keys region_diff = m_default_region_config.diff(new_full_config);
|
||||||
|
|
||||||
|
//BBS: process the filament_map related logic
|
||||||
|
std::unordered_set<std::string> print_diff_set(print_diff.begin(), print_diff.end());
|
||||||
|
if (print_diff_set.find("filament_map_mode") == print_diff_set.end())
|
||||||
|
{
|
||||||
|
FilamentMapMode map_mode = new_full_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value;
|
||||||
|
if (map_mode == fmmAuto) {
|
||||||
|
print_diff_set.erase("filament_map");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print_diff_set.erase("extruder_filament_count");
|
||||||
|
std::vector<int> old_filament_map = m_config.filament_map.values;
|
||||||
|
std::vector<int> new_filament_map = new_full_config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||||
|
|
||||||
|
if (old_filament_map.size() == new_filament_map.size())
|
||||||
|
{
|
||||||
|
bool same_map = true;
|
||||||
|
for (size_t index = 0; index < old_filament_map.size(); index++)
|
||||||
|
{
|
||||||
|
if ((old_filament_map[index] == new_filament_map[index])
|
||||||
|
|| (used_filament_set.find(index + 1) == used_filament_set.end()))
|
||||||
|
continue;
|
||||||
|
else {
|
||||||
|
same_map = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (same_map)
|
||||||
|
print_diff_set.erase("filament_map");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (print_diff_set.size() != print_diff.size())
|
||||||
|
print_diff.assign(print_diff_set.begin(), print_diff_set.end());
|
||||||
|
}
|
||||||
|
|
||||||
// Do not use the ApplyStatus as we will use the max function when updating apply_status.
|
// Do not use the ApplyStatus as we will use the max function when updating apply_status.
|
||||||
unsigned int apply_status = APPLY_STATUS_UNCHANGED;
|
unsigned int apply_status = APPLY_STATUS_UNCHANGED;
|
||||||
auto update_apply_status = [&apply_status](bool invalidated)
|
auto update_apply_status = [&apply_status](bool invalidated)
|
||||||
|
|
|
@ -3019,6 +3019,12 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionStrings { "Direct Drive Normal" });
|
def->set_default_value(new ConfigOptionStrings { "Direct Drive Normal" });
|
||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
|
||||||
|
def = this->add("extruder_filament_count", coInts);
|
||||||
|
def->label = "Extruder filament count";
|
||||||
|
def->tooltip = "Filament counts per extruder";
|
||||||
|
def->set_default_value(new ConfigOptionInts { 1 });
|
||||||
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
|
||||||
def = this->add("printer_extruder_id", coInts);
|
def = this->add("printer_extruder_id", coInts);
|
||||||
def->label = "Printer extruder id";
|
def->label = "Printer extruder id";
|
||||||
def->tooltip = "Printer extruder id";
|
def->tooltip = "Printer extruder id";
|
||||||
|
|
|
@ -969,6 +969,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||||
((ConfigOptionInts, temperature_vitrification)) //BBS
|
((ConfigOptionInts, temperature_vitrification)) //BBS
|
||||||
((ConfigOptionFloats, filament_max_volumetric_speed))
|
((ConfigOptionFloats, filament_max_volumetric_speed))
|
||||||
((ConfigOptionInts, required_nozzle_HRC))
|
((ConfigOptionInts, required_nozzle_HRC))
|
||||||
|
((ConfigOptionEnum<FilamentMapMode>, filament_map_mode))
|
||||||
((ConfigOptionInts, filament_map))
|
((ConfigOptionInts, filament_map))
|
||||||
//((ConfigOptionInts, filament_extruder_id))
|
//((ConfigOptionInts, filament_extruder_id))
|
||||||
((ConfigOptionStrings, filament_extruder_variant))
|
((ConfigOptionStrings, filament_extruder_variant))
|
||||||
|
@ -1024,6 +1025,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||||
((ConfigOptionPercent, accel_to_decel_factor))
|
((ConfigOptionPercent, accel_to_decel_factor))
|
||||||
((ConfigOptionEnumsGeneric, extruder_type))
|
((ConfigOptionEnumsGeneric, extruder_type))
|
||||||
((ConfigOptionEnumsGeneric, nozzle_volume_type))
|
((ConfigOptionEnumsGeneric, nozzle_volume_type))
|
||||||
|
((ConfigOptionInts, extruder_filament_count))
|
||||||
((ConfigOptionInts, printer_extruder_id))
|
((ConfigOptionInts, printer_extruder_id))
|
||||||
((ConfigOptionStrings, printer_extruder_variant))
|
((ConfigOptionStrings, printer_extruder_variant))
|
||||||
//Orca
|
//Orca
|
||||||
|
|
Loading…
Reference in New Issue