ENH: filament map params switch to global param
1.Add more filament map modes 2.Filament map and mode are set as project config 3.Plate filament map is only valid when plate filament mode is manual jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I33b2f853e0b77b9d605be1f2f1172b44df43da15
This commit is contained in:
parent
e9027478f8
commit
e45f8c6dc2
|
@ -5592,8 +5592,8 @@ int CLI::run(int argc, char **argv)
|
||||||
if (m_extra_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode"))
|
if (m_extra_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode"))
|
||||||
mode = m_extra_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
mode = m_extra_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
||||||
else
|
else
|
||||||
mode = part_plate->get_filament_map_mode();
|
mode = part_plate->get_real_filament_map_mode(m_print_config);
|
||||||
if (mode == FilamentMapMode::fmmAuto) {
|
if (mode < FilamentMapMode::fmmManual) {
|
||||||
part_plate->set_unprintable_filament_ids(unprintable_filament_vec);
|
part_plate->set_unprintable_filament_ids(unprintable_filament_vec);
|
||||||
std::vector<int> conflict_filament_vector;
|
std::vector<int> conflict_filament_vector;
|
||||||
for (int index = 0; index < new_extruder_count; index++)
|
for (int index = 0; index < new_extruder_count; index++)
|
||||||
|
@ -5631,7 +5631,7 @@ int CLI::run(int argc, char **argv)
|
||||||
if (m_extra_config.option<ConfigOptionInts>("filament_map"))
|
if (m_extra_config.option<ConfigOptionInts>("filament_map"))
|
||||||
filament_maps = m_extra_config.option<ConfigOptionInts>("filament_map")->values;
|
filament_maps = m_extra_config.option<ConfigOptionInts>("filament_map")->values;
|
||||||
else
|
else
|
||||||
filament_maps = part_plate->get_filament_maps();
|
filament_maps = part_plate->get_real_filament_maps(m_print_config);
|
||||||
for (int index = 0; index < filament_maps.size(); index++)
|
for (int index = 0; index < filament_maps.size(); index++)
|
||||||
{
|
{
|
||||||
int filament_extruder = filament_maps[index];
|
int filament_extruder = filament_maps[index];
|
||||||
|
@ -5657,11 +5657,11 @@ int CLI::run(int argc, char **argv)
|
||||||
new_print_config.apply(*part_plate->config());
|
new_print_config.apply(*part_plate->config());
|
||||||
new_print_config.apply(m_extra_config, true);
|
new_print_config.apply(m_extra_config, true);
|
||||||
if (new_extruder_count > 1) {
|
if (new_extruder_count > 1) {
|
||||||
FilamentMapMode map_mode = fmmAuto;
|
FilamentMapMode map_mode = fmmAutoForFlush;
|
||||||
if (new_print_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode"))
|
if (new_print_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode"))
|
||||||
map_mode = new_print_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
map_mode = new_print_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
||||||
|
|
||||||
if (map_mode == fmmAuto) {
|
if (map_mode < fmmManual) {
|
||||||
//set default params for auto map
|
//set default params for auto map
|
||||||
std::vector<std::string> extruder_ams_count(new_extruder_count, "");
|
std::vector<std::string> extruder_ams_count(new_extruder_count, "");
|
||||||
std::vector<std::vector<DynamicPrintConfig>> extruder_filament_info(new_extruder_count, std::vector<DynamicPrintConfig>());
|
std::vector<std::vector<DynamicPrintConfig>> extruder_filament_info(new_extruder_count, std::vector<DynamicPrintConfig>());
|
||||||
|
|
|
@ -4166,9 +4166,12 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
||||||
}
|
}
|
||||||
else if (key == FILAMENT_MAP_MODE_ATTR)
|
else if (key == FILAMENT_MAP_MODE_ATTR)
|
||||||
{
|
{
|
||||||
FilamentMapMode map_mode = FilamentMapMode::fmmAuto;
|
FilamentMapMode map_mode = FilamentMapMode::fmmAutoForFlush;
|
||||||
ConfigOptionEnum<FilamentMapMode>::from_string(value, map_mode);
|
// handle old versions, only load manual params
|
||||||
m_curr_plater->config.set_key_value("filament_map_mode", new ConfigOptionEnum<FilamentMapMode>(map_mode));
|
if (value != "Auto") {
|
||||||
|
ConfigOptionEnum<FilamentMapMode>::from_string(value, map_mode);
|
||||||
|
m_curr_plater->config.set_key_value("filament_map_mode", new ConfigOptionEnum<FilamentMapMode>(map_mode));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (key == FILAMENT_MAP_ATTR) {
|
else if (key == FILAMENT_MAP_ATTR) {
|
||||||
if (m_curr_plater)
|
if (m_curr_plater)
|
||||||
|
@ -7585,7 +7588,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
||||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << FILAMENT_MAP_MODE_ATTR << "\" " << VALUE_ATTR << "=\"" << filament_map_mode_names[filament_map_mode_opt->getInt()] << "\"/>\n";
|
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << FILAMENT_MAP_MODE_ATTR << "\" " << VALUE_ATTR << "=\"" << filament_map_mode_names[filament_map_mode_opt->getInt()] << "\"/>\n";
|
||||||
|
|
||||||
ConfigOptionInts* filament_maps_opt = plate_data->config.option<ConfigOptionInts>("filament_map");
|
ConfigOptionInts* filament_maps_opt = plate_data->config.option<ConfigOptionInts>("filament_map");
|
||||||
if (filament_maps_opt != nullptr) {
|
// filament map override global settings only when group mode overrides the global settings
|
||||||
|
if (filament_map_mode_opt !=nullptr && filament_maps_opt != nullptr) {
|
||||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << FILAMENT_MAP_ATTR << "\" " << VALUE_ATTR << "=\"";
|
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << FILAMENT_MAP_ATTR << "\" " << VALUE_ATTR << "=\"";
|
||||||
const std::vector<int>& values = filament_maps_opt->values;
|
const std::vector<int>& values = filament_maps_opt->values;
|
||||||
for (int i = 0; i < values.size(); ++i) {
|
for (int i = 0; i < values.size(); ++i) {
|
||||||
|
|
|
@ -1167,7 +1167,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int>filament_maps(number_of_extruders, 0);
|
std::vector<int>filament_maps(number_of_extruders, 0);
|
||||||
FilamentMapMode map_mode = FilamentMapMode::fmmAuto;
|
FilamentMapMode map_mode = FilamentMapMode::fmmAutoForFlush;
|
||||||
|
|
||||||
std::vector<std::vector<unsigned int>> layer_filaments;
|
std::vector<std::vector<unsigned int>> layer_filaments;
|
||||||
for (auto& lt : m_layer_tools) {
|
for (auto& lt : m_layer_tools) {
|
||||||
|
@ -1183,7 +1183,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||||
map_mode = m_print->get_filament_map_mode();
|
map_mode = m_print->get_filament_map_mode();
|
||||||
// only check and map in sequence mode, in by object mode, we check the map in print.cpp
|
// only check and map in sequence mode, in by object mode, we check the map in print.cpp
|
||||||
if (print_config->print_sequence != PrintSequence::ByObject || m_print->objects().size() == 1) {
|
if (print_config->print_sequence != PrintSequence::ByObject || m_print->objects().size() == 1) {
|
||||||
if (map_mode == FilamentMapMode::fmmAuto) {
|
if (map_mode < FilamentMapMode::fmmManual) {
|
||||||
const PrintConfig* print_config = m_print_config_ptr;
|
const PrintConfig* print_config = m_print_config_ptr;
|
||||||
if (!print_config && m_print_object_ptr) {
|
if (!print_config && m_print_object_ptr) {
|
||||||
print_config = &(m_print_object_ptr->print()->config());
|
print_config = &(m_print_object_ptr->print()->config());
|
||||||
|
@ -1258,7 +1258,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||||
auto curr_flush_info = calc_filament_change_info_by_toolorder(print_config, filament_maps, nozzle_flush_mtx, filament_sequences);
|
auto curr_flush_info = calc_filament_change_info_by_toolorder(print_config, filament_maps, nozzle_flush_mtx, filament_sequences);
|
||||||
if (nozzle_nums <= 1)
|
if (nozzle_nums <= 1)
|
||||||
m_stats_by_single_extruder = curr_flush_info;
|
m_stats_by_single_extruder = curr_flush_info;
|
||||||
else if (map_mode == fmmAuto)
|
else if (map_mode < fmmManual)
|
||||||
m_stats_by_multi_extruder_auto = curr_flush_info;
|
m_stats_by_multi_extruder_auto = curr_flush_info;
|
||||||
else if (map_mode == fmmManual)
|
else if (map_mode == fmmManual)
|
||||||
m_stats_by_multi_extruder_manual = curr_flush_info;
|
m_stats_by_multi_extruder_manual = curr_flush_info;
|
||||||
|
|
|
@ -41,7 +41,9 @@ static std::vector<std::string> s_project_options {
|
||||||
"wipe_tower_rotation_angle",
|
"wipe_tower_rotation_angle",
|
||||||
"curr_bed_type",
|
"curr_bed_type",
|
||||||
"flush_multiplier",
|
"flush_multiplier",
|
||||||
"nozzle_volume_type"
|
"nozzle_volume_type",
|
||||||
|
"filament_map_mode",
|
||||||
|
"filament_map"
|
||||||
};
|
};
|
||||||
|
|
||||||
//BBS: add BBL as default
|
//BBS: add BBL as default
|
||||||
|
@ -1756,7 +1758,9 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigOptionStrings* filament_color = project_config.option<ConfigOptionStrings>("filament_colour");
|
ConfigOptionStrings* filament_color = project_config.option<ConfigOptionStrings>("filament_colour");
|
||||||
|
ConfigOptionInts* filament_map = project_config.option<ConfigOptionInts>("filament_map");
|
||||||
filament_color->resize(n);
|
filament_color->resize(n);
|
||||||
|
filament_map->values.resize(n, 1);
|
||||||
ams_multi_color_filment.resize(n);
|
ams_multi_color_filment.resize(n);
|
||||||
|
|
||||||
//BBS set new filament color to new_color
|
//BBS set new filament color to new_color
|
||||||
|
@ -1778,11 +1782,15 @@ void PresetBundle::update_num_filaments(unsigned int to_del_flament_id)
|
||||||
filament_presets.erase(filament_presets.begin() + to_del_flament_id);
|
filament_presets.erase(filament_presets.begin() + to_del_flament_id);
|
||||||
|
|
||||||
ConfigOptionStrings *filament_color = project_config.option<ConfigOptionStrings>("filament_colour");
|
ConfigOptionStrings *filament_color = project_config.option<ConfigOptionStrings>("filament_colour");
|
||||||
|
ConfigOptionInts* filament_map = project_config.option<ConfigOptionInts>("filament_map");
|
||||||
|
|
||||||
if (filament_color->values.size() > to_del_flament_id) {
|
if (filament_color->values.size() > to_del_flament_id) {
|
||||||
filament_color->values.erase(filament_color->values.begin() + to_del_flament_id);
|
filament_color->values.erase(filament_color->values.begin() + to_del_flament_id);
|
||||||
|
filament_map->values.erase(filament_map->values.begin() + to_del_flament_id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
filament_color->values.resize(to_del_flament_id);
|
filament_color->values.resize(to_del_flament_id);
|
||||||
|
filament_map->values.resize(to_del_flament_id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ams_multi_color_filment.size() > to_del_flament_id){
|
if (ams_multi_color_filment.size() > to_del_flament_id){
|
||||||
|
@ -2090,14 +2098,14 @@ bool PresetBundle::support_different_extruders()
|
||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicPrintConfig PresetBundle::full_config(bool apply_extruder, std::vector<int> filament_maps) const
|
DynamicPrintConfig PresetBundle::full_config(bool apply_extruder, std::optional<std::vector<int>>filament_maps) const
|
||||||
{
|
{
|
||||||
return (this->printers.get_edited_preset().printer_technology() == ptFFF) ?
|
return (this->printers.get_edited_preset().printer_technology() == ptFFF) ?
|
||||||
this->full_fff_config(apply_extruder, filament_maps) :
|
this->full_fff_config(apply_extruder, filament_maps) :
|
||||||
this->full_sla_config();
|
this->full_sla_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicPrintConfig PresetBundle::full_config_secure(std::vector<int> filament_maps) const
|
DynamicPrintConfig PresetBundle::full_config_secure(std::optional<std::vector<int>>filament_maps) const
|
||||||
{
|
{
|
||||||
DynamicPrintConfig config = this->full_fff_config(false, filament_maps);
|
DynamicPrintConfig config = this->full_fff_config(false, filament_maps);
|
||||||
//BBS example: config.erase("print_host");
|
//BBS example: config.erase("print_host");
|
||||||
|
@ -2115,7 +2123,7 @@ const std::set<std::string> ignore_settings_list ={
|
||||||
"print_settings_id", "filament_settings_id", "printer_settings_id"
|
"print_settings_id", "filament_settings_id", "printer_settings_id"
|
||||||
};
|
};
|
||||||
|
|
||||||
DynamicPrintConfig PresetBundle::full_fff_config(bool apply_extruder, std::vector<int> filament_maps) const
|
DynamicPrintConfig PresetBundle::full_fff_config(bool apply_extruder, std::optional<std::vector<int>> filament_maps_new) const
|
||||||
{
|
{
|
||||||
DynamicPrintConfig out;
|
DynamicPrintConfig out;
|
||||||
out.apply(FullPrintConfig::defaults());
|
out.apply(FullPrintConfig::defaults());
|
||||||
|
@ -2128,6 +2136,9 @@ DynamicPrintConfig PresetBundle::full_fff_config(bool apply_extruder, std::vecto
|
||||||
// BBS
|
// BBS
|
||||||
size_t num_filaments = this->filament_presets.size();
|
size_t num_filaments = this->filament_presets.size();
|
||||||
|
|
||||||
|
std::vector<int> filament_maps = out.option<ConfigOptionInts>("filament_map")->values;
|
||||||
|
if (filament_maps_new.has_value())
|
||||||
|
filament_maps = *filament_maps_new;
|
||||||
//in some middle state, they may be different
|
//in some middle state, they may be different
|
||||||
if (filament_maps.size() != num_filaments) {
|
if (filament_maps.size() != num_filaments) {
|
||||||
filament_maps.resize(num_filaments, 1);
|
filament_maps.resize(num_filaments, 1);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <optional>
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
#define DEFAULT_USER_FOLDER_NAME "default"
|
#define DEFAULT_USER_FOLDER_NAME "default"
|
||||||
|
@ -159,9 +160,9 @@ public:
|
||||||
bool has_defauls_only() const
|
bool has_defauls_only() const
|
||||||
{ return prints.has_defaults_only() && filaments.has_defaults_only() && printers.has_defaults_only(); }
|
{ return prints.has_defaults_only() && filaments.has_defaults_only() && printers.has_defaults_only(); }
|
||||||
|
|
||||||
DynamicPrintConfig full_config(bool apply_extruder = true, std::vector<int> filament_maps = std::vector<int>()) const;
|
DynamicPrintConfig full_config(bool apply_extruder = true, std::optional<std::vector<int>>filament_maps = std::nullopt) const;
|
||||||
// full_config() with the some "useless" config removed.
|
// full_config() with the some "useless" config removed.
|
||||||
DynamicPrintConfig full_config_secure(std::vector<int> filament_maps = std::vector<int>()) const;
|
DynamicPrintConfig full_config_secure(std::optional<std::vector<int>>filament_maps = std::nullopt) const;
|
||||||
|
|
||||||
//BBS: add some functions for multiple extruders
|
//BBS: add some functions for multiple extruders
|
||||||
int get_printer_extruder_count() const;
|
int get_printer_extruder_count() const;
|
||||||
|
@ -280,7 +281,7 @@ private:
|
||||||
/*ConfigSubstitutions load_config_file_config_bundle(
|
/*ConfigSubstitutions load_config_file_config_bundle(
|
||||||
const std::string &path, const boost::property_tree::ptree &tree, ForwardCompatibilitySubstitutionRule compatibility_rule);*/
|
const std::string &path, const boost::property_tree::ptree &tree, ForwardCompatibilitySubstitutionRule compatibility_rule);*/
|
||||||
|
|
||||||
DynamicPrintConfig full_fff_config(bool apply_extruder, std::vector<int> filament_maps) const;
|
DynamicPrintConfig full_fff_config(bool apply_extruder, std::optional<std::vector<int>> filament_maps=std::nullopt) const;
|
||||||
DynamicPrintConfig full_sla_config() const;
|
DynamicPrintConfig full_sla_config() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1881,7 +1881,7 @@ void Print::process(std::unordered_map<std::string, long long>* slice_time, bool
|
||||||
std::vector<int>filament_maps = this->get_filament_maps();
|
std::vector<int>filament_maps = this->get_filament_maps();
|
||||||
auto map_mode = get_filament_map_mode();
|
auto map_mode = get_filament_map_mode();
|
||||||
// get recommended filament map
|
// get recommended filament map
|
||||||
if (map_mode == FilamentMapMode::fmmAuto) {
|
if (map_mode < FilamentMapMode::fmmManual) {
|
||||||
filament_maps = ToolOrdering::get_recommended_filament_maps(all_filaments, &config(), this, physical_unprintables, geometric_unprintables);
|
filament_maps = ToolOrdering::get_recommended_filament_maps(all_filaments, &config(), this, physical_unprintables, geometric_unprintables);
|
||||||
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) { return value + 1; });
|
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) { return value + 1; });
|
||||||
update_filament_maps_to_config(filament_maps);
|
update_filament_maps_to_config(filament_maps);
|
||||||
|
|
|
@ -880,8 +880,6 @@ public:
|
||||||
const Calib_Params& calib_params() const { return m_calib_params; }
|
const Calib_Params& calib_params() const { return m_calib_params; }
|
||||||
Vec2d translate_to_print_space(const Vec2d& point) const;
|
Vec2d translate_to_print_space(const Vec2d& point) const;
|
||||||
|
|
||||||
bool has_auto_filament_map_result() const { return m_has_auto_filament_map_result; }
|
|
||||||
void set_auto_filament_map_result(bool has_result) { m_has_auto_filament_map_result = has_result; }
|
|
||||||
|
|
||||||
// scaled point
|
// scaled point
|
||||||
Vec2d translate_to_print_space(const Point& point) const;
|
Vec2d translate_to_print_space(const Point& point) const;
|
||||||
|
|
|
@ -1150,7 +1150,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
if (print_diff_set.find("filament_map_mode") == print_diff_set.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;
|
FilamentMapMode map_mode = new_full_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value;
|
||||||
if (map_mode == fmmAuto) {
|
if (map_mode < fmmManual) {
|
||||||
if (print_diff_set.find("filament_map") != print_diff_set.end()) {
|
if (print_diff_set.find("filament_map") != print_diff_set.end()) {
|
||||||
print_diff_set.erase("filament_map");
|
print_diff_set.erase("filament_map");
|
||||||
//full_config_diff.erase("filament_map");
|
//full_config_diff.erase("filament_map");
|
||||||
|
|
|
@ -389,7 +389,8 @@ static const t_config_enum_values s_keys_map_NozzleVolumeType = {
|
||||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(NozzleVolumeType)
|
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(NozzleVolumeType)
|
||||||
|
|
||||||
static const t_config_enum_values s_keys_map_FilamentMapMode = {
|
static const t_config_enum_values s_keys_map_FilamentMapMode = {
|
||||||
{ "Auto", fmmAuto },
|
{ "Auto For Flush", fmmAutoForFlush },
|
||||||
|
{ "Auto For Match", fmmAutoForMatch },
|
||||||
{ "Manual", fmmManual }
|
{ "Manual", fmmManual }
|
||||||
};
|
};
|
||||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(FilamentMapMode)
|
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(FilamentMapMode)
|
||||||
|
@ -1656,12 +1657,16 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->label = L("filament mapping mode");
|
def->label = L("filament mapping mode");
|
||||||
def->tooltip = ("filament mapping mode used as plate param");
|
def->tooltip = ("filament mapping mode used as plate param");
|
||||||
def->enum_keys_map = &ConfigOptionEnum<FilamentMapMode>::get_enum_values();
|
def->enum_keys_map = &ConfigOptionEnum<FilamentMapMode>::get_enum_values();
|
||||||
def->enum_values.push_back("Auto");
|
def->enum_values.push_back("Auto For Flush");
|
||||||
|
def->enum_values.push_back("Auto For Match");
|
||||||
def->enum_values.push_back("Manual");
|
def->enum_values.push_back("Manual");
|
||||||
def->enum_labels.push_back(L("Auto"));
|
def->enum_values.push_back("Default");
|
||||||
|
def->enum_labels.push_back(L("Auto For Flush"));
|
||||||
|
def->enum_labels.push_back(L("Auto For Match"));
|
||||||
def->enum_labels.push_back(L("Manual"));
|
def->enum_labels.push_back(L("Manual"));
|
||||||
|
def->enum_labels.push_back(L("Default"));
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionEnum<FilamentMapMode>(fmmAuto));
|
def->set_default_value(new ConfigOptionEnum<FilamentMapMode>(fmmAutoForFlush));
|
||||||
|
|
||||||
def = this->add("filament_max_volumetric_speed", coFloats);
|
def = this->add("filament_max_volumetric_speed", coFloats);
|
||||||
def->label = L("Max volumetric speed");
|
def->label = L("Max volumetric speed");
|
||||||
|
|
|
@ -302,8 +302,10 @@ enum NozzleVolumeType {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FilamentMapMode {
|
enum FilamentMapMode {
|
||||||
fmmAuto,
|
fmmAutoForFlush,
|
||||||
fmmManual
|
fmmAutoForMatch,
|
||||||
|
fmmManual,
|
||||||
|
fmmDefault
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::string get_extruder_variant_string(ExtruderType extruder_type, NozzleVolumeType nozzle_volume_type);
|
extern std::string get_extruder_variant_string(ExtruderType extruder_type, NozzleVolumeType nozzle_volume_type);
|
||||||
|
|
|
@ -1885,8 +1885,9 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
|
||||||
//check per-object error for extruder areas
|
//check per-object error for extruder areas
|
||||||
if (object_results && (extruder_count > 1))
|
if (object_results && (extruder_count > 1))
|
||||||
{
|
{
|
||||||
object_results->mode = curr_plate->get_filament_map_mode();
|
const auto& project_config = Slic3r::GUI::wxGetApp().preset_bundle->project_config;
|
||||||
if (object_results->mode == FilamentMapMode::fmmAuto)
|
object_results->mode = curr_plate->get_real_filament_map_mode(project_config);
|
||||||
|
if (object_results->mode < FilamentMapMode::fmmManual)
|
||||||
{
|
{
|
||||||
std::vector<int> conflict_filament_vector;
|
std::vector<int> conflict_filament_vector;
|
||||||
for (int index = 0; index < extruder_count; index++ )
|
for (int index = 0; index < extruder_count; index++ )
|
||||||
|
@ -1947,7 +1948,8 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::set<int> conflict_filaments_set;
|
std::set<int> conflict_filaments_set;
|
||||||
std::vector<int> filament_maps = curr_plate->get_filament_maps();
|
const auto& project_config = Slic3r::GUI::wxGetApp().preset_bundle->project_config;
|
||||||
|
std::vector<int> filament_maps = curr_plate->get_real_filament_maps(project_config);
|
||||||
for (auto& object_map: objects_unprintable_filaments)
|
for (auto& object_map: objects_unprintable_filaments)
|
||||||
{
|
{
|
||||||
ModelObject *model_object = object_map.first;
|
ModelObject *model_object = object_map.first;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <wx/graphics.h>
|
#include <wx/graphics.h>
|
||||||
#include <miniz.h>
|
#include <miniz.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <optional>
|
||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
#include "BitmapCache.hpp"
|
#include "BitmapCache.hpp"
|
||||||
#include "BindDialog.hpp"
|
#include "BindDialog.hpp"
|
||||||
|
|
|
@ -225,10 +225,9 @@ void BackgroundSlicingProcess::process_fff()
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: gcode_result reseted, will start print::process")%__LINE__;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: gcode_result reseted, will start print::process")%__LINE__;
|
||||||
m_print->process();
|
m_print->process();
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: after print::process, send slicing complete event to gui...")%__LINE__;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: after print::process, send slicing complete event to gui...")%__LINE__;
|
||||||
if (m_current_plate->get_filament_map_mode() == FilamentMapMode::fmmAuto) {
|
if (m_current_plate->get_real_filament_map_mode(preset_bundle.project_config) < FilamentMapMode::fmmManual) {
|
||||||
std::vector<int> f_maps = m_fff_print->get_filament_maps();
|
std::vector<int> f_maps = m_fff_print->get_filament_maps();
|
||||||
m_current_plate->set_filament_maps(f_maps);
|
m_current_plate->set_filament_maps(f_maps);
|
||||||
m_current_plate->set_auto_filament_map_result(m_fff_print->has_auto_filament_map_result());
|
|
||||||
}
|
}
|
||||||
wxCommandEvent evt(m_event_slicing_completed_id);
|
wxCommandEvent evt(m_event_slicing_completed_id);
|
||||||
// Post the Slicing Finished message for the G-code viewer to update.
|
// Post the Slicing Finished message for the G-code viewer to update.
|
||||||
|
|
|
@ -4652,7 +4652,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
||||||
if (msg_dlg.ShowModal() == wxID_OK) {
|
if (msg_dlg.ShowModal() == wxID_OK) {
|
||||||
PartPlateList &partplate_list = wxGetApp().plater()->get_partplate_list();
|
PartPlateList &partplate_list = wxGetApp().plater()->get_partplate_list();
|
||||||
PartPlate *plate = partplate_list.get_curr_plate();
|
PartPlate *plate = partplate_list.get_curr_plate();
|
||||||
plate->set_filament_map_mode(FilamentMapMode::fmmAuto);
|
plate->set_filament_map_mode(FilamentMapMode::fmmAutoForFlush);
|
||||||
Plater *plater = wxGetApp().plater();
|
Plater *plater = wxGetApp().plater();
|
||||||
wxPostEvent(plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
wxPostEvent(plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||||
}
|
}
|
||||||
|
@ -4665,9 +4665,9 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
||||||
auto config = wxGetApp().plater()->get_partplate_list().get_current_fff_print().config();
|
auto config = wxGetApp().plater()->get_partplate_list().get_current_fff_print().config();
|
||||||
auto stats_by_extruder = wxGetApp().plater()->get_partplate_list().get_current_fff_print().statistics_by_extruder();
|
auto stats_by_extruder = wxGetApp().plater()->get_partplate_list().get_current_fff_print().statistics_by_extruder();
|
||||||
auto filament_map_mode = config.filament_map_mode.value;
|
auto filament_map_mode = config.filament_map_mode.value;
|
||||||
auto is_auto = filament_map_mode == FilamentMapMode::fmmAuto;
|
auto is_auto = filament_map_mode < FilamentMapMode::fmmManual;
|
||||||
bool has_tips = true;
|
bool has_tips = true;
|
||||||
if (filament_map_mode == FilamentMapMode::fmmAuto) {
|
if (is_auto) {
|
||||||
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
|
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
|
||||||
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
|
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
|
||||||
if (!(saved_flush_weight > EPSILON || saved_filament_changed_time > 0)) has_tips = false;
|
if (!(saved_flush_weight > EPSILON || saved_filament_changed_time > 0)) has_tips = false;
|
||||||
|
@ -4744,7 +4744,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
|
||||||
}
|
}
|
||||||
return static_cast<int>(num);
|
return static_cast<int>(num);
|
||||||
};
|
};
|
||||||
if (filament_map_mode == fmmAuto) {
|
if (filament_map_mode < fmmManual) {
|
||||||
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
|
float saved_flush_weight = stats_by_extruder.stats_by_single_extruder.filament_flush_weight - stats_by_extruder.stats_by_multi_extruder_auto.filament_flush_weight;
|
||||||
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
|
int saved_filament_changed_time = stats_by_extruder.stats_by_single_extruder.filament_change_count - stats_by_extruder.stats_by_multi_extruder_auto.filament_change_count;
|
||||||
if (saved_flush_weight > EPSILON || saved_filament_changed_time > 0) {
|
if (saved_flush_weight > EPSILON || saved_filament_changed_time > 0) {
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ void GLCanvas3D::construct_error_string(ObjectFilamentResults& object_result, st
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!object_result.filaments.empty()) {
|
if (!object_result.filaments.empty()) {
|
||||||
if (object_result.mode == FilamentMapMode::fmmAuto) {
|
if (object_result.mode < FilamentMapMode::fmmManual) {
|
||||||
error_string += _u8L("In the Filament auto-matching mode, Filament ");
|
error_string += _u8L("In the Filament auto-matching mode, Filament ");
|
||||||
for (auto& filament: object_result.filaments)
|
for (auto& filament: object_result.filaments)
|
||||||
error_string += std::to_string(filament) + " ";
|
error_string += std::to_string(filament) + " ";
|
||||||
|
|
|
@ -139,8 +139,6 @@ void PartPlate::init()
|
||||||
|
|
||||||
m_print_index = -1;
|
m_print_index = -1;
|
||||||
m_print = nullptr;
|
m_print = nullptr;
|
||||||
|
|
||||||
m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BedType PartPlate::get_bed_type(bool load_from_project) const
|
BedType PartPlate::get_bed_type(bool load_from_project) const
|
||||||
|
@ -256,6 +254,32 @@ PrintSequence PartPlate::get_real_print_seq(bool* plate_same_as_global) const
|
||||||
return curr_plate_seq;
|
return curr_plate_seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<int> PartPlate::get_real_filament_maps(const DynamicConfig& g_config, bool* use_global_param) const
|
||||||
|
{
|
||||||
|
auto maps = get_filament_maps();
|
||||||
|
if (!maps.empty()) {
|
||||||
|
if (use_global_param) { *use_global_param = false; }
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
auto g_maps = g_config.option<ConfigOptionInts>("filament_map")->values;
|
||||||
|
if (use_global_param) { *use_global_param = true; }
|
||||||
|
return g_maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
FilamentMapMode PartPlate::get_real_filament_map_mode(const DynamicConfig& g_config, bool* use_global_param) const
|
||||||
|
{
|
||||||
|
auto mode = get_filament_map_mode();
|
||||||
|
if (FilamentMapMode::fmmDefault != mode) {
|
||||||
|
if (use_global_param) { *use_global_param = false; };
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto g_mode = g_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
||||||
|
if (use_global_param) { *use_global_param = true; }
|
||||||
|
return g_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PartPlate::has_spiral_mode_config() const
|
bool PartPlate::has_spiral_mode_config() const
|
||||||
{
|
{
|
||||||
std::string key = "spiral_mode";
|
std::string key = "spiral_mode";
|
||||||
|
@ -2578,8 +2602,9 @@ int PartPlate::load_gcode_from_file(const std::string& filename)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
// process gcode
|
// process gcode
|
||||||
std::vector<int> filament_maps = this->get_filament_maps();
|
std::vector<int> filament_maps = this->get_real_filament_maps(preset_bundle->project_config);
|
||||||
DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config(false, filament_maps);
|
DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config(false, filament_maps);
|
||||||
full_config.apply(m_config, true);
|
full_config.apply(m_config, true);
|
||||||
m_print->apply(*m_model, full_config, false);
|
m_print->apply(*m_model, full_config, false);
|
||||||
|
@ -2876,37 +2901,39 @@ std::map<std::string, std::string> PartPlate::get_diff_plate_setting()
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilamentMapMode PartPlate::get_filament_map_mode()
|
FilamentMapMode PartPlate::get_filament_map_mode() const
|
||||||
{
|
{
|
||||||
return m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value;
|
std::string key = "filament_map_mode";
|
||||||
|
if(m_config.has(key))
|
||||||
|
return m_config.option<ConfigOptionEnum<FilamentMapMode>>(key)->value;
|
||||||
|
return FilamentMapMode::fmmDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PartPlate::set_filament_map_mode(const FilamentMapMode& mode)
|
void PartPlate::set_filament_map_mode(const FilamentMapMode& mode)
|
||||||
{
|
{
|
||||||
m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value = mode;
|
m_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PartPlate::has_auto_filament_map_reslut()
|
std::vector<int> PartPlate::get_filament_maps() const
|
||||||
{
|
{
|
||||||
return m_has_auto_filament_map_result;
|
std::string key = "filament_map";
|
||||||
}
|
if (m_config.has(key))
|
||||||
|
return m_config.option<ConfigOptionInts>(key)->values;
|
||||||
|
|
||||||
void PartPlate::set_auto_filament_map_result(bool has_result)
|
return {};
|
||||||
{
|
|
||||||
m_has_auto_filament_map_result = has_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<int> PartPlate::get_filament_maps()
|
|
||||||
{
|
|
||||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
|
||||||
|
|
||||||
return filament_maps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PartPlate::set_filament_maps(const std::vector<int>& f_maps)
|
void PartPlate::set_filament_maps(const std::vector<int>& f_maps)
|
||||||
{
|
{
|
||||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
m_config.option<ConfigOptionInts>("filament_map", true)->values = f_maps;
|
||||||
filament_maps = f_maps;
|
}
|
||||||
|
|
||||||
|
void PartPlate::clear_filament_map_info()
|
||||||
|
{
|
||||||
|
if (m_config.has("filament_map"))
|
||||||
|
m_config.erase("filament_map");
|
||||||
|
if (m_config.has("filament_map_mode"))
|
||||||
|
m_config.erase("filament_map_mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::vector<int>>& PartPlate::get_unprintable_filament_ids()
|
const std::vector<std::vector<int>>& PartPlate::get_unprintable_filament_ids()
|
||||||
|
@ -2929,22 +2956,26 @@ void PartPlate::on_extruder_count_changed(int extruder_count)
|
||||||
|
|
||||||
void PartPlate::set_filament_count(int filament_count)
|
void PartPlate::set_filament_count(int filament_count)
|
||||||
{
|
{
|
||||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
if (m_config.has("filament_map")) {
|
||||||
filament_maps.resize(filament_count, 1);
|
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map")->values;
|
||||||
|
filament_maps.resize(filament_count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PartPlate::on_filament_added()
|
void PartPlate::on_filament_added()
|
||||||
{
|
{
|
||||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
if (m_config.has("filament_map")) {
|
||||||
filament_maps.push_back(1);
|
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map")->values;
|
||||||
|
filament_maps.push_back(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PartPlate::on_filament_deleted(int filament_count, int filament_id)
|
void PartPlate::on_filament_deleted(int filament_count, int filament_id)
|
||||||
{
|
{
|
||||||
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map", true)->values;
|
if (m_config.has("filament_map")) {
|
||||||
|
std::vector<int>& filament_maps = m_config.option<ConfigOptionInts>("filament_map")->values;
|
||||||
filament_maps.erase(filament_maps.begin()+filament_id);
|
filament_maps.erase(filament_maps.begin() + filament_id);
|
||||||
|
}
|
||||||
update_first_layer_print_sequence_when_delete_filament(filament_id);
|
update_first_layer_print_sequence_when_delete_filament(filament_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5567,6 +5598,7 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
||||||
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
||||||
{
|
{
|
||||||
PlateData* plate_data_item = new PlateData();
|
PlateData* plate_data_item = new PlateData();
|
||||||
|
// TODO: write if needed
|
||||||
plate_data_item->filament_maps = m_plate_list[i]->get_filament_maps();
|
plate_data_item->filament_maps = m_plate_list[i]->get_filament_maps();
|
||||||
plate_data_item->locked = m_plate_list[i]->m_locked;
|
plate_data_item->locked = m_plate_list[i]->m_locked;
|
||||||
plate_data_item->plate_index = m_plate_list[i]->m_plate_index;
|
plate_data_item->plate_index = m_plate_list[i]->m_plate_index;
|
||||||
|
|
|
@ -104,7 +104,6 @@ private:
|
||||||
bool m_slice_result_valid;
|
bool m_slice_result_valid;
|
||||||
bool m_apply_invalid {false};
|
bool m_apply_invalid {false};
|
||||||
float m_slice_percent;
|
float m_slice_percent;
|
||||||
bool m_has_auto_filament_map_result{false};
|
|
||||||
|
|
||||||
Print *m_print; //Print reference, not own it, no need to serialize
|
Print *m_print; //Print reference, not own it, no need to serialize
|
||||||
GCodeProcessorResult *m_gcode_result;
|
GCodeProcessorResult *m_gcode_result;
|
||||||
|
@ -229,6 +228,19 @@ public:
|
||||||
// @return PrintSequence::{ByLayer,ByObject}
|
// @return PrintSequence::{ByLayer,ByObject}
|
||||||
PrintSequence get_real_print_seq(bool* plate_same_as_global=nullptr) const;
|
PrintSequence get_real_print_seq(bool* plate_same_as_global=nullptr) const;
|
||||||
|
|
||||||
|
std::vector<int> get_real_filament_maps(const DynamicConfig& g_config, bool* use_global_param = nullptr)const;
|
||||||
|
FilamentMapMode get_real_filament_map_mode(const DynamicConfig& g_config,bool * use_global_param = nullptr) const;
|
||||||
|
|
||||||
|
FilamentMapMode get_filament_map_mode() const;
|
||||||
|
void set_filament_map_mode(const FilamentMapMode& mode);
|
||||||
|
|
||||||
|
// get filament map, 0 based filament ids, 1 based extruder ids
|
||||||
|
std::vector<int> get_filament_maps() const;
|
||||||
|
void set_filament_maps(const std::vector<int>& f_maps);
|
||||||
|
|
||||||
|
// remove filament map and map mode in profiles
|
||||||
|
void clear_filament_map_info();
|
||||||
|
|
||||||
bool has_spiral_mode_config() const;
|
bool has_spiral_mode_config() const;
|
||||||
bool get_spiral_vase_mode() const;
|
bool get_spiral_vase_mode() const;
|
||||||
void set_spiral_vase_mode(bool spiral_mode, bool as_global);
|
void set_spiral_vase_mode(bool spiral_mode, bool as_global);
|
||||||
|
@ -484,16 +496,6 @@ public:
|
||||||
std::map<std::string, std::string> get_diff_object_setting();
|
std::map<std::string, std::string> get_diff_object_setting();
|
||||||
std::map<std::string, std::string> get_diff_plate_setting();
|
std::map<std::string, std::string> get_diff_plate_setting();
|
||||||
|
|
||||||
FilamentMapMode get_filament_map_mode();
|
|
||||||
void set_filament_map_mode(const FilamentMapMode& mode);
|
|
||||||
|
|
||||||
bool has_auto_filament_map_reslut();
|
|
||||||
void set_auto_filament_map_result(bool has_result);
|
|
||||||
|
|
||||||
// get filament map, 0 based filament ids, 1 based extruder ids
|
|
||||||
std::vector<int> get_filament_maps();
|
|
||||||
void set_filament_maps(const std::vector<int>& f_maps);
|
|
||||||
|
|
||||||
const std::vector<std::vector<int>> &get_unprintable_filament_ids();
|
const std::vector<std::vector<int>> &get_unprintable_filament_ids();
|
||||||
void set_unprintable_filament_ids(const std::vector<std::vector<int>> &filament_ids);
|
void set_unprintable_filament_ids(const std::vector<std::vector<int>> &filament_ids);
|
||||||
|
|
||||||
|
|
|
@ -6235,14 +6235,15 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
Print::ApplyStatus invalidated;
|
Print::ApplyStatus invalidated;
|
||||||
if (wxGetApp().preset_bundle->get_printer_extruder_count() > 1) {
|
const auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
if (preset_bundle->get_printer_extruder_count() > 1) {
|
||||||
PartPlate* cur_plate = background_process.get_current_plate();
|
PartPlate* cur_plate = background_process.get_current_plate();
|
||||||
std::vector<int> f_maps = cur_plate->get_filament_maps();
|
std::vector<int> f_maps = cur_plate->get_real_filament_maps(preset_bundle->project_config);
|
||||||
invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false, f_maps));
|
invalidated = background_process.apply(this->model, preset_bundle->full_config(false, f_maps));
|
||||||
background_process.fff_print()->set_extruder_filament_info(get_extruder_filament_info());
|
background_process.fff_print()->set_extruder_filament_info(get_extruder_filament_info());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
invalidated = background_process.apply(this->model, wxGetApp().preset_bundle->full_config(false));
|
invalidated = background_process.apply(this->model, preset_bundle->full_config(false));
|
||||||
|
|
||||||
if ((invalidated == Print::APPLY_STATUS_CHANGED) || (invalidated == Print::APPLY_STATUS_INVALIDATED))
|
if ((invalidated == Print::APPLY_STATUS_CHANGED) || (invalidated == Print::APPLY_STATUS_INVALIDATED))
|
||||||
// BBS: add only gcode mode
|
// BBS: add only gcode mode
|
||||||
|
@ -14535,6 +14536,32 @@ std::vector<std::string> Plater::get_colors_for_color_print(const GCodeProcessor
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::set_global_filament_map_mode(FilamentMapMode mode)
|
||||||
|
{
|
||||||
|
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
project_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plater::set_global_filament_map(const std::vector<int>& filament_map)
|
||||||
|
{
|
||||||
|
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
project_config.option<ConfigOptionInts>("filament_map")->values = filament_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> Plater::get_global_filament_map() const
|
||||||
|
{
|
||||||
|
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
return project_config.option<ConfigOptionInts>("filament_map")->values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FilamentMapMode Plater::get_global_filament_map_mode() const
|
||||||
|
{
|
||||||
|
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
return project_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxWindow* Plater::get_select_machine_dialog()
|
wxWindow* Plater::get_select_machine_dialog()
|
||||||
{
|
{
|
||||||
return p->m_select_machine_dlg;
|
return p->m_select_machine_dlg;
|
||||||
|
@ -14987,14 +15014,15 @@ void Plater::apply_background_progress()
|
||||||
PartPlate* part_plate = p->partplate_list.get_curr_plate();
|
PartPlate* part_plate = p->partplate_list.get_curr_plate();
|
||||||
int plate_index = p->partplate_list.get_curr_plate_index();
|
int plate_index = p->partplate_list.get_curr_plate_index();
|
||||||
bool result_valid = part_plate->is_slice_result_valid();
|
bool result_valid = part_plate->is_slice_result_valid();
|
||||||
|
const auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
//always apply the current plate's print
|
//always apply the current plate's print
|
||||||
Print::ApplyStatus invalidated;
|
Print::ApplyStatus invalidated;
|
||||||
if (wxGetApp().preset_bundle->get_printer_extruder_count() > 1) {
|
if (preset_bundle->get_printer_extruder_count() > 1) {
|
||||||
std::vector<int> f_maps = part_plate->get_filament_maps();
|
std::vector<int> f_maps = part_plate->get_real_filament_maps(preset_bundle->project_config);
|
||||||
invalidated = p->background_process.apply(this->model(), wxGetApp().preset_bundle->full_config(false, f_maps));
|
invalidated = p->background_process.apply(this->model(), preset_bundle->full_config(false, f_maps));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
invalidated = p->background_process.apply(this->model(), wxGetApp().preset_bundle->full_config(false));
|
invalidated = p->background_process.apply(this->model(), preset_bundle->full_config(false));
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: plate %2%, after apply, invalidated= %3%, previous result_valid %4% ") % __LINE__ % plate_index % invalidated % result_valid;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: plate %2%, after apply, invalidated= %3%, previous result_valid %4% ") % __LINE__ % plate_index % invalidated % result_valid;
|
||||||
if (invalidated & PrintBase::APPLY_STATUS_INVALIDATED)
|
if (invalidated & PrintBase::APPLY_STATUS_INVALIDATED)
|
||||||
|
@ -15016,6 +15044,7 @@ int Plater::select_plate(int plate_index, bool need_slice)
|
||||||
if (is_view3D_shown())
|
if (is_view3D_shown())
|
||||||
wxGetApp().plater()->canvas3D()->render();
|
wxGetApp().plater()->canvas3D()->render();
|
||||||
}
|
}
|
||||||
|
const auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
|
||||||
if ((!ret) && (p->background_process.can_switch_print()))
|
if ((!ret) && (p->background_process.can_switch_print()))
|
||||||
{
|
{
|
||||||
|
@ -15033,12 +15062,12 @@ int Plater::select_plate(int plate_index, bool need_slice)
|
||||||
part_plate->get_print(&print, &gcode_result, NULL);
|
part_plate->get_print(&print, &gcode_result, NULL);
|
||||||
|
|
||||||
//always apply the current plate's print
|
//always apply the current plate's print
|
||||||
if (wxGetApp().preset_bundle->get_printer_extruder_count() > 1) {
|
if (preset_bundle->get_printer_extruder_count() > 1) {
|
||||||
std::vector<int> f_maps = part_plate->get_filament_maps();
|
std::vector<int> f_maps = part_plate->get_real_filament_maps(preset_bundle->project_config);
|
||||||
invalidated = p->background_process.apply(this->model(), wxGetApp().preset_bundle->full_config(false, f_maps));
|
invalidated = p->background_process.apply(this->model(), preset_bundle->full_config(false, f_maps));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
invalidated = p->background_process.apply(this->model(), wxGetApp().preset_bundle->full_config(false));
|
invalidated = p->background_process.apply(this->model(), preset_bundle->full_config(false));
|
||||||
bool model_fits, validate_err;
|
bool model_fits, validate_err;
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: plate %2%, after apply, invalidated= %3%, previous result_valid %4% ")%__LINE__ %plate_index %invalidated %result_valid;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: plate %2%, after apply, invalidated= %3%, previous result_valid %4% ")%__LINE__ %plate_index %invalidated %result_valid;
|
||||||
|
@ -15326,33 +15355,41 @@ void Plater::open_filament_map_setting_dialog(wxCommandEvent &evt)
|
||||||
int value = evt.GetInt();
|
int value = evt.GetInt();
|
||||||
bool is_auto = value & 1; //0000 means manual, 0001 means auto
|
bool is_auto = value & 1; //0000 means manual, 0001 means auto
|
||||||
bool need_slice = value & (1 << 1); //0010 means from gcode view, 0000 means not from gcode view
|
bool need_slice = value & (1 << 1); //0010 means from gcode view, 0000 means not from gcode view
|
||||||
|
|
||||||
|
const auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
|
auto filament_colors = config()->option<ConfigOptionStrings>("filament_colour")->values;
|
||||||
|
auto plate_filament_maps = curr_plate->get_real_filament_maps(project_config);
|
||||||
|
auto plate_filament_map_mode = curr_plate->get_filament_map_mode();
|
||||||
|
if (plate_filament_maps.size() != filament_colors.size()) // refine it later, save filament map to app config
|
||||||
|
plate_filament_maps.resize(filament_colors.size(), 1);
|
||||||
|
|
||||||
FilamentMapDialog filament_dlg(this,
|
FilamentMapDialog filament_dlg(this,
|
||||||
config(),
|
config(),
|
||||||
curr_plate->get_filament_maps(),
|
plate_filament_maps,
|
||||||
curr_plate->get_extruders(true),
|
curr_plate->get_extruders(true),
|
||||||
is_auto,
|
plate_filament_map_mode < FilamentMapMode::fmmManual,
|
||||||
curr_plate->has_auto_filament_map_reslut()
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (filament_dlg.ShowModal() == wxID_OK) {
|
if (filament_dlg.ShowModal() == wxID_OK) {
|
||||||
std::vector<int> new_filament_maps = filament_dlg.get_filament_maps();
|
std::vector<int> new_filament_maps = filament_dlg.get_filament_maps();
|
||||||
std::vector<int> old_filament_maps = curr_plate->get_filament_maps();
|
std::vector<int> old_filament_maps = plate_filament_maps;
|
||||||
FilamentMapMode new_map_mode = filament_dlg.is_auto() ? FilamentMapMode::fmmAuto : FilamentMapMode::fmmManual;
|
|
||||||
|
|
||||||
if (new_map_mode == FilamentMapMode::fmmManual) {
|
FilamentMapMode old_map_mode = plate_filament_map_mode;
|
||||||
curr_plate->set_auto_filament_map_result(false);
|
FilamentMapMode new_map_mode = filament_dlg.is_auto() ? fmmAutoForFlush : fmmManual;
|
||||||
}
|
|
||||||
|
|
||||||
FilamentMapMode old_map_mode = curr_plate->get_filament_map_mode();
|
bool need_invalidate = (old_map_mode != new_map_mode ||
|
||||||
bool need_invalidate = false;
|
old_filament_maps != new_filament_maps);
|
||||||
if (new_map_mode != old_map_mode) {
|
|
||||||
|
if (old_map_mode != new_map_mode)
|
||||||
curr_plate->set_filament_map_mode(new_map_mode);
|
curr_plate->set_filament_map_mode(new_map_mode);
|
||||||
need_invalidate = true;
|
|
||||||
}
|
if (old_filament_maps != new_filament_maps && new_map_mode==fmmManual)
|
||||||
if (new_filament_maps != old_filament_maps) {
|
|
||||||
curr_plate->set_filament_maps(new_filament_maps);
|
curr_plate->set_filament_maps(new_filament_maps);
|
||||||
if (new_map_mode == FilamentMapMode::fmmManual)
|
|
||||||
need_invalidate = true;
|
if (new_map_mode == fmmDefault)
|
||||||
}
|
curr_plate->clear_filament_map_info();
|
||||||
|
|
||||||
if (need_invalidate) {
|
if (need_invalidate) {
|
||||||
if (need_slice) {
|
if (need_slice) {
|
||||||
wxPostEvent(this, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
wxPostEvent(this, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
|
||||||
|
@ -15399,14 +15436,16 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
|
||||||
GCodeResult* gcode_result = nullptr;
|
GCodeResult* gcode_result = nullptr;
|
||||||
Print::ApplyStatus invalidated;
|
Print::ApplyStatus invalidated;
|
||||||
|
|
||||||
|
const auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
|
||||||
part_plate->get_print(&print, &gcode_result, NULL);
|
part_plate->get_print(&print, &gcode_result, NULL);
|
||||||
//always apply the current plate's print
|
//always apply the current plate's print
|
||||||
if (wxGetApp().preset_bundle->get_printer_extruder_count() > 1) {
|
if (preset_bundle->get_printer_extruder_count() > 1) {
|
||||||
std::vector<int> f_maps = part_plate->get_filament_maps();
|
std::vector<int> f_maps = part_plate->get_real_filament_maps(preset_bundle->project_config);
|
||||||
invalidated = p->background_process.apply(this->model(), wxGetApp().preset_bundle->full_config(false, f_maps));
|
invalidated = p->background_process.apply(this->model(), preset_bundle->full_config(false, f_maps));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
invalidated = p->background_process.apply(this->model(), wxGetApp().preset_bundle->full_config(false));
|
invalidated = p->background_process.apply(this->model(), preset_bundle->full_config(false));
|
||||||
bool model_fits, validate_err;
|
bool model_fits, validate_err;
|
||||||
validate_current_plate(model_fits, validate_err);
|
validate_current_plate(model_fits, validate_err);
|
||||||
|
|
||||||
|
@ -15536,7 +15575,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
PartPlate * curr_plate = p->partplate_list.get_curr_plate();
|
PartPlate * curr_plate = p->partplate_list.get_curr_plate();
|
||||||
wxCommandEvent evt(EVT_OPEN_FILAMENT_MAP_SETTINGS_DIALOG);
|
wxCommandEvent evt(EVT_OPEN_FILAMENT_MAP_SETTINGS_DIALOG);
|
||||||
evt.SetInt(curr_plate->get_filament_map_mode()==FilamentMapMode::fmmAuto ? 1 : 0);
|
evt.SetInt(curr_plate->get_filament_map_mode() < FilamentMapMode::fmmManual ? 1 : 0);
|
||||||
evt.SetEventObject(this);
|
evt.SetEventObject(this);
|
||||||
wxPostEvent(this, evt);
|
wxPostEvent(this, evt);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -456,6 +456,11 @@ public:
|
||||||
std::vector<std::string> get_extruder_colors_from_plater_config(const GCodeProcessorResult* const result = nullptr) const;
|
std::vector<std::string> get_extruder_colors_from_plater_config(const GCodeProcessorResult* const result = nullptr) const;
|
||||||
std::vector<std::string> get_colors_for_color_print(const GCodeProcessorResult* const result = nullptr) const;
|
std::vector<std::string> get_colors_for_color_print(const GCodeProcessorResult* const result = nullptr) const;
|
||||||
|
|
||||||
|
void set_global_filament_map_mode(FilamentMapMode mode);
|
||||||
|
void set_global_filament_map(const std::vector<int>& filament_map);
|
||||||
|
std::vector<int> get_global_filament_map() const;
|
||||||
|
FilamentMapMode get_global_filament_map_mode() const;
|
||||||
|
|
||||||
void update_menus();
|
void update_menus();
|
||||||
// BBS
|
// BBS
|
||||||
//void show_action_buttons(const bool is_ready_to_slice) const;
|
//void show_action_buttons(const bool is_ready_to_slice) const;
|
||||||
|
|
|
@ -1162,8 +1162,9 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_)
|
||||||
// try color and type mapping
|
// try color and type mapping
|
||||||
|
|
||||||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||||
|
const auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
size_t nozzle_nums = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter")->values.size();
|
||||||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps();
|
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(project_config);
|
||||||
|
|
||||||
int filament_result = 0;
|
int filament_result = 0;
|
||||||
std::vector<bool> map_opt; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
|
std::vector<bool> map_opt; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
|
||||||
|
@ -1479,9 +1480,10 @@ bool SelectMachineDialog::is_nozzle_type_match(ExtderData data) {
|
||||||
if (data.total_extder_count <= 1 || data.extders.size() <= 1 || !wxGetApp().preset_bundle)
|
if (data.total_extder_count <= 1 || data.extders.size() <= 1 || !wxGetApp().preset_bundle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
const auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||||
//check nozzle used
|
//check nozzle used
|
||||||
auto used_filaments = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders(); // 1 based
|
auto used_filaments = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders(); // 1 based
|
||||||
auto filament_maps = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps(); // 1 based
|
auto filament_maps = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(project_config); // 1 based
|
||||||
std::map<int, std::string> used_extruders_flow;
|
std::map<int, std::string> used_extruders_flow;
|
||||||
std::vector<int> used_extruders; // 0 based
|
std::vector<int> used_extruders; // 0 based
|
||||||
for (auto f : used_filaments) {
|
for (auto f : used_filaments) {
|
||||||
|
@ -1966,7 +1968,7 @@ bool SelectMachineDialog::is_same_nozzle_diameters(NozzleType& tag_nozzle_type,
|
||||||
machine_nozzle_types[idx] = obj_->m_extder_data.extders[idx].current_nozzle_type;
|
machine_nozzle_types[idx] = obj_->m_extder_data.extders[idx].current_nozzle_type;
|
||||||
|
|
||||||
auto used_filaments = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders(); // 1 based
|
auto used_filaments = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders(); // 1 based
|
||||||
auto filament_maps=wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps(); // 1 based
|
auto filament_maps=wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(preset_bundle->project_config); // 1 based
|
||||||
|
|
||||||
std::vector<int>used_extruders; // 0 based
|
std::vector<int>used_extruders; // 0 based
|
||||||
for (auto f : used_filaments) {
|
for (auto f : used_filaments) {
|
||||||
|
@ -3603,7 +3605,8 @@ void SelectMachineDialog::reset_and_sync_ams_list()
|
||||||
bool use_double_extruder = nozzle_nums > 1 ? true : false;
|
bool use_double_extruder = nozzle_nums > 1 ? true : false;
|
||||||
if (use_double_extruder)
|
if (use_double_extruder)
|
||||||
{
|
{
|
||||||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_filament_maps();
|
const auto& project_config = preset_bundle->project_config;
|
||||||
|
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(project_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto i = 0; i < extruders.size(); i++) {
|
for (auto i = 0; i < extruders.size(); i++) {
|
||||||
|
|
Loading…
Reference in New Issue