ENH: cli: add pre-check logic when slicing all
Change-Id: Ib13a5dd11175c0835b7a1362317941aa6a04474b (cherry picked from commit a6f7ad231e5694ce12f9fd34518425f31c3bb5bd)
This commit is contained in:
parent
b2c457eec6
commit
088f2a4ace
1 changed files with 182 additions and 196 deletions
|
@ -376,13 +376,13 @@ int CLI::run(int argc, char **argv)
|
|||
char *debug_argv[] = {
|
||||
"E:\work\projects\bambu_release\bamboo_slicer\build_debug\src\Debug\bambu-studio.exe",
|
||||
"--slice",
|
||||
"9",
|
||||
"0",
|
||||
//"--load-settings",
|
||||
//"machine.json;process.json",
|
||||
//"--load-filaments",
|
||||
//"filament.json",
|
||||
"--export-3mf=output.3mf",
|
||||
"test_outside.3mf"
|
||||
"test_cube.3mf"
|
||||
};
|
||||
if (! this->setup(debug_argc, debug_argv))*/
|
||||
if (!this->setup(argc, argv))
|
||||
|
@ -1800,6 +1800,10 @@ int CLI::run(int argc, char **argv)
|
|||
} else if (opt_key == "slice") {
|
||||
//BBS: slice 0 means all plates, i means plate i;
|
||||
plate_to_slice = m_config.option<ConfigOptionInt>("slice")->value;
|
||||
bool pre_check = (plate_to_slice == 0)?true:false;
|
||||
if (partplate_list.get_plate_count() == 1)
|
||||
pre_check = false;
|
||||
bool finished = false;
|
||||
/*if (opt_key == "export_gcode" && printer_technology == ptSLA) {
|
||||
boost::nowide::cerr << "error: cannot export G-code for an FFF configuration" << std::endl;
|
||||
flush_and_exit(1);
|
||||
|
@ -1822,16 +1826,9 @@ int CLI::run(int argc, char **argv)
|
|||
// and all instances will be rearranged (unless --dont-arrange is supplied).
|
||||
std::string outfile;
|
||||
Print fff_print;
|
||||
/*SLAPrint sla_print;
|
||||
SL1Archive sla_archive(sla_print.printer_config());
|
||||
sla_print.set_printer(&sla_archive);
|
||||
sla_print.set_status_callback(
|
||||
[](const PrintBase::SlicingStatus& s)
|
||||
{
|
||||
if(s.percent >= 0) // FIXME: is this sufficient?
|
||||
printf("%3d%s %s\n", s.percent, "% =>", s.text.c_str());
|
||||
});*/
|
||||
|
||||
while(!finished)
|
||||
{
|
||||
//BBS: slice every partplate one by one
|
||||
PrintBase *print=NULL;
|
||||
Slic3r::GUI::GCodeResult *gcode_result = NULL;
|
||||
|
@ -1905,25 +1902,6 @@ int CLI::run(int argc, char **argv)
|
|||
//BOOST_LOG_TRIVIAL(info) << boost::format("print_volume {%1%,%2%,%3%}->{%4%, %5%, %6%}, has %7% printables") % print_volume.min(0) % print_volume.min(1)
|
||||
// % print_volume.min(2) % print_volume.max(0) % print_volume.max(1) % print_volume.max(2) % count << std::endl;
|
||||
#endif
|
||||
|
||||
//PrintBase *print = (printer_technology == ptFFF) ? static_cast<PrintBase*>(&fff_print) : static_cast<PrintBase*>(&sla_print);
|
||||
/*if (! m_config.opt_bool("dont_arrange")) {
|
||||
if (user_center_specified) {
|
||||
Vec2d c = m_config.option<ConfigOptionPoint>("center")->value;
|
||||
arrange_objects(model, InfiniteBed{scaled(c)}, arrange_cfg);
|
||||
} else
|
||||
arrange_objects(model, bed, arrange_cfg);
|
||||
}*/
|
||||
/*if (printer_technology == ptFFF) {
|
||||
for (auto* mo : model.objects)
|
||||
(dynamic_cast<Print*>(print))->auto_assign_extruders(mo);
|
||||
} else {
|
||||
// The default for "filename_format" is good for FDM: "[input_filename_base].gcode"
|
||||
// Replace it with a reasonable SLA default.
|
||||
std::string &format = m_print_config.opt_string("filename_format", true);
|
||||
if (format == static_cast<const ConfigOptionString*>(m_print_config.def()->get("filename_format")->default_value.get())->value)
|
||||
format = "[input_filename_base].SL1";
|
||||
}*/
|
||||
DynamicPrintConfig new_print_config = m_print_config;
|
||||
new_print_config.apply(*part_plate->config());
|
||||
new_print_config.apply(m_extra_config, true);
|
||||
|
@ -1944,7 +1922,9 @@ int CLI::run(int argc, char **argv)
|
|||
BOOST_LOG_TRIVIAL(error) << "plate "<< index+1<< ": Nothing to be sliced, Either the print is empty or no object is fully inside the print volume after apply." << std::endl;
|
||||
flush_and_exit(CLI_NO_SUITABLE_OBJECTS);
|
||||
}
|
||||
else
|
||||
else {
|
||||
if (pre_check) //continue to next plate directly
|
||||
continue;
|
||||
try {
|
||||
std::string outfile_final;
|
||||
BOOST_LOG_TRIVIAL(info) << "start Print::process for partplate "<<index+1 << std::endl;
|
||||
|
@ -2042,6 +2022,12 @@ int CLI::run(int argc, char **argv)
|
|||
//continue;
|
||||
flush_and_exit(CLI_SLICING_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pre_check)
|
||||
pre_check = false;
|
||||
else
|
||||
finished = true;
|
||||
}//end for partplate
|
||||
|
||||
#if defined(__linux__) || defined(__LINUX__)
|
||||
|
|
Loading…
Reference in a new issue