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
PlateDataPtrs plate_data_src;
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;
Semver file_version;
std::map<size_t, bool> orients_requirement;
@ -1545,6 +1545,20 @@ int CLI::run(int argc, char **argv)
m_models.clear();
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") {
for (auto& model : m_models) {
if (model.looks_like_saved_in_meters()) {

View file

@ -5043,6 +5043,12 @@ CLITransformConfigDef::CLITransformConfigDef()
//def->cli = "arrange|a";
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->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.");