wip on support points elevation bug

This commit is contained in:
tamasmeszaros 2022-12-14 18:19:04 +01:00
parent a3403c51cf
commit 3f7dcf744b
4 changed files with 20 additions and 9 deletions

View File

@ -1940,15 +1940,15 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
}
}
if (printer_technology == ptSLA) {
// Shift-up all volumes of the object so that it has the right elevation with respect to the print bed
for (GLVolume* volume : m_volumes.volumes)
if (volume->object_idx() < (int)m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable()) {
const SLAPrintObject* po = sla_print()->get_print_object_by_model_object_id(volume->object_idx());
if (po != nullptr)
volume->set_sla_shift_z(po->get_current_elevation() / sla_print()->relative_correction().z());
}
}
// if (printer_technology == ptSLA) {
// // Shift-up all volumes of the object so that it has the right elevation with respect to the print bed
// for (GLVolume* volume : m_volumes.volumes)
// if (volume->object_idx() < (int)m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable()) {
// const SLAPrintObject* po = sla_print()->objects()[volume->object_idx()];//sla_print()->get_print_object_by_model_object_id(volume->object_idx());
//// if (po != nullptr)
//// volume->set_sla_shift_z(po->get_current_elevation() / sla_print()->relative_correction().z());
// }
// }
if (printer_technology == ptFFF && m_config->has("nozzle_diameter")) {
// Should the wipe tower be visualized ?

View File

@ -42,6 +42,8 @@ protected:
bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal);
const GLVolumeCollection &volumes() const { return m_volumes; }
private:
GLVolumeCollection m_volumes;
bool m_input_enabled{ false };

View File

@ -129,6 +129,13 @@ void SelectionInfo::on_release()
m_model_volume = nullptr;
}
ModelInstance *SelectionInfo::model_instance() const
{
int inst_idx = get_active_instance();
return int(m_model_object->instances.size()) < inst_idx ?
m_model_object->instances[get_active_instance()] : nullptr;
}
int SelectionInfo::get_active_instance() const
{
return get_pool()->get_canvas()->get_selection().get_instance_idx();

View File

@ -9,6 +9,7 @@
namespace Slic3r {
class ModelObject;
class ModelInstance;
class SLAPrintObject;
class ModelVolume;
@ -160,6 +161,7 @@ public:
const SLAPrintObject *print_object() const { return m_print_object; }
// Returns a non-null pointer if the selection is a single volume
ModelVolume* model_volume() const { return m_model_volume; }
ModelInstance *model_instance() const;
int get_active_instance() const;
float get_sla_shift() const { return m_z_shift; }