Force auto arrangement when loading an object on an empty printbed (XL printers only)
This commit is contained in:
parent
ca93802a0c
commit
7d03c6abb3
@ -1736,6 +1736,7 @@ void ObjectList::load_shape_object_from_gallery(const wxArrayString& input_files
|
|||||||
|
|
||||||
void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name, bool center)
|
void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name, bool center)
|
||||||
{
|
{
|
||||||
|
PlaterAfterLoadAutoArrange plater_after_load_auto_arrange;
|
||||||
// Add mesh to model as a new object
|
// Add mesh to model as a new object
|
||||||
Model& model = wxGetApp().plater()->model();
|
Model& model = wxGetApp().plater()->model();
|
||||||
|
|
||||||
|
@ -2367,6 +2367,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||||||
|
|
||||||
auto *nozzle_dmrs = config->opt<ConfigOptionFloats>("nozzle_diameter");
|
auto *nozzle_dmrs = config->opt<ConfigOptionFloats>("nozzle_diameter");
|
||||||
|
|
||||||
|
PlaterAfterLoadAutoArrange plater_after_load_auto_arrange;
|
||||||
|
|
||||||
bool one_by_one = input_files.size() == 1 || printer_technology == ptSLA || nozzle_dmrs->values.size() <= 1;
|
bool one_by_one = input_files.size() == 1 || printer_technology == ptSLA || nozzle_dmrs->values.size() <= 1;
|
||||||
if (! one_by_one) {
|
if (! one_by_one) {
|
||||||
for (const auto &path : input_files) {
|
for (const auto &path : input_files) {
|
||||||
@ -2671,6 +2673,9 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||||||
new_model->add_object(*model_object);
|
new_model->add_object(*model_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_project_file)
|
||||||
|
plater_after_load_auto_arrange.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6973,4 +6978,18 @@ SuppressBackgroundProcessingUpdate::~SuppressBackgroundProcessingUpdate()
|
|||||||
wxGetApp().plater()->schedule_background_process(m_was_scheduled);
|
wxGetApp().plater()->schedule_background_process(m_was_scheduled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlaterAfterLoadAutoArrange::PlaterAfterLoadAutoArrange()
|
||||||
|
{
|
||||||
|
Plater* plater = wxGetApp().plater();
|
||||||
|
m_enabled = plater->model().objects.empty() &&
|
||||||
|
plater->printer_technology() == ptFFF &&
|
||||||
|
plater->fff_print().config().printer_model.value == "XL";
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaterAfterLoadAutoArrange::~PlaterAfterLoadAutoArrange()
|
||||||
|
{
|
||||||
|
if (m_enabled)
|
||||||
|
wxGetApp().plater()->arrange();
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
@ -459,6 +459,16 @@ private:
|
|||||||
bool m_was_scheduled;
|
bool m_was_scheduled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PlaterAfterLoadAutoArrange
|
||||||
|
{
|
||||||
|
bool m_enabled{ false };
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlaterAfterLoadAutoArrange();
|
||||||
|
~PlaterAfterLoadAutoArrange();
|
||||||
|
void disable() { m_enabled = false; }
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user