From 0b4dbc87c7d3d84b026a2cff342eb526046bff6e Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 13 Mar 2019 19:49:14 +0100 Subject: [PATCH] CLI: Removed the --help-options parameter, left the --help-fff and --help-sla Added check for empty print. --- src/libslic3r/PrintConfig.cpp | 5 ----- src/slic3r.cpp | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 48945fc7d..11fff2fb3 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2955,11 +2955,6 @@ CLIActionsConfigDef::CLIActionsConfigDef() def->cli = "help|h"; def->default_value = new ConfigOptionBool(false); - def = this->add("help_options", coBool); - def->label = L("Help (options)"); - def->tooltip = L("Show the full list of print/G-code configuration options."); - def->default_value = new ConfigOptionBool(false); - 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."); diff --git a/src/slic3r.cpp b/src/slic3r.cpp index d29f6b04f..f88b84ce7 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -133,8 +133,8 @@ int CLI::run(int argc, char **argv) // Initialize full print configs for both the FFF and SLA technologies. FullPrintConfig fff_print_config; SLAFullPrintConfig sla_print_config; - fff_print_config.apply(m_print_config); - sla_print_config.apply(m_print_config); + fff_print_config.apply(m_print_config, true); + sla_print_config.apply(m_print_config, true); // Loop through transform options. for (auto const &opt_key : m_transforms) { @@ -308,8 +308,6 @@ int CLI::run(int argc, char **argv) for (auto const &opt_key : m_actions) { if (opt_key == "help") { this->print_help(); - } else if (opt_key == "help_options") { - this->print_help(true, ptAny); } else if (opt_key == "help_fff") { this->print_help(true, ptFFF); } else if (opt_key == "help_sla") { @@ -375,7 +373,13 @@ int CLI::run(int argc, char **argv) } print->apply(model, m_print_config); std::string err = print->validate(); - if (err.empty()) { + if (! err.empty()) { + boost::nowide::cerr << err << std::endl; + return 1; + } + if (print->empty()) + boost::nowide::cout << "Nothing to print for " << outfile << " . Either the print is empty or no object is fully inside the print volume." << std::endl; + else try { std::string outfile_final; print->process(); @@ -393,15 +397,11 @@ int CLI::run(int argc, char **argv) boost::nowide::cerr << "Renaming file " << outfile << " to " << outfile_final << " failed" << std::endl; return 1; } + boost::nowide::cout << "Slicing result exported to " << outfile << std::endl; } catch (const std::exception &ex) { boost::nowide::cerr << ex.what() << std::endl; return 1; } - } else { - boost::nowide::cerr << err << std::endl; - return 1; - } - /* print.center = ! m_config.has("center") && ! m_config.has("align_xy") @@ -577,7 +577,7 @@ void CLI::print_help(bool include_print_options, PrinterTechnology printer_techn } else { boost::nowide::cout << std::endl - << "Run --help-options / --help-fff / --help-sla to see the full listing of print options." << std::endl; + << "Run --help-fff / --help-sla to see the full listing of print options." << std::endl; } }