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) { // if (printer_technology == ptSLA) {
// Shift-up all volumes of the object so that it has the right elevation with respect to the print bed // // 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) // 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()) { // 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()); // const SLAPrintObject* po = sla_print()->objects()[volume->object_idx()];//sla_print()->get_print_object_by_model_object_id(volume->object_idx());
if (po != nullptr) //// if (po != nullptr)
volume->set_sla_shift_z(po->get_current_elevation() / sla_print()->relative_correction().z()); //// volume->set_sla_shift_z(po->get_current_elevation() / sla_print()->relative_correction().z());
} // }
} // }
if (printer_technology == ptFFF && m_config->has("nozzle_diameter")) { if (printer_technology == ptFFF && m_config->has("nozzle_diameter")) {
// Should the wipe tower be visualized ? // 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); bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal);
const GLVolumeCollection &volumes() const { return m_volumes; }
private: private:
GLVolumeCollection m_volumes; GLVolumeCollection m_volumes;
bool m_input_enabled{ false }; bool m_input_enabled{ false };

View file

@ -129,6 +129,13 @@ void SelectionInfo::on_release()
m_model_volume = nullptr; 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 int SelectionInfo::get_active_instance() const
{ {
return get_pool()->get_canvas()->get_selection().get_instance_idx(); return get_pool()->get_canvas()->get_selection().get_instance_idx();

View file

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