Fix indentation and spacing; use print.arrange rather than making another call to the config.

This commit is contained in:
Joseph Lenox 2019-04-13 13:48:40 -05:00 committed by Joseph Lenox
parent 7d7223eeaf
commit 0230138bb2

View File

@ -70,9 +70,9 @@ int CLI::run(int argc, char **argv) {
c.normalize(); c.normalize();
this->print_config.apply(c); this->print_config.apply(c);
} catch (std::exception &e){ } catch (std::exception &e){
Slic3r::Log::error("CLI") << "Error with the config file '" << file << "': " << e.what() <<std::endl; Slic3r::Log::error("CLI") << "Error with the config file '" << file << "': " << e.what() <<std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
// apply command line options to a more specific DynamicPrintConfig which provides normalize() // apply command line options to a more specific DynamicPrintConfig which provides normalize()
@ -87,8 +87,8 @@ int CLI::run(int argc, char **argv) {
try { try {
this->full_print_config.validate(); this->full_print_config.validate();
} catch (std::exception &e) { } catch (std::exception &e) {
Slic3r::Log::error("CLI") << "Config validation error: "<< e.what() << std::endl; Slic3r::Log::error("CLI") << "Config validation error: "<< e.what() << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
Slic3r::Log::debug("CLI") << "Config validated" << std::endl; Slic3r::Log::debug("CLI") << "Config validated" << std::endl;
@ -98,12 +98,12 @@ int CLI::run(int argc, char **argv) {
try { try {
model = Model::read_from_file(file); model = Model::read_from_file(file);
} catch (std::exception &e) { } catch (std::exception &e) {
Slic3r::Log::error("CLI") << file << ": " << e.what() << std::endl; Slic3r::Log::error("CLI") << file << ": " << e.what() << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (model.objects.empty()) { if (model.objects.empty()) {
Slic3r::Log::error("CLI") << "Error: file is empty: " << file << std::endl; Slic3r::Log::error("CLI") << "Error: file is empty: " << file << std::endl;
continue; continue;
} }
this->models.push_back(model); this->models.push_back(model);
} }
@ -314,10 +314,10 @@ int CLI::run(int argc, char **argv) {
boost::nowide::cout << msg << std::endl; boost::nowide::cout << msg << std::endl;
}; };
print.apply_config(this->print_config); print.apply_config(this->print_config);
print.arrange = !this->config.getBool("dont_arrange",false); print.arrange = !this->config.getBool("dont_arrange", false);
print.center = !this->config.has("center") print.center = !this->config.has("center")
&& !this->config.has("align_xy") && !this->config.has("align_xy")
&& !this->config.getBool("dont_arrange",false); && print.arrange;
Slic3r::Log::error("CLI") << "Arrange: " << print.arrange<< ", center: " << print.center << std::endl; Slic3r::Log::error("CLI") << "Arrange: " << print.arrange<< ", center: " << print.center << std::endl;
print.set_model(model); print.set_model(model);