mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-07 07:17:43 -07:00
ENH: CLI: set -1 to default value of filament_map
jira: no-jira Change-Id: I12300737061acd1c3e024a3424d3d46a53cf526f (cherry picked from commit 190904c68f9ddb49df31d7d7e757d780c7876d6e)
This commit is contained in:
parent
213aa92f8d
commit
14fed10ce6
1 changed files with 38 additions and 0 deletions
|
|
@ -5742,6 +5742,7 @@ int CLI::run(int argc, char **argv)
|
|||
mode = m_extra_config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode")->value;
|
||||
else
|
||||
mode = part_plate->get_real_filament_map_mode(m_print_config);
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1% :filament map mode is %2% ") % __LINE__ %(int)mode;
|
||||
if (mode < FilamentMapMode::fmmManual) {
|
||||
std::vector<int> conflict_filament_vector;
|
||||
for (int index = 0; index < new_extruder_count; index++)
|
||||
|
|
@ -5778,6 +5779,43 @@ int CLI::run(int argc, char **argv)
|
|||
std::vector<int> filament_maps;
|
||||
if (m_extra_config.option<ConfigOptionInts>("filament_map")) {
|
||||
filament_maps = m_extra_config.option<ConfigOptionInts>("filament_map")->values;
|
||||
int default_value = -1;
|
||||
bool has_invalid_value = false;
|
||||
for (int f_index = 0; f_index < filament_maps.size(); f_index++)
|
||||
{
|
||||
if (filament_maps[f_index] != -1)
|
||||
{
|
||||
if (default_value == -1)
|
||||
default_value = filament_maps[f_index];
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
has_invalid_value = true;
|
||||
|
||||
if (has_invalid_value && (default_value != -1))
|
||||
break;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1% :filament map default_value %2%, has_invalid_value %3% ") % __LINE__ %default_value %has_invalid_value;
|
||||
|
||||
if (has_invalid_value)
|
||||
{
|
||||
for (int f_index = 0; f_index < filament_maps.size(); f_index++)
|
||||
{
|
||||
if (filament_maps[f_index] == -1)
|
||||
{
|
||||
if (default_value != -1) {
|
||||
filament_maps[f_index] = default_value;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("plate %1% : set filament_map of filament %2% to first value %3%.")% (index + 1) %(f_index+1) %default_value;
|
||||
}
|
||||
else {
|
||||
filament_maps[f_index] = 1;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("plate %1% : set filament_map of filament %2% to default value 1.")% (index + 1) %(f_index+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_extra_config.option<ConfigOptionInts>("filament_map")->values = filament_maps;
|
||||
}
|
||||
part_plate->set_filament_maps(filament_maps);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue