diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b9dc23ded1..99c572d73f 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -79,6 +79,7 @@ #include "../Utils/FixModelByWin10.hpp" #include "../Utils/UndoRedo.hpp" #include "../Utils/PresetUpdater.hpp" +#include "../Utils/Process.hpp" #include "RemovableDriveManager.hpp" #include "InstanceCheck.hpp" #include "NotificationManager.hpp" @@ -1376,7 +1377,7 @@ private: const std::regex PlaterDropTarget::pattern_drop(".*[.](stl|obj|amf|3mf|prusa)", std::regex::icase); #if ENABLE_GCODE_VIEWER -const std::regex PlaterDropTarget::pattern_gcode_drop(".*[.](gcode)", std::regex::icase); +const std::regex PlaterDropTarget::pattern_gcode_drop(".*[.](gcode|g)", std::regex::icase); #endif // ENABLE_GCODE_VIEWER bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames) @@ -1415,9 +1416,14 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi fs::path path(into_path(filename)); if (std::regex_match(path.string(), pattern_drop)) paths.push_back(std::move(path)); + else if (std::regex_match(path.string(), pattern_gcode_drop)) + start_new_gcodeviewer(&filename); else return false; } + if (paths.empty()) + // Likely all paths processed were gcodes, for which a G-code viewer instance has hopefully been started. + return false; wxString snapshot_label; assert(! paths.empty());