ENH: add func to get filament hrc by type
1.Support get filament required hrc by filament type jira:STUDIO-3518 Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: If0c1699331b75da17380b9eeca7bb155d98a14c2
This commit is contained in:
parent
580ce10570
commit
c00f944308
|
@ -1273,6 +1273,28 @@ const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& p
|
|||
return presets.get_preset_name_by_alias(alias);
|
||||
}
|
||||
|
||||
//BBS: get filament required hrc by filament type
|
||||
const int PresetBundle::get_required_hrc_by_filament_type(const std::string& filament_type) const
|
||||
{
|
||||
static std::unordered_map<std::string, int>filament_type_to_hrc;
|
||||
if (filament_type_to_hrc.empty()) {
|
||||
for (auto iter = filaments.m_presets.begin(); iter != filaments.m_presets.end(); iter++) {
|
||||
if (iter->vendor && iter->vendor->id == "BBL") {
|
||||
if (iter->config.has("filament_type") && iter->config.has("required_nozzle_HRC")) {
|
||||
auto type = iter->config.opt_string("filament_type", 0);
|
||||
auto hrc = iter->config.opt_int("required_nozzle_HRC", 0);
|
||||
filament_type_to_hrc[type] = hrc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
auto iter = filament_type_to_hrc.find(filament_type);
|
||||
if (iter != filament_type_to_hrc.end())
|
||||
return iter->second;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//BBS: add project embedded preset logic
|
||||
void PresetBundle::save_changes_for_preset(const std::string& new_name, Preset::Type type,
|
||||
const std::vector<std::string>& unselected_options, bool save_to_project)
|
||||
|
|
|
@ -205,6 +205,7 @@ public:
|
|||
|
||||
const std::string& get_preset_name_by_alias(const Preset::Type& preset_type, const std::string& alias) const;
|
||||
|
||||
const int get_required_hrc_by_filament_type(const std::string& filament_type) const;
|
||||
// Save current preset of a provided type under a new name. If the name is different from the old one,
|
||||
// Unselected option would be reverted to the beginning values
|
||||
//BBS: add project embedded preset logic
|
||||
|
|
Loading…
Reference in New Issue