修复配置功能下拉框不正常的问题。喷头切换耗材判断(暂定)

This commit is contained in:
cjw 2025-06-30 17:23:48 +08:00
parent e1f2dc9b4e
commit 919f5906e5
8 changed files with 222 additions and 101 deletions

View File

@ -17,7 +17,7 @@
#include "FillFloatingConcentric.hpp" #include "FillFloatingConcentric.hpp"
#define NARROW_INFILL_AREA_THRESHOLD 3 #define NARROW_INFILL_AREA_THRESHOLD 3
//#define SLIC3R_DEBUG_SLICE_PROCESSING #define SLIC3R_DEBUG_SLICE_PROCESSING
namespace Slic3r { namespace Slic3r {
@ -581,6 +581,15 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
export_group_fills_to_svg(filename.c_str(), surface_fills); export_group_fills_to_svg(filename.c_str(), surface_fills);
} }
#endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */
/* if (surface_fills[0].params.pattern == ipFiberSpiral) {
int fill_size = surface_fills.size();
for (int i = 1; i < fill_size; i++) {
SurfaceFill& surface_fill = surface_fills[i];
for (ExPolygon& expoly : surface_fill.expolygons) {
}
}
}*/
for (SurfaceFill& surface_fill : surface_fills) { for (SurfaceFill& surface_fill : surface_fills) {
// Create the filler object. // Create the filler object.

View File

@ -159,7 +159,7 @@ void PresetBundle::reset(bool delete_files)
this->filaments .reset(delete_files); this->filaments .reset(delete_files);
this->sla_materials.reset(delete_files); this->sla_materials.reset(delete_files);
this->printers .reset(delete_files); this->printers .reset(delete_files);
this->configs.reset(delete_files); this->configs .reset(delete_files);
// BBS: filament_presets is load from project config, not handled here // BBS: filament_presets is load from project config, not handled here
//this->filament_presets.clear(); //this->filament_presets.clear();
if (this->filament_presets.empty()) if (this->filament_presets.empty())
@ -399,8 +399,7 @@ PresetsConfigSubstitutions PresetBundle::load_project_embedded_presets(std::vect
} }
try { try {
this->configs.load_project_embedded_presets(project_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule); this->configs.load_project_embedded_presets(project_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule);
} } catch (const std::runtime_error& err) {
catch (const std::runtime_error& err) {
errors_cummulative += err.what(); errors_cummulative += err.what();
} }
@ -618,8 +617,7 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(std::string user, For
std::string config_selected_preset_name = configs.get_selected_preset().name; std::string config_selected_preset_name = configs.get_selected_preset().name;
this->configs.load_presets(dir_user_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule); this->configs.load_presets(dir_user_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule);
configs.select_preset_by_name(config_selected_preset_name, false); configs.select_preset_by_name(config_selected_preset_name, false);
} } catch (const std::runtime_error& err) {
catch (const std::runtime_error& err) {
errors_cummulative += err.what(); errors_cummulative += err.what();
} }
if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative); if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative);
@ -1437,18 +1435,18 @@ std::vector<std::string> PresetBundle::merge_presets(PresetBundle &&other)
std::vector<std::string> duplicate_filaments = this->filaments .merge_presets(std::move(other.filaments), this->vendors); std::vector<std::string> duplicate_filaments = this->filaments .merge_presets(std::move(other.filaments), this->vendors);
std::vector<std::string> duplicate_sla_materials = this->sla_materials.merge_presets(std::move(other.sla_materials), this->vendors); std::vector<std::string> duplicate_sla_materials = this->sla_materials.merge_presets(std::move(other.sla_materials), this->vendors);
std::vector<std::string> duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors); std::vector<std::string> duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors);
std::vector<std::string> duplicate_configs = this->configs .merge_presets(std::move(other.configs), this->vendors); //std::vector<std::string> duplicate_configs = this->configs .merge_presets(std::move(other.configs), this->vendors);
append(this->obsolete_presets.prints, std::move(other.obsolete_presets.prints)); append(this->obsolete_presets.prints, std::move(other.obsolete_presets.prints));
append(this->obsolete_presets.sla_prints, std::move(other.obsolete_presets.sla_prints)); append(this->obsolete_presets.sla_prints, std::move(other.obsolete_presets.sla_prints));
append(this->obsolete_presets.filaments, std::move(other.obsolete_presets.filaments)); append(this->obsolete_presets.filaments, std::move(other.obsolete_presets.filaments));
append(this->obsolete_presets.sla_materials, std::move(other.obsolete_presets.sla_materials)); append(this->obsolete_presets.sla_materials, std::move(other.obsolete_presets.sla_materials));
append(this->obsolete_presets.printers, std::move(other.obsolete_presets.printers)); append(this->obsolete_presets.printers, std::move(other.obsolete_presets.printers));
append(this->obsolete_presets.configs, std::move(other.obsolete_presets.configs)); //append(this->obsolete_presets.configs, std::move(other.obsolete_presets.configs));
append(duplicate_prints, std::move(duplicate_sla_prints)); append(duplicate_prints, std::move(duplicate_sla_prints));
append(duplicate_prints, std::move(duplicate_filaments)); append(duplicate_prints, std::move(duplicate_filaments));
append(duplicate_prints, std::move(duplicate_sla_materials)); append(duplicate_prints, std::move(duplicate_sla_materials));
append(duplicate_prints, std::move(duplicate_printers)); append(duplicate_prints, std::move(duplicate_printers));
append(duplicate_configs, std::move(duplicate_configs)); //append(duplicate_configs, std::move(duplicate_configs));
return duplicate_prints; return duplicate_prints;
} }
@ -1644,38 +1642,48 @@ void PresetBundle::load_installed_sla_materials(AppConfig &config)
// Load selections (current print, current filaments, current printer) from config.ini // Load selections (current print, current filaments, current printer) from config.ini
// This is done on application start up or after updates are applied. // This is done on application start up or after updates are applied.
//从config.ini加载选择当前打印、当前灯丝、当前打印机
//这是在应用程序启动时或应用更新后完成的。
void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& preferred_selection/* = PresetPreferences()*/) void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& preferred_selection/* = PresetPreferences()*/)
{ {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": enter, preferred printer_model_id %1%")%preferred_selection.printer_model_id; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": enter, preferred printer_model_id %1%")%preferred_selection.printer_model_id;
// Update visibility of presets based on application vendor / model / variant configuration. // Update visibility of presets based on application vendor / model / variant configuration.
//根据应用程序供应商/型号/变体配置更新预设的可见性。
this->load_installed_printers(config); this->load_installed_printers(config);
// Update visibility of filament and sla material presets // Update visibility of filament and sla material presets
//更新灯丝和sla材料预设的可见性
this->load_installed_filaments(config); this->load_installed_filaments(config);
this->load_installed_sla_materials(config); this->load_installed_sla_materials(config);
this->load_installed_configs(config); this->load_installed_configs(config);
// Parse the initial print / filament / printer profile names. // Parse the initial print / filament / printer profile names.
//解析初始打印/灯丝/打印机配置文件名称。
std::string initial_print_profile_name = remove_ini_suffix(config.get("presets", PRESET_PRINT_NAME)); std::string initial_print_profile_name = remove_ini_suffix(config.get("presets", PRESET_PRINT_NAME));
std::string initial_sla_print_profile_name = remove_ini_suffix(config.get("presets", PRESET_SLA_PRINT_NAME)); std::string initial_sla_print_profile_name = remove_ini_suffix(config.get("presets", PRESET_SLA_PRINT_NAME));
std::string initial_filament_profile_name = remove_ini_suffix(config.get("presets", PRESET_FILAMENT_NAME)); std::string initial_filament_profile_name = remove_ini_suffix(config.get("presets", PRESET_FILAMENT_NAME));
std::string initial_sla_material_profile_name = remove_ini_suffix(config.get("presets", PRESET_SLA_MATERIALS_NAME)); std::string initial_sla_material_profile_name = remove_ini_suffix(config.get("presets", PRESET_SLA_MATERIALS_NAME));
std::string initial_printer_profile_name = remove_ini_suffix(config.get("presets", PRESET_PRINTER_NAME)); std::string initial_printer_profile_name = remove_ini_suffix(config.get("presets", PRESET_PRINTER_NAME));
std::string initial_config_profile_name = remove_ini_suffix(config.get("presets", PRESET_CONFIG_NAME)); std::string initial_config_profile_name = remove_ini_suffix(config.get("presets", PRESET_CONFIG_NAME));
// Activate print / filament / printer profiles from either the config, // Activate print / filament / printer profiles from either the config,
// or from the preferred_model_id suggestion passed in by ConfigWizard. // or from the preferred_model_id suggestion passed in by ConfigWizard.
// If the printer profile enumerated by the config are not visible, select an alternate preset. // If the printer profile enumerated by the config are not visible, select an alternate preset.
// Do not select alternate profiles for the print / filament profiles as those presets // Do not select alternate profiles for the print / filament profiles as those presets
// will be selected by the following call of this->update_compatible(PresetSelectCompatibleType::Always). // will be selected by the following call of this->update_compatible(PresetSelectCompatibleType::Always).
//从配置或ConfigWizard传递的首选_model_id建议中激活打印/灯丝/打印机配置文件。
//如果配置枚举的打印机配置文件不可见,请选择一个备用预设。
//不要为打印/灯丝配置文件选择替代配置文件,因为这些预设文件将通过以下调用来选择->update_compatiblePresetSelectCompatibleType:Always
const Preset *initial_printer = printers.find_preset(initial_printer_profile_name); const Preset *initial_printer = printers.find_preset(initial_printer_profile_name);
// If executed due to a Config Wizard update, preferred_printer contains the first newly installed printer, otherwise nullptr. // If executed due to a Config Wizard update, preferred_printer contains the first newly installed printer, otherwise nullptr.
//如果由于配置向导更新而执行则preferred_pinter包含第一个新安装的打印机否则为nullptr。
const Preset *preferred_printer = printers.find_system_preset_by_model_and_variant(preferred_selection.printer_model_id, preferred_selection.printer_variant); const Preset *preferred_printer = printers.find_system_preset_by_model_and_variant(preferred_selection.printer_model_id, preferred_selection.printer_variant);
printers.select_preset_by_name(preferred_printer ? preferred_printer->name : initial_printer_profile_name, true); printers.select_preset_by_name(preferred_printer ? preferred_printer->name : initial_printer_profile_name, true);
CNumericLocalesSetter locales_setter; CNumericLocalesSetter locales_setter;
//BBS: set default print/filament profiles to BBL's default setting //BBS: set default print/filament profiles to BBL's default setting
//BBS将默认打印/灯丝配置文件设置为BBL的默认设置
if (preferred_printer) if (preferred_printer)
{ {
const std::string& prefered_print_profile = preferred_printer->config.opt_string("default_print_profile"); const std::string& prefered_print_profile = preferred_printer->config.opt_string("default_print_profile");
@ -1688,6 +1696,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
} }
// Selects the profile, leaves it to -1 if the initial profile name is empty or if it was not found. // Selects the profile, leaves it to -1 if the initial profile name is empty or if it was not found.
//选择配置文件,如果初始配置文件名称为空或找不到,则将其保留为-1。
prints.select_preset_by_name_strict(initial_print_profile_name); prints.select_preset_by_name_strict(initial_print_profile_name);
filaments.select_preset_by_name_strict(initial_filament_profile_name); filaments.select_preset_by_name_strict(initial_filament_profile_name);
sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name); sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name);
@ -1698,6 +1707,9 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
// Load it even if the current printer technology is SLA. // Load it even if the current printer technology is SLA.
// The possibly excessive filament names will be later removed with this->update_multi_material_filament_presets() // The possibly excessive filament names will be later removed with this->update_multi_material_filament_presets()
// once the FFF technology gets selected. // once the FFF technology gets selected.
//加载为多材料打印机选择的其他灯丝轮廓的名称。
//即使当前的打印机技术是SLA也要加载它。
//一旦选择了FFF技术稍后将使用此->update_multi_material_filament_presets删除可能过多的灯丝名称。
this->filament_presets = { filaments.get_selected_preset_name() }; this->filament_presets = { filaments.get_selected_preset_name() };
for (unsigned int i = 1; i < 1000; ++ i) { for (unsigned int i = 1; i < 1000; ++ i) {
char name[64]; char name[64];
@ -1743,12 +1755,16 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
// Always try to select a compatible print and filament preset to the current printer preset, // Always try to select a compatible print and filament preset to the current printer preset,
// as the application may have been closed with an active "external" preset, which does not // as the application may have been closed with an active "external" preset, which does not
// exist. // exist.
//根据预设与活动打印机的兼容性更新预设的可见性。
//始终尝试选择与当前打印机预设兼容的打印和灯丝预设,因为应用程序可能已被不存在的活动“外部”预设关闭。
this->update_compatible(PresetSelectCompatibleType::Always); this->update_compatible(PresetSelectCompatibleType::Always);
this->update_multi_material_filament_presets(); this->update_multi_material_filament_presets();
if (initial_printer != nullptr && (preferred_printer == nullptr || initial_printer == preferred_printer)) { if (initial_printer != nullptr && (preferred_printer == nullptr || initial_printer == preferred_printer)) {
// Don't run the following code, as we want to activate default filament / SLA material profiles when installing and selecting a new printer. // Don't run the following code, as we want to activate default filament / SLA material profiles when installing and selecting a new printer.
// Only run this code if just a filament / SLA material was installed by Config Wizard for an active Printer. // Only run this code if just a filament / SLA material was installed by Config Wizard for an active Printer.
//不要运行以下代码,因为我们想在安装和选择新打印机时激活默认的长丝/SLA材料配置文件。
//仅当配置向导为活动打印机安装了灯丝/SLA材料时才运行此代码。
auto printer_technology = printers.get_selected_preset().printer_technology(); auto printer_technology = printers.get_selected_preset().printer_technology();
if (printer_technology == ptFFF && ! preferred_selection.filament.empty()) { if (printer_technology == ptFFF && ! preferred_selection.filament.empty()) {
std::string preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_FILAMENT, preferred_selection.filament); std::string preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_FILAMENT, preferred_selection.filament);
@ -1792,9 +1808,11 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
} }
// Parse the initial physical printer name. // Parse the initial physical printer name.
//解析初始物理打印机名称。
std::string initial_physical_printer_name = remove_ini_suffix(config.get("presets", "physical_printer")); std::string initial_physical_printer_name = remove_ini_suffix(config.get("presets", "physical_printer"));
// Activate physical printer from the config // Activate physical printer from the config
//从配置中激活物理打印机
if (!initial_physical_printer_name.empty()) if (!initial_physical_printer_name.empty())
physical_printers.select_printer(initial_physical_printer_name); physical_printers.select_printer(initial_physical_printer_name);
@ -1830,6 +1848,7 @@ void PresetBundle::export_selections(AppConfig &config)
config.set("presets", "flush_volumes_vector", flush_volumes_vector); config.set("presets", "flush_volumes_vector", flush_volumes_vector);
config.set("presets", PRESET_PRINTER_NAME, printers.get_selected_preset_name()); config.set("presets", PRESET_PRINTER_NAME, printers.get_selected_preset_name());
config.set("presets", PRESET_CONFIG_NAME, configs.get_selected_preset_name());
std::string flush_multiplier_str = boost::algorithm::join(project_config.option<ConfigOptionFloats>("flush_multiplier")->values | std::string flush_multiplier_str = boost::algorithm::join(project_config.option<ConfigOptionFloats>("flush_multiplier")->values |
boost::adaptors::transformed(static_cast<std::string (*)(double)>(std::to_string)), boost::adaptors::transformed(static_cast<std::string (*)(double)>(std::to_string)),

View File

@ -41,7 +41,7 @@ static const std::vector<std::string> filament_vendors = {"Polymaker", "OVERTURE
"Anycubic", "Basf", "ELEGOO", "INLAND", "FLASHFORGE", "FusRock", "AMOLEN", "MIKA3D", "3DXTECH", "Anycubic", "Basf", "ELEGOO", "INLAND", "FLASHFORGE", "FusRock", "AMOLEN", "MIKA3D", "3DXTECH",
"Duramic", "Priline", "Eryone", "3Dgunius", "Novamaker", "Justmaker", "Giantarm", "iProspect", "LDO"}; "Duramic", "Priline", "Eryone", "3Dgunius", "Novamaker", "Justmaker", "Giantarm", "iProspect", "LDO"};
static const std::vector<std::string> filament_types = {"PLA", "PLA+", "PLA Tough", "PETG", "ABS", "ASA", "FLEX", "HIPS", "PA", "PACF", static const std::vector<std::string> filament_types = {"CFC","PLA", "PLA+", "PLA Tough", "PETG", "ABS", "ASA", "FLEX", "HIPS", "PA", "PACF",
"NYLON", "PVA", "PC", "PCABS", "PCTG", "PCCF", "PP", "PEI", "PET", "PETG", "NYLON", "PVA", "PC", "PCABS", "PCTG", "PCCF", "PP", "PEI", "PET", "PETG",
"PETGCF", "PTBA", "PTBA90A", "PEEK", "TPU93A", "TPU75D", "TPU","TPU-AMS", "TPU92A", "TPU98A", "Misc", "PETGCF", "PTBA", "PTBA90A", "PEEK", "TPU93A", "TPU75D", "TPU","TPU-AMS", "TPU92A", "TPU98A", "Misc",
"TPE", "GLAZE", "Nylon", "CPE", "METAL", "ABST", "Carbon Fiber"}; "TPE", "GLAZE", "Nylon", "CPE", "METAL", "ABST", "Carbon Fiber"};
@ -1344,6 +1344,7 @@ void CreateFilamentPresetDialog::get_all_filament_presets()
m_all_presets_map[filament_preset_name] = filament_preset; m_all_presets_map[filament_preset_name] = filament_preset;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " loaded preset name is: " << filament_preset->name; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " loaded preset name is: " << filament_preset->name;
} }
m_system_filament_types_set.insert("CFC");
} }
void CreateFilamentPresetDialog::get_all_visible_printer_name() void CreateFilamentPresetDialog::get_all_visible_printer_name()

