Merge branch 'master' of github.com:prusa3d/Slic3r

This commit is contained in:
tamasmeszaros 2018-12-12 12:44:13 +01:00
commit 2ef071d1a9
7 changed files with 54 additions and 12 deletions

View file

@ -22,6 +22,7 @@
#include <boost/format.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>
namespace Slic3r {
@ -72,11 +73,38 @@ void BackgroundSlicingProcess::process_fff()
if (this->set_step_started(bspsGCodeFinalize)) {
if (! m_export_path.empty()) {
//FIXME localize the messages
if (copy_file(m_temp_output_path, m_export_path) != 0)
// Perform the final post-processing of the export path by applying the print statistics over the file name.
std::string export_path;
{
const PrintStatistics &stats = m_fff_print->print_statistics();
PlaceholderParser pp;
std::string normal_print_time = stats.estimated_normal_print_time;
std::string silent_print_time = stats.estimated_silent_print_time;
normal_print_time.erase(std::remove_if(normal_print_time.begin(), normal_print_time.end(), std::isspace), normal_print_time.end());
silent_print_time.erase(std::remove_if(silent_print_time.begin(), silent_print_time.end(), std::isspace), silent_print_time.end());
pp.set("print_time", new ConfigOptionString(normal_print_time));
pp.set("normal_print_time", new ConfigOptionString(normal_print_time));
pp.set("silent_print_time", new ConfigOptionString(silent_print_time));
pp.set("used_filament", new ConfigOptionFloat (stats.total_used_filament));
pp.set("extruded_volume", new ConfigOptionFloat (stats.total_extruded_volume));
pp.set("total_cost", new ConfigOptionFloat (stats.total_cost));
pp.set("total_weight", new ConfigOptionFloat (stats.total_weight));
pp.set("total_wipe_tower_cost", new ConfigOptionFloat (stats.total_wipe_tower_cost));
pp.set("total_wipe_tower_filament", new ConfigOptionFloat (stats.total_wipe_tower_filament));
boost::filesystem::path path(m_export_path);
try {
std::string new_stem = pp.process(path.stem().string(), 0);
export_path = (path.parent_path() / (new_stem + path.extension().string())).string();
} catch (const std::exception &ex) {
BOOST_LOG_TRIVIAL(error) << "Failed to apply the print statistics to the export file name: " << ex.what();
export_path = m_export_path;
}
}
if (copy_file(m_temp_output_path, export_path) != 0)
throw std::runtime_error("Copying of the temporary G-code to the output G-code failed");
m_print->set_status(95, "Running post-processing scripts");
run_post_process_scripts(m_export_path, m_fff_print->config());
m_print->set_status(100, "G-code file exported to " + m_export_path);
run_post_process_scripts(export_path, m_fff_print->config());
m_print->set_status(100, "G-code file exported to " + export_path);
} else {
m_print->set_status(100, "Slicing complete");
}

View file

@ -581,7 +581,7 @@ void GLCanvas3D::Bed::_render_custom() const
::glEnableClientState(GL_VERTEX_ARRAY);
::glColor4f(0.8f, 0.6f, 0.5f, 0.4f);
::glColor4f(0.35f, 0.35f, 0.35f, 0.4f);
::glNormal3d(0.0f, 0.0f, 1.0f);
::glVertexPointer(3, GL_FLOAT, 0, (GLvoid*)m_triangles.get_vertices());
::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)triangles_vcount);

View file

@ -147,7 +147,7 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionString(boost::any_cast<std::string>(value)));
break;
case coStrings:{
if (opt_key == "compatible_prints" || opt_key == "compatible_printers") {
if (opt_key == "compatible_prints" || opt_key == "compatible_printers" || opt_key == "post_process") {
config.option<ConfigOptionStrings>(opt_key)->values =
boost::any_cast<std::vector<std::string>>(value);
}