ENABLE_GCODE_VIEWER set as default in fff_print test and PrusaSlicer.cpp
This commit is contained in:
parent
8633e8f25c
commit
8c8ad70c58
@ -138,7 +138,6 @@ int CLI::run(int argc, char **argv)
|
|||||||
m_print_config.apply(config);
|
m_print_config.apply(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
// are we starting as gcodeviewer ?
|
// are we starting as gcodeviewer ?
|
||||||
for (auto it = m_actions.begin(); it != m_actions.end(); ++it) {
|
for (auto it = m_actions.begin(); it != m_actions.end(); ++it) {
|
||||||
if (*it == "gcodeviewer") {
|
if (*it == "gcodeviewer") {
|
||||||
@ -148,10 +147,8 @@ int CLI::run(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
// Read input file(s) if any.
|
// Read input file(s) if any.
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
for (const std::string& file : m_input_files) {
|
for (const std::string& file : m_input_files) {
|
||||||
std::string ext = boost::filesystem::path(file).extension().string();
|
std::string ext = boost::filesystem::path(file).extension().string();
|
||||||
if (ext == ".gcode" || ext == ".g") {
|
if (ext == ".gcode" || ext == ".g") {
|
||||||
@ -162,7 +159,6 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!start_as_gcodeviewer) {
|
if (!start_as_gcodeviewer) {
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
for (const std::string& file : m_input_files) {
|
for (const std::string& file : m_input_files) {
|
||||||
if (!boost::filesystem::exists(file)) {
|
if (!boost::filesystem::exists(file)) {
|
||||||
boost::nowide::cerr << "No such file: " << file << std::endl;
|
boost::nowide::cerr << "No such file: " << file << std::endl;
|
||||||
@ -195,9 +191,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
m_models.push_back(model);
|
m_models.push_back(model);
|
||||||
}
|
}
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
|
|
||||||
// Apply command line options to a more specific DynamicPrintConfig which provides normalize()
|
// Apply command line options to a more specific DynamicPrintConfig which provides normalize()
|
||||||
// (command line options override --load files)
|
// (command line options override --load files)
|
||||||
@ -504,11 +498,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
print->process();
|
print->process();
|
||||||
if (printer_technology == ptFFF) {
|
if (printer_technology == ptFFF) {
|
||||||
// The outfile is processed by a PlaceholderParser.
|
// The outfile is processed by a PlaceholderParser.
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
outfile = fff_print.export_gcode(outfile, nullptr, nullptr);
|
outfile = fff_print.export_gcode(outfile, nullptr, nullptr);
|
||||||
#else
|
|
||||||
outfile = fff_print.export_gcode(outfile, nullptr);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
outfile_final = fff_print.print_statistics().finalize_output_path(outfile);
|
outfile_final = fff_print.print_statistics().finalize_output_path(outfile);
|
||||||
} else {
|
} else {
|
||||||
outfile = sla_print.output_filepath(outfile);
|
outfile = sla_print.output_filepath(outfile);
|
||||||
@ -559,11 +549,6 @@ int CLI::run(int argc, char **argv)
|
|||||||
<< " (" << print.total_extruded_volume()/1000 << "cm3)" << std::endl;
|
<< " (" << print.total_extruded_volume()/1000 << "cm3)" << std::endl;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
#if !ENABLE_GCODE_VIEWER
|
|
||||||
} else if (opt_key == "gcodeviewer") {
|
|
||||||
start_gui = true;
|
|
||||||
start_as_gcodeviewer = true;
|
|
||||||
#endif // !ENABLE_GCODE_VIEWER
|
|
||||||
} else {
|
} else {
|
||||||
boost::nowide::cerr << "error: option not supported yet: " << opt_key << std::endl;
|
boost::nowide::cerr << "error: option not supported yet: " << opt_key << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -244,11 +244,7 @@ std::string gcode(Print & print)
|
|||||||
boost::filesystem::path temp = boost::filesystem::unique_path();
|
boost::filesystem::path temp = boost::filesystem::unique_path();
|
||||||
print.set_status_silent();
|
print.set_status_silent();
|
||||||
print.process();
|
print.process();
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
print.export_gcode(temp.string(), nullptr, nullptr);
|
print.export_gcode(temp.string(), nullptr, nullptr);
|
||||||
#else
|
|
||||||
print.export_gcode(temp.string(), nullptr);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
std::ifstream t(temp.string());
|
std::ifstream t(temp.string());
|
||||||
std::string str((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
|
std::string str((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
|
||||||
boost::nowide::remove(temp.string().c_str());
|
boost::nowide::remove(temp.string().c_str());
|
||||||
|
@ -50,12 +50,8 @@ SCENARIO("Model construction", "[Model]") {
|
|||||||
print.apply(model, config);
|
print.apply(model, config);
|
||||||
print.process();
|
print.process();
|
||||||
boost::filesystem::path temp = boost::filesystem::unique_path();
|
boost::filesystem::path temp = boost::filesystem::unique_path();
|
||||||
#if ENABLE_GCODE_VIEWER
|
print.export_gcode(temp.string(), nullptr, nullptr);
|
||||||
print.export_gcode(temp.string(), nullptr, nullptr);
|
REQUIRE(boost::filesystem::exists(temp));
|
||||||
#else
|
|
||||||
print.export_gcode(temp.string(), nullptr);
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
REQUIRE(boost::filesystem::exists(temp));
|
|
||||||
REQUIRE(boost::filesystem::is_regular_file(temp));
|
REQUIRE(boost::filesystem::is_regular_file(temp));
|
||||||
REQUIRE(boost::filesystem::file_size(temp) > 0);
|
REQUIRE(boost::filesystem::file_size(temp) > 0);
|
||||||
boost::nowide::remove(temp.string().c_str());
|
boost::nowide::remove(temp.string().c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user