mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
#6587 - Fixed temporary .gcode file locked by gcode window visualizator while exporting to gcode
This commit is contained in:
parent
ee6782c603
commit
8e75919948
7 changed files with 63 additions and 2 deletions
|
@ -150,9 +150,20 @@ void BackgroundSlicingProcess::process_fff()
|
||||||
if (! m_export_path.empty()) {
|
if (! m_export_path.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));
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
// let the gcode window to unmap the temporary .gcode file (m_temp_output_path)
|
||||||
|
// because the scripts may want to modify it
|
||||||
|
GUI::wxGetApp().plater()->stop_mapping_gcode_window();
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
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(m_temp_output_path, m_fff_print->full_print_config());
|
run_post_process_scripts(m_temp_output_path, m_fff_print->full_print_config());
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
// let the gcode window to reload and remap the temporary .gcode file (m_temp_output_path)
|
||||||
|
GUI::wxGetApp().plater()->start_mapping_gcode_window();
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
//FIXME localize the messages
|
//FIXME localize the messages
|
||||||
// Perform the final post-processing of the export path by applying the print statistics over the file name.
|
// Perform the final post-processing of the export path by applying the print statistics over the file name.
|
||||||
std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path);
|
std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path);
|
||||||
|
|
|
@ -280,6 +280,9 @@ void GCodeViewer::SequentialView::GCodeWindow::load_gcode()
|
||||||
if (m_filename.empty())
|
if (m_filename.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_file.is_open())
|
||||||
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// generate mapping for accessing data in file by line number
|
// generate mapping for accessing data in file by line number
|
||||||
|
@ -1124,6 +1127,18 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
void GCodeViewer::start_mapping_gcode_window()
|
||||||
|
{
|
||||||
|
m_sequential_view.gcode_window.load_gcode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCodeViewer::stop_mapping_gcode_window()
|
||||||
|
{
|
||||||
|
m_sequential_view.gcode_window.stop_mapping_file();
|
||||||
|
}
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
|
void GCodeViewer::load_toolpaths(const GCodeProcessor::Result& gcode_result)
|
||||||
{
|
{
|
||||||
// max index buffer size, in bytes
|
// max index buffer size, in bytes
|
||||||
|
|
|
@ -561,7 +561,6 @@ public:
|
||||||
|
|
||||||
void render(float top, float bottom, uint64_t curr_line_id) const;
|
void render(float top, float bottom, uint64_t curr_line_id) const;
|
||||||
|
|
||||||
private:
|
|
||||||
void stop_mapping_file();
|
void stop_mapping_file();
|
||||||
};
|
};
|
||||||
#endif // ENABLE_GCODE_WINDOW
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
@ -681,6 +680,8 @@ public:
|
||||||
void export_toolpaths_to_obj(const char* filename) const;
|
void export_toolpaths_to_obj(const char* filename) const;
|
||||||
|
|
||||||
#if ENABLE_GCODE_WINDOW
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
void start_mapping_gcode_window();
|
||||||
|
void stop_mapping_gcode_window();
|
||||||
void toggle_gcode_window_visibility() { m_sequential_view.gcode_window.toggle_visibility(); }
|
void toggle_gcode_window_visibility() { m_sequential_view.gcode_window.toggle_visibility(); }
|
||||||
#endif // ENABLE_GCODE_WINDOW
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
|
|
|
@ -1124,6 +1124,18 @@ int GLCanvas3D::check_volumes_outside_state() const
|
||||||
return (int)state;
|
return (int)state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
void GLCanvas3D::start_mapping_gcode_window()
|
||||||
|
{
|
||||||
|
m_gcode_viewer.start_mapping_gcode_window();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::stop_mapping_gcode_window()
|
||||||
|
{
|
||||||
|
m_gcode_viewer.stop_mapping_gcode_window();
|
||||||
|
}
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx)
|
void GLCanvas3D::toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo, int instance_idx)
|
||||||
{
|
{
|
||||||
m_render_sla_auxiliaries = visible;
|
m_render_sla_auxiliaries = visible;
|
||||||
|
|
|
@ -547,6 +547,11 @@ public:
|
||||||
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
||||||
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
void start_mapping_gcode_window();
|
||||||
|
void stop_mapping_gcode_window();
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
||||||
void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
void toggle_model_objects_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
||||||
void update_instance_printable_state_for_object(size_t obj_idx);
|
void update_instance_printable_state_for_object(size_t obj_idx);
|
||||||
|
|
|
@ -5946,6 +5946,18 @@ BoundingBoxf Plater::bed_shape_bb() const
|
||||||
return p->bed_shape_bb();
|
return p->bed_shape_bb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
void Plater::start_mapping_gcode_window()
|
||||||
|
{
|
||||||
|
p->preview->get_canvas3d()->start_mapping_gcode_window();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plater::stop_mapping_gcode_window()
|
||||||
|
{
|
||||||
|
p->preview->get_canvas3d()->stop_mapping_gcode_window();
|
||||||
|
}
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
void Plater::arrange()
|
void Plater::arrange()
|
||||||
{
|
{
|
||||||
p->m_ui_jobs.arrange();
|
p->m_ui_jobs.arrange();
|
||||||
|
|
|
@ -276,6 +276,11 @@ public:
|
||||||
GLCanvas3D* get_current_canvas3D();
|
GLCanvas3D* get_current_canvas3D();
|
||||||
BoundingBoxf bed_shape_bb() const;
|
BoundingBoxf bed_shape_bb() const;
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_WINDOW
|
||||||
|
void start_mapping_gcode_window();
|
||||||
|
void stop_mapping_gcode_window();
|
||||||
|
#endif // ENABLE_GCODE_WINDOW
|
||||||
|
|
||||||
void arrange();
|
void arrange();
|
||||||
void find_new_position(const ModelInstancePtrs &instances);
|
void find_new_position(const ModelInstancePtrs &instances);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue