1st installment of export of gcode toolpaths to obj file

This commit is contained in:
Enrico Turri 2019-08-20 09:01:09 +02:00
parent 4fbee3216b
commit 1f6aab312b
9 changed files with 160 additions and 1 deletions

View file

@ -1764,6 +1764,11 @@ struct Plater::priv
void select_view(const std::string& direction);
void select_view_3D(const std::string& name);
void select_next_view_3D();
bool is_preview_shown() const { return current_panel == preview; }
bool is_preview_loaded() const { return preview->is_loaded(); }
bool is_view3D_shown() const { return current_panel == view3D; }
void reset_all_gizmos();
void update_ui_from_settings();
ProgressStatusBar* statusbar();
@ -2458,6 +2463,7 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type)
case FT_AMF:
case FT_3MF:
case FT_GCODE:
case FT_OBJ:
wildcard = file_wildcards(file_type);
break;
default:
@ -2508,6 +2514,12 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type)
dlg_title = _(L("Save file as:"));
break;
}
case FT_OBJ:
{
output_file.replace_extension("obj");
dlg_title = _(L("Export OBJ file:"));
break;
}
default: break;
}
@ -4097,6 +4109,10 @@ void Plater::select_view(const std::string& direction) { p->select_view(directio
void Plater::select_view_3D(const std::string& name) { p->select_view_3D(name); }
bool Plater::is_preview_shown() const { return p->is_preview_shown(); }
bool Plater::is_preview_loaded() const { return p->is_preview_loaded(); }
bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); }
void Plater::select_all() { p->select_all(); }
void Plater::deselect_all() { p->deselect_all(); }
@ -4420,6 +4436,20 @@ void Plater::export_3mf(const boost::filesystem::path& output_path)
}
}
void Plater::export_toolpaths_to_obj()
{
if ((printer_technology() != ptFFF) || !is_preview_loaded())
return;
wxString path = p->get_export_file(FT_OBJ);
if (path.empty())
return;
wxBusyCursor wait;
p->preview->get_canvas3d()->export_toolpaths_to_obj(into_u8(path).c_str());
}
void Plater::reslice()
{
// Stop arrange and (or) optimize rotation tasks.