Tech ENABLE_ALLOW_NEGATIVE_Z-> Disable sinking objects for SLA printer

This commit is contained in:
enricoturri1966 2021-05-06 14:04:07 +02:00
parent bb18edde0a
commit ff632a9ff2
5 changed files with 28 additions and 5 deletions

View file

@ -61,6 +61,7 @@
#define ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG (1 && ENABLE_2_4_0_ALPHA0)
// Enable to push object instances under the bed
#define ENABLE_ALLOW_NEGATIVE_Z (1 && ENABLE_2_4_0_ALPHA0)
#define DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA (1 && ENABLE_ALLOW_NEGATIVE_Z)
#endif // _prusaslicer_technologies_h_

View file

@ -23,6 +23,9 @@
#include "libslic3r/Format/STL.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/AppConfig.hpp"
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include "libslic3r/PresetBundle.hpp"
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include <stdio.h>
#include <stdlib.h>
@ -521,7 +524,11 @@ bool GLVolume::is_sla_pad() const { return this->composite_id.volume_id == -int(
#if ENABLE_ALLOW_NEGATIVE_Z
bool GLVolume::is_sinking() const
{
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (is_modifier || GUI::wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
#else
if (is_modifier)
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
return false;
const BoundingBoxf3& box = transformed_convex_hull_bounding_box();
return box.min(2) < -EPSILON && box.max(2) >= -EPSILON;

View file

@ -3571,7 +3571,11 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
ModelObject* m = m_model->objects[i.first];
#if ENABLE_ALLOW_NEGATIVE_Z
double shift_z = m->get_instance_min_z(i.second);
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (m_process->current_printer_technology() == ptSLA || shift_z > 0.0) {
#else
if (shift_z > 0.0) {
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
Vec3d shift(0.0, 0.0, -shift_z);
#else
Vec3d shift(0.0, 0.0, -m->get_instance_min_z(i.second));

View file

@ -5816,7 +5816,11 @@ void Plater::changed_object(int obj_idx)
// recenter and re - align to Z = 0
auto model_object = p->model.objects[obj_idx];
#if ENABLE_ALLOW_NEGATIVE_Z
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
model_object->ensure_on_bed(this->p->printer_technology != ptSLA);
#else
model_object->ensure_on_bed(true);
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#else
model_object->ensure_on_bed();
#endif // ENABLE_ALLOW_NEGATIVE_Z

View file

@ -12,6 +12,9 @@
#include "Plater.hpp"
#include "libslic3r/Model.hpp"
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include "libslic3r/PresetBundle.hpp"
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
#include <GL/glew.h>
@ -893,10 +896,11 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
else if (m_mode == Volume)
synchronize_unselected_volumes();
#endif // !DISABLE_INSTANCES_SYNCH
#if !ENABLE_ALLOW_NEGATIVE_Z
ensure_on_bed();
#endif // !ENABLE_ALLOW_NEGATIVE_Z
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
ensure_on_bed();
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
this->set_bounding_boxes_dirty();
}
@ -2059,7 +2063,10 @@ void Selection::synchronize_unselected_instances(SyncRotationType sync_rotation_
// z only rotation -> synch instance z
// The X,Y rotations should be synchronized from start to end of the rotation.
assert(is_rotation_xy_synchronized(rotation, v->get_instance_rotation()));
v->set_instance_offset(Z, volume->get_instance_offset().z());
#if DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA)
#endif // DISABLE_ALLOW_NEGATIVE_Z_FOR_SLA
v->set_instance_offset(Z, volume->get_instance_offset().z());
break;
#else
// z only rotation -> keep instance z