ENH: CLI: add option repetitions for future use

Change-Id: I97bdc04b542f9725a047348450c2c677d8807427
(cherry picked from commit d5a20f689cade6cc5b28bbec70931c6d122ef6f4)
This commit is contained in:
lane.wei 2023-06-28 20:30:41 +08:00 committed by Lane.Wei
parent 699cc2cf44
commit 7c76cf99b9
2 changed files with 23 additions and 3 deletions

View file

@ -497,7 +497,7 @@ int CLI::run(int argc, char **argv)
//BBS: add plate data related logic //BBS: add plate data related logic
PlateDataPtrs plate_data_src; PlateDataPtrs plate_data_src;
int arrange_option; int arrange_option;
int plate_to_slice = 0, filament_count = 0; int plate_to_slice = 0, filament_count = 0, duplicate_count = 0;
bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true; bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true;
Semver file_version; Semver file_version;
std::map<size_t, bool> orients_requirement; std::map<size_t, bool> orients_requirement;
@ -1545,6 +1545,20 @@ int CLI::run(int argc, char **argv)
m_models.clear(); m_models.clear();
m_models.emplace_back(std::move(m));*/ m_models.emplace_back(std::move(m));*/
} }
else if (opt_key == "repetitions") {
int repetitions_count = m_config.option<ConfigOptionInt>("repetitions")->value;
if (repetitions_count <= 1)
{
BOOST_LOG_TRIVIAL(info) << "invalid repetitions value " << repetitions_count << ", just skip\n";
}
else {
//todo
//copy model objects and instances
BOOST_LOG_TRIVIAL(info) << "repetitions value " << repetitions_count << ", will copy model object first\n";
need_arrange = true;
duplicate_count = repetitions_count - 1;
}
}
else if (opt_key == "convert_unit") { else if (opt_key == "convert_unit") {
for (auto& model : m_models) { for (auto& model : m_models) {
if (model.looks_like_saved_in_meters()) { if (model.looks_like_saved_in_meters()) {

View file

@ -1462,7 +1462,7 @@ void PrintConfigDef::init_fff_params()
def->max = 100; def->max = 100;
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercent(50)); def->set_default_value(new ConfigOptionPercent(50));
def = this->add("default_jerk", coFloat); def = this->add("default_jerk", coFloat);
def->label = L("Default"); def->label = L("Default");
def->tooltip = L("Default jerk"); def->tooltip = L("Default jerk");
@ -1622,7 +1622,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Filter out gaps smaller than the threshold specified. This setting won't affact top/bottom layers"); def->tooltip = L("Filter out gaps smaller than the threshold specified. This setting won't affact top/bottom layers");
def->mode = comDevelop; def->mode = comDevelop;
def->set_default_value(new ConfigOptionFloat(0)); def->set_default_value(new ConfigOptionFloat(0));
def = this->add("gap_infill_speed", coFloat); def = this->add("gap_infill_speed", coFloat);
def->label = L("Gap infill"); def->label = L("Gap infill");
def->category = L("Speed"); def->category = L("Speed");
@ -5043,6 +5043,12 @@ CLITransformConfigDef::CLITransformConfigDef()
//def->cli = "arrange|a"; //def->cli = "arrange|a";
def->set_default_value(new ConfigOptionInt(0)); def->set_default_value(new ConfigOptionInt(0));
def = this->add("repetitions", coInt);
def->label = L("Repetions count");
def->tooltip = L("Repetions count of the whole model");
def->cli_params = "count";
def->set_default_value(new ConfigOptionInt(1));
/*def = this->add("ensure_on_bed", coBool); /*def = this->add("ensure_on_bed", coBool);
def->label = L("Ensure on bed"); def->label = L("Ensure on bed");
def->tooltip = L("Lift the object above the bed when it is partially below. Enabled by default, use --no-ensure-on-bed to disable."); def->tooltip = L("Lift the object above the bed when it is partially below. Enabled by default, use --no-ensure-on-bed to disable.");