Fix of [BUG]Environment variables not all exported while calling Post-Processing Scripts #4901
This commit is contained in:
parent
fe18ce16fb
commit
b909ce7a3d
@ -179,17 +179,20 @@ static int run_script(const std::string &script, const std::string &gcode, std::
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
void run_post_process_scripts(const std::string &path, const PrintConfig &config)
|
void run_post_process_scripts(const std::string &path, const DynamicPrintConfig &config)
|
||||||
{
|
{
|
||||||
if (config.post_process.values.empty())
|
const auto* post_process = config.opt<ConfigOptionStrings>("post_process");
|
||||||
|
assert(post_process);
|
||||||
|
if (post_process->values.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Store print configuration into environment variables.
|
||||||
config.setenv_();
|
config.setenv_();
|
||||||
auto gcode_file = boost::filesystem::path(path);
|
auto gcode_file = boost::filesystem::path(path);
|
||||||
if (! boost::filesystem::exists(gcode_file))
|
if (! boost::filesystem::exists(gcode_file))
|
||||||
throw Slic3r::RuntimeError(std::string("Post-processor can't find exported gcode file"));
|
throw Slic3r::RuntimeError(std::string("Post-processor can't find exported gcode file"));
|
||||||
|
|
||||||
for (const std::string &scripts : config.post_process.values) {
|
for (const std::string &scripts : post_process->values) {
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
boost::split(lines, scripts, boost::is_any_of("\r\n"));
|
boost::split(lines, scripts, boost::is_any_of("\r\n"));
|
||||||
for (std::string script : lines) {
|
for (std::string script : lines) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
extern void run_post_process_scripts(const std::string &path, const PrintConfig &config);
|
extern void run_post_process_scripts(const std::string &path, const DynamicPrintConfig &config);
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ void BackgroundSlicingProcess::process_fff()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_print->set_status(95, _utf8(L("Running post-processing scripts")));
|
m_print->set_status(95, _utf8(L("Running post-processing scripts")));
|
||||||
run_post_process_scripts(export_path, m_fff_print->config());
|
run_post_process_scripts(export_path, m_fff_print->full_print_config());
|
||||||
m_print->set_status(100, (boost::format(_utf8(L("G-code file exported to %1%"))) % export_path).str());
|
m_print->set_status(100, (boost::format(_utf8(L("G-code file exported to %1%"))) % export_path).str());
|
||||||
} else if (! m_upload_job.empty()) {
|
} else if (! m_upload_job.empty()) {
|
||||||
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id));
|
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id));
|
||||||
@ -538,7 +538,7 @@ void BackgroundSlicingProcess::prepare_upload()
|
|||||||
if (copy_file(m_temp_output_path, source_path.string(), error_message) != SUCCESS) {
|
if (copy_file(m_temp_output_path, source_path.string(), error_message) != SUCCESS) {
|
||||||
throw Slic3r::RuntimeError(_utf8(L("Copying of the temporary G-code to the output G-code failed")));
|
throw Slic3r::RuntimeError(_utf8(L("Copying of the temporary G-code to the output G-code failed")));
|
||||||
}
|
}
|
||||||
run_post_process_scripts(source_path.string(), m_fff_print->config());
|
run_post_process_scripts(source_path.string(), m_fff_print->full_print_config());
|
||||||
m_upload_job.upload_data.upload_path = m_fff_print->print_statistics().finalize_output_path(m_upload_job.upload_data.upload_path.string());
|
m_upload_job.upload_data.upload_path = m_fff_print->print_statistics().finalize_output_path(m_upload_job.upload_data.upload_path.string());
|
||||||
} else {
|
} else {
|
||||||
m_upload_job.upload_data.upload_path = m_sla_print->print_statistics().finalize_output_path(m_upload_job.upload_data.upload_path.string());
|
m_upload_job.upload_data.upload_path = m_sla_print->print_statistics().finalize_output_path(m_upload_job.upload_data.upload_path.string());
|
||||||
|
Loading…
Reference in New Issue
Block a user