View File

@ -83,6 +83,10 @@ void FilamentMapManualPanel::OnSwitchFilament(wxCommandEvent &)
auto right_blocks = m_right_panel->get_filament_blocks(); auto right_blocks = m_right_panel->get_filament_blocks();
for (auto &block : left_blocks) { for (auto &block : left_blocks) {
std::string type = block->GetType();
/*if (type.find("CFC") != std::string::npos) {
show_error(this, _L("test1212121212121212121212"));
}*/
m_right_panel->AddColorBlock(block->GetColor(), block->GetType(), block->GetFilamentId(), false); m_right_panel->AddColorBlock(block->GetColor(), block->GetType(), block->GetFilamentId(), false);
m_left_panel->RemoveColorBlock(block, false); m_left_panel->RemoveColorBlock(block, false);
} }

View File

@ -13699,16 +13699,20 @@ void Plater::export_gcode(bool prefer_removable)
} }
//std::this_thread::sleep_for(std::chrono::seconds(5)); //std::this_thread::sleep_for(std::chrono::seconds(5));
//output_path = "E:\\Downloads\\Download\\123.gcode"; //output_path = "E:\\Downloads\\Download\\123.gcode";
/* std::string temp_file = output_path.string(); std::string temp_file = output_path.string();
size_t pos = temp_file.find(".gcode"); size_t pos = temp_file.find(".gcode");
if (pos != std::string::npos) { if (pos != std::string::npos) {
temp_file.replace(pos, 5, "-process"); temp_file.replace(pos, 5, "-process");
} }
temp_file = temp_file + ".gcode";*/
std::string copy_file = output_path.parent_path().string() + "\\copyFile.gcode";
std::string temp_file = output_path.parent_path().string() + "\\tempFile.gcode";
temp_file = temp_file + ".gcode";
wxString abc = wxString::FromUTF8(temp_file);
std::string copy_file = output_path.parent_path().string() + "\\copyFile.gcode";
//std::string temp_file = output_path.parent_path().string() + "\\tempFile.gcode";
temp_file = abc.c_str();
std::this_thread::sleep_for(std::chrono::seconds(3));
fs::copy(output_path, copy_file); fs::copy(output_path, copy_file);
//std::this_thread::sleep_for(std::chrono::seconds(3));
std::ifstream inFile(copy_file); std::ifstream inFile(copy_file);
std::ofstream tempFile(temp_file); std::ofstream tempFile(temp_file);
double total_length = 50 * 1000; double total_length = 50 * 1000;
@ -13839,7 +13843,7 @@ void Plater::export_gcode(bool prefer_removable)
//fs::remove(output_path); //fs::remove(output_path);
//std::rename("temp.txt", "original.txt"); //std::rename("temp.txt", "original.txt");
//std::this_thread::sleep_for(std::chrono::seconds(4)); //std::this_thread::sleep_for(std::chrono::seconds(4));
fs::rename(temp_file, output_path); //fs::rename(temp_file, output_path);
} }
Point Plater::interpolate(const Point& p1, const Point& p2, double t) { Point Plater::interpolate(const Point& p1, const Point& p2, double t) {

View File

@ -1217,12 +1217,36 @@ void PlaterPresetComboBox::update()
tooltip = get_tooltip(preset); tooltip = get_tooltip(preset);
} }
} }
//BBS: move system to the end //BBS: move system to the end
//if (i + 1 == m_collection->num_default_presets()) //if (i + 1 == m_collection->num_default_presets())
// set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); // set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
} }
//if (m_type == Preset::TYPE_PRINTER) wxString lian_xu = _L("Lian xu");
// add_connected_printers("", true); bool m_fold = false;
if (m_type == Preset::TYPE_CONFIG) {
for (auto& f : m_preset_bundle->filament_presets) {
wxString abc = wxString::FromUTF8(f);
if (m_fold = abc.Contains(lian_xu)) {
break;
}
}
if (m_fold) {
temp_presets.clear();
for (const auto& pair : nonsys_presets) {
wxString key = pair.first;
if (key.Contains(lian_xu)) {
temp_presets.emplace(pair);
}
}
nonsys_presets.clear();
//nonsys_presets.emplace(temp_presets);
nonsys_presets.insert(temp_presets.begin(), temp_presets.end());
}
}
if (m_type == Preset::TYPE_PRINTER)
add_connected_printers("", true);
bool selected_in_ams = false; bool selected_in_ams = false;
if (m_type == Preset::TYPE_FILAMENT) { if (m_type == Preset::TYPE_FILAMENT) {
set_replace_text("Bambu", "BambuStudioBlack"); set_replace_text("Bambu", "BambuStudioBlack");
@ -1280,42 +1304,55 @@ void PlaterPresetComboBox::update()
} }
} }
}; };
//if (m_type == Preset::TYPE_CONFIG) {
// wxString lian_xu = _L("Lian xu");
// bool m_fold = false;
// for (auto& f : m_preset_bundle->filament_presets) {
// wxString abc = wxString::FromUTF8(f);
// if (m_fold = abc.Contains(lian_xu)) {
// break;
// }
// }
// /* wxString lian_xu = _L("Lian xu");
// bool m_fold = false;
// auto full_config = wxGetApp().preset_bundle->full_config();
// std::vector<std::string> filament_types = full_config.option<ConfigOptionStrings>("filament_type")->values;
// for (std::string type : filament_types) {
// if ( type.find("CFC") != std::string::npos) {
// m_fold = true;
// break;
// }
// }*/
// if (m_fold) {
// /* for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
// wxString key = it->first;
// temp_presets.insert
// }*/
// temp_presets.clear();
// for (const auto& pair : nonsys_presets) {
// wxString key = pair.first;
// if (key.Contains(lian_xu)) {
// temp_presets.emplace(pair);
// }
// }
// for (std::map<wxString, wxBitmap*>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) {
// SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
// validate_selection(it->first == selected_user_preset);
// }
// //add_presets(temp_presets, selected_user_preset, "");
// }
// else {
// for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
// SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
// validate_selection(it->first == selected_user_preset);
// }
// //add_presets(nonsys_presets, selected_user_preset, L("User presets"));
// //add_presets(nonsys_presets, selected_user_preset, "");
// }
if (m_type == Preset::TYPE_CONFIG) { if (m_type == Preset::TYPE_CONFIG) {
wxString lian_xu = _L("Lian xu"); for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
bool m_fold = false; SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
//m_preset_bundle->filament_presets validate_selection(it->first == selected_user_preset);
for (auto& f : m_preset_bundle->filament_presets) {
wxString abc = wxString::FromUTF8(f);
if (m_fold = abc.Contains(lian_xu)) {
break;
}
}
if (m_fold) {
/* for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
wxString key = it->first;
temp_presets.insert
}*/
temp_presets.clear();
for (const auto& pair : nonsys_presets) {
wxString key = pair.first;
if (key.Contains(lian_xu)) {
temp_presets.emplace(pair);
}
}
for (std::map<wxString, wxBitmap*>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) {
SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
validate_selection(it->first == selected_user_preset);
}
//add_presets(temp_presets, selected_user_preset, "");
}
else {
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
validate_selection(it->first == selected_user_preset);
}
//add_presets(nonsys_presets, selected_user_preset, L("User presets"));
//add_presets(nonsys_presets, selected_user_preset, "");
} }
} }
else { else {
@ -1507,6 +1544,8 @@ void TabPresetComboBox::update()
if (preset.is_system) if (preset.is_system)
preset_descriptions.emplace(name, _L(preset.description)); preset_descriptions.emplace(name, _L(preset.description));
if (preset.is_default || preset.is_system) { if (preset.is_default || preset.is_system) {
//BBS: move system to the end //BBS: move system to the end
system_presets.emplace(name, std::pair<wxBitmap *, bool>(bmp, is_enabled)); system_presets.emplace(name, std::pair<wxBitmap *, bool>(bmp, is_enabled));
@ -1536,15 +1575,9 @@ void TabPresetComboBox::update()
//if (i + 1 == m_collection->num_default_presets()) //if (i + 1 == m_collection->num_default_presets())
// set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); // set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
} }
wxString lian_xu = _L("Lian xu");
if (m_type == Preset::TYPE_FILAMENT) bool m_fold = false;
add_ams_filaments(into_u8(selected));
//BBS: add project embedded preset logic
if (m_type == Preset::TYPE_CONFIG) { if (m_type == Preset::TYPE_CONFIG) {
wxString lian_xu = _L("Lian xu");
bool m_fold = false;
//m_preset_bundle->filament_presets
for (auto& f : m_preset_bundle->filament_presets) { for (auto& f : m_preset_bundle->filament_presets) {
wxString abc = wxString::FromUTF8(f); wxString abc = wxString::FromUTF8(f);
if (m_fold = abc.Contains(lian_xu)) { if (m_fold = abc.Contains(lian_xu)) {
@ -1552,10 +1585,6 @@ void TabPresetComboBox::update()
} }
} }
if (m_fold) { if (m_fold) {
/* for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
wxString key = it->first;
temp_presets.insert
}*/
temp_presets.clear(); temp_presets.clear();
for (const auto& pair : nonsys_presets) { for (const auto& pair : nonsys_presets) {
wxString key = pair.first; wxString key = pair.first;
@ -1563,24 +1592,74 @@ void TabPresetComboBox::update()
temp_presets.emplace(pair); temp_presets.emplace(pair);
} }
} }
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) { nonsys_presets.clear();
int item_id = Append(it->first, *it->second.first); //nonsys_presets.emplace(temp_presets);
SetItemTooltip(item_id, preset_descriptions[it->first]); nonsys_presets.insert(temp_presets.begin(), temp_presets.end());
bool is_enabled = it->second.second;
if (!is_enabled)
set_label_marker(item_id, LABEL_ITEM_DISABLED);
validate_selection(it->first == selected);
}
} }
else { }
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { if (m_type == Preset::TYPE_FILAMENT)
int item_id = Append(it->first, *it->second.first); add_ams_filaments(into_u8(selected));
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second; //BBS: add project embedded preset logic
if (!is_enabled) //if (m_type == Preset::TYPE_CONFIG) {
set_label_marker(item_id, LABEL_ITEM_DISABLED); // wxString lian_xu = _L("Lian xu");
validate_selection(it->first == selected); // bool m_fold = false;
} // for (auto& f : m_preset_bundle->filament_presets) {
// wxString abc = wxString::FromUTF8(f);
// if (m_fold = abc.Contains(lian_xu)) {
// break;
// }
// }
// /* wxString lian_xu = _L("Lian xu");
// bool m_fold = false;
// auto full_config = wxGetApp().preset_bundle->full_config();
// std::vector<std::string> filament_types = full_config.option<ConfigOptionStrings>("filament_type")->values;
// for (std::string type : filament_types) {
// if (type.find("CFC") != std::string::npos) {
// m_fold = true;
// break;
// }
// }*/
// if (m_fold) {
// /* for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
// wxString key = it->first;
// temp_presets.insert
// }*/
// temp_presets.clear();
// for (const auto& pair : nonsys_presets) {
// wxString key = pair.first;
// if (key.Contains(lian_xu)) {
// temp_presets.emplace(pair);
// }
// }
// for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) {
// int item_id = Append(it->first, *it->second.first);
// SetItemTooltip(item_id, preset_descriptions[it->first]);
// bool is_enabled = it->second.second;
// if (!is_enabled)
// set_label_marker(item_id, LABEL_ITEM_DISABLED);
// validate_selection(it->first == selected);
// }
// if (m_type == Preset::TYPE_CONFIG) {
// }
// else {
// for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
// int item_id = Append(it->first, *it->second.first);
// SetItemTooltip(item_id, preset_descriptions[it->first]);
// bool is_enabled = it->second.second;
// if (!is_enabled)
// set_label_marker(item_id, LABEL_ITEM_DISABLED);
// validate_selection(it->first == selected);
// }
// }
if (m_type == Preset::TYPE_CONFIG) {
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
int item_id = Append(it->first, *it->second.first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second;
if (!is_enabled)
set_label_marker(item_id, LABEL_ITEM_DISABLED);
validate_selection(it->first == selected);
} }
} }
else { else {

View File

@ -882,7 +882,7 @@ void Tab::update_changed_ui()
return; return;
const bool deep_compare = (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_PRINT || m_type == Preset::TYPE_FILAMENT const bool deep_compare = (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_PRINT || m_type == Preset::TYPE_FILAMENT
|| m_type == Preset::TYPE_SLA_MATERIAL || m_type == Preset::TYPE_MODEL); || m_type == Preset::TYPE_SLA_MATERIAL || m_type == Preset::TYPE_MODEL || m_type == Preset::TYPE_CONFIG);
auto dirty_options = m_presets->current_dirty_options(deep_compare); auto dirty_options = m_presets->current_dirty_options(deep_compare);
auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare); auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare);
if (m_type == Preset::TYPE_PRINTER && static_cast<TabPrinter*>(this)->m_printer_technology == ptFFF) { if (m_type == Preset::TYPE_PRINTER && static_cast<TabPrinter*>(this)->m_printer_technology == ptFFF) {
@ -3856,12 +3856,13 @@ void TabFilament::toggle_options()
//if (m_active_page->title() == "Setting Overrides") //if (m_active_page->title() == "Setting Overrides")
// update_filament_overrides_page(); // update_filament_overrides_page();
wxString abc = wxString::FromUTF8(m_preset_bundle->filaments.get_edited_preset().name); //wxString abc = wxString::FromUTF8(m_preset_bundle->filaments.get_edited_preset().name);
std::string type; std::string type;
m_preset_bundle->filaments.get_edited_preset().get_filament_type(type); m_preset_bundle->filaments.get_edited_preset().get_filament_type(type);
//CFC //CFC
wxString lian_xu = _L("Lian xu"); //wxString lian_xu = _L("Lian xu");
if (abc.Contains(lian_xu)) { //if (abc.Contains(lian_xu)) {
if (type.find("CFC") != std::string::npos) {
if (m_active_page->title() == "Filament") if (m_active_page->title() == "Filament")
{ {
toggle_option("filament_type", false); toggle_option("filament_type", false);
@ -4211,29 +4212,32 @@ void TabConfig::reload_config()
this->compatible_widget_reload(m_compatible_printers); this->compatible_widget_reload(m_compatible_printers);
Tab::reload_config(); Tab::reload_config();
} }
//void TabConfig::update_description_lines()
//{ void TabConfig::update_description_lines()
// Tab::update_description_lines(); {
// Tab::update_description_lines();
// if (!m_active_page)
// return; if (!m_active_page)
// return;
// //if (m_active_page->title() == "Cooling" && m_cooling_description_line)
// // m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()))); //if (m_active_page->title() == "Cooling" && m_cooling_description_line)
// //BBS // m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset())));
// //if (m_active_page->title() == "Filament" && m_volumetric_speed_description_line) //BBS
// // this->update_volumetric_flow_preset_hints(); //if (m_active_page->title() == "Filament" && m_volumetric_speed_description_line)
//} // this->update_volumetric_flow_preset_hints();
}
void TabConfig::toggle_options() { void TabConfig::toggle_options() {
if (!m_active_page) if (!m_active_page)
return; return;
if (m_preset_bundle) { if (m_preset_bundle) {
bool is_BBL_printer = m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle); bool is_BBL_printer = m_preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle);
m_config_manipulation.set_is_BBL_Printer(is_BBL_printer); m_config_manipulation.set_is_BBL_Printer(is_BBL_printer);
} }
m_config_manipulation.toggle_print_fff_options(m_config, m_type < Preset::TYPE_COUNT); m_config_manipulation.toggle_print_fff_options(m_config, m_type < Preset::TYPE_COUNT);
//m_config_manipulation.toggle_print_fff_options(m_config, int(intptr_t(m_extruder_switch->GetClientData())), m_type < Preset::TYPE_COUNT);
bool enable_support = m_preset_bundle->prints.get_edited_preset().config.opt_bool("enable_support"); bool enable_support = m_preset_bundle->prints.get_edited_preset().config.opt_bool("enable_support");
for (auto el : { "support_style", "support_base_pattern", for (auto el : { "support_style", "support_base_pattern",
@ -4470,6 +4474,7 @@ void TabConfig::update() {
m_update_cnt++; m_update_cnt++;
m_config_manipulation.update_print_fff_config(m_config, m_type < Preset::TYPE_COUNT, m_type == Preset::TYPE_PLATE); m_config_manipulation.update_print_fff_config(m_config, m_type < Preset::TYPE_COUNT, m_type == Preset::TYPE_PLATE);
update_description_lines();
m_parent->Layout(); m_parent->Layout();
m_update_cnt--; m_update_cnt--;

View File

@ -589,7 +589,7 @@ public:
void build() override; void build() override;
void reload_config() override; void reload_config() override;
//void update_description_lines() override; void update_description_lines() override;
void toggle_options() override; void toggle_options() override;
void update() override; void update() override;
void clear_pages() override; void clear_pages() override;