ENH: CLI: add normative_check logic
Change-Id: I7a02fefb2a161b27a35ad73102d8c57dbffa7c6b (cherry picked from commit 3de468b341e95336611ff527453160131ec04b65)
This commit is contained in:
parent
e2d6ed99d1
commit
e2f96590cf
|
@ -490,7 +490,7 @@ int CLI::run(int argc, char **argv)
|
|||
PlateDataPtrs plate_data_src;
|
||||
int arrange_option;
|
||||
int plate_to_slice = 0, filament_count = 0;
|
||||
bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false;
|
||||
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;
|
||||
std::vector<Preset*> project_presets;
|
||||
|
@ -504,6 +504,9 @@ int CLI::run(int argc, char **argv)
|
|||
ConfigOptionInt* slice_option = m_config.option<ConfigOptionInt>("slice");
|
||||
if (slice_option)
|
||||
plate_to_slice = slice_option->value;
|
||||
ConfigOptionBool* normative_check_option = m_config.option<ConfigOptionBool>("normative_check");
|
||||
if (normative_check_option)
|
||||
normative_check = normative_check_option->value;
|
||||
ConfigOptionBool* uptodate_option = m_config.option<ConfigOptionBool>("uptodate");
|
||||
if (uptodate_option)
|
||||
up_config_to_date = uptodate_option->value;
|
||||
|
@ -513,7 +516,7 @@ int CLI::run(int argc, char **argv)
|
|||
BOOST_LOG_TRIVIAL(info) << "found a gcode file:" << file << ", will start as gcode viewer\n";
|
||||
break;
|
||||
}*/
|
||||
BOOST_LOG_TRIVIAL(info) << "plate_to_slice="<< plate_to_slice << std::endl;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("plate_to_slice=%1%, normative_check=%2%")%plate_to_slice %normative_check;
|
||||
//if (!start_as_gcodeviewer) {
|
||||
for (const std::string& file : m_input_files) {
|
||||
if (!boost::filesystem::exists(file)) {
|
||||
|
@ -563,6 +566,17 @@ int CLI::run(int argc, char **argv)
|
|||
BOOST_LOG_TRIVIAL(info) << boost::format("old 3mf version %1%, need to translate")%file_version.to_string();
|
||||
}
|
||||
|
||||
if (normative_check) {
|
||||
ConfigOptionStrings* postprocess_scripts = config.option<ConfigOptionStrings>("post_process");
|
||||
if (postprocess_scripts) {
|
||||
std::vector<std::string> postprocess_values = postprocess_scripts->values;
|
||||
if (postprocess_values.size() > 0) {
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("normative_check: postprocess not supported, array size %1%")%postprocess_values.size();
|
||||
flush_and_exit(CLI_POSTPROCESS_NOT_SUPPORTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*for (ModelObject *model_object : model.objects)
|
||||
for (ModelInstance *model_instance : model_object->instances)
|
||||
{
|
||||
|
|
|
@ -4638,6 +4638,13 @@ CLIActionsConfigDef::CLIActionsConfigDef()
|
|||
def->cli_params = "option";
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("normative_check", coBool);
|
||||
def->label = L("Normative check");
|
||||
def->tooltip = L("Check the normative items.");
|
||||
def->cli = "normative_check";
|
||||
def->cli_params = "option";
|
||||
def->set_default_value(new ConfigOptionBool(true));
|
||||
|
||||
/*def = this->add("help_fff", coBool);
|
||||
def->label = L("Help (FFF options)");
|
||||
def->tooltip = L("Show the full list of print/G-code configuration options.");
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define CLI_3MF_NEW_MACHINE_NOT_SUPPORTED -16
|
||||
#define CLI_PROCESS_NOT_COMPATIBLE -17
|
||||
#define CLI_INVALID_VALUES_IN_3MF -18
|
||||
#define CLI_POSTPROCESS_NOT_SUPPORTED -19
|
||||
|
||||
|
||||
#define CLI_NO_SUITABLE_OBJECTS -50
|
||||
|
|
Loading…
Reference in New Issue