Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sequential_limits
This commit is contained in:
commit
a929b29a0b
4 changed files with 29 additions and 10 deletions
|
@ -901,12 +901,18 @@ Polygon ModelObject::convex_hull_2d(const Transform3d &trafo_instance) const
|
||||||
for (const stl_facet &facet : stl.facet_start)
|
for (const stl_facet &facet : stl.facet_start)
|
||||||
for (size_t j = 0; j < 3; ++ j) {
|
for (size_t j = 0; j < 3; ++ j) {
|
||||||
Vec3d p = trafo * facet.vertex[j].cast<double>();
|
Vec3d p = trafo * facet.vertex[j].cast<double>();
|
||||||
|
#if ENABLE_ALLOW_NEGATIVE_Z
|
||||||
|
if (p.z() >= 0.0)
|
||||||
|
#endif // ENABLE_ALLOW_NEGATIVE_Z
|
||||||
pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y())));
|
pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y())));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Using the shared vertices should be a bit quicker than using the STL faces.
|
// Using the shared vertices should be a bit quicker than using the STL faces.
|
||||||
for (size_t i = 0; i < its.vertices.size(); ++ i) {
|
for (size_t i = 0; i < its.vertices.size(); ++ i) {
|
||||||
Vec3d p = trafo * its.vertices[i].cast<double>();
|
Vec3d p = trafo * its.vertices[i].cast<double>();
|
||||||
|
#if ENABLE_ALLOW_NEGATIVE_Z
|
||||||
|
if (p.z() >= 0.0)
|
||||||
|
#endif // ENABLE_ALLOW_NEGATIVE_Z
|
||||||
pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y())));
|
pts.emplace_back(coord_t(scale_(p.x())), coord_t(scale_(p.y())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,6 +381,15 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin
|
||||||
// FIXME: Arrangement has different parameters for offsetting (jtMiter, limit 2)
|
// FIXME: Arrangement has different parameters for offsetting (jtMiter, limit 2)
|
||||||
// which causes that the warning will be showed after arrangement with the
|
// which causes that the warning will be showed after arrangement with the
|
||||||
// appropriate object distance. Even if I set this to jtMiter the warning still shows up.
|
// appropriate object distance. Even if I set this to jtMiter the warning still shows up.
|
||||||
|
#if ENABLE_ALLOW_NEGATIVE_Z
|
||||||
|
it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id,
|
||||||
|
offset(print_object->model_object()->convex_hull_2d(
|
||||||
|
Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(), model_instance0->get_scaling_factor(), model_instance0->get_mirror())),
|
||||||
|
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
|
||||||
|
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
|
||||||
|
float(scale_(0.5 * print.config().extruder_clearance_radius.value - EPSILON)),
|
||||||
|
jtRound, float(scale_(0.1))).front());
|
||||||
|
#else
|
||||||
it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id,
|
it_convex_hull = map_model_object_to_convex_hull.emplace_hint(it_convex_hull, model_object_id,
|
||||||
offset(print_object->model_object()->convex_hull_2d(
|
offset(print_object->model_object()->convex_hull_2d(
|
||||||
Geometry::assemble_transform(Vec3d::Zero(), model_instance0->get_rotation(), model_instance0->get_scaling_factor(), model_instance0->get_mirror())),
|
Geometry::assemble_transform(Vec3d::Zero(), model_instance0->get_rotation(), model_instance0->get_scaling_factor(), model_instance0->get_mirror())),
|
||||||
|
@ -388,6 +397,7 @@ static inline bool sequential_print_horizontal_clearance_valid(const Print &prin
|
||||||
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
|
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
|
||||||
float(scale_(0.5 * print.config().extruder_clearance_radius.value - EPSILON)),
|
float(scale_(0.5 * print.config().extruder_clearance_radius.value - EPSILON)),
|
||||||
jtRound, float(scale_(0.1))).front());
|
jtRound, float(scale_(0.1))).front());
|
||||||
|
#endif // ENABLE_ALLOW_NEGATIVE_Z
|
||||||
}
|
}
|
||||||
// Make a copy, so it may be rotated for instances.
|
// Make a copy, so it may be rotated for instances.
|
||||||
Polygon convex_hull0 = it_convex_hull->second;
|
Polygon convex_hull0 = it_convex_hull->second;
|
||||||
|
|
|
@ -372,6 +372,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
std::set<ModelObjectStatus> model_object_status;
|
std::set<ModelObjectStatus> model_object_status;
|
||||||
|
|
||||||
// 1) Synchronize model objects.
|
// 1) Synchronize model objects.
|
||||||
|
bool print_regions_reshuffled = false;
|
||||||
if (model.id() != m_model.id()) {
|
if (model.id() != m_model.id()) {
|
||||||
// Kill everything, initialize from scratch.
|
// Kill everything, initialize from scratch.
|
||||||
// Stop background processing.
|
// Stop background processing.
|
||||||
|
@ -383,6 +384,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
delete object;
|
delete object;
|
||||||
}
|
}
|
||||||
m_objects.clear();
|
m_objects.clear();
|
||||||
|
print_regions_reshuffled = true;
|
||||||
m_model.assign_copy(model);
|
m_model.assign_copy(model);
|
||||||
for (const ModelObject *model_object : m_model.objects)
|
for (const ModelObject *model_object : m_model.objects)
|
||||||
model_object_status.emplace(model_object->id(), ModelObjectStatus::New);
|
model_object_status.emplace(model_object->id(), ModelObjectStatus::New);
|
||||||
|
@ -462,6 +464,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
}
|
}
|
||||||
for (ModelObject *model_object : model_objects_old)
|
for (ModelObject *model_object : model_objects_old)
|
||||||
delete model_object;
|
delete model_object;
|
||||||
|
print_regions_reshuffled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -595,7 +598,6 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4) Generate PrintObjects from ModelObjects and their instances.
|
// 4) Generate PrintObjects from ModelObjects and their instances.
|
||||||
bool print_regions_reshuffled = false;
|
|
||||||
{
|
{
|
||||||
PrintObjectPtrs print_objects_new;
|
PrintObjectPtrs print_objects_new;
|
||||||
print_objects_new.reserve(std::max(m_objects.size(), m_model.objects.size()));
|
print_objects_new.reserve(std::max(m_objects.size(), m_model.objects.size()));
|
||||||
|
|
|
@ -661,31 +661,32 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
|
||||||
// if it's sign, than object have not to be a too height
|
// if it's sign, than object have not to be a too height
|
||||||
double height = object->height();
|
double height = object->height();
|
||||||
coord_t longer_side = std::max(object_x, object_y);
|
coord_t longer_side = std::max(object_x, object_y);
|
||||||
if (height / longer_side > 0.3)
|
auto num_layers = int(object->layers().size());
|
||||||
|
if (height / longer_side > 0.3 || num_layers < 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const ExPolygons& bottom = object->get_layer(0)->lslices;
|
const ExPolygons& bottom = object->get_layer(0)->lslices;
|
||||||
double bottom_area = area(bottom);
|
double bottom_area = area(bottom);
|
||||||
|
|
||||||
// at least 30% of object's height have to be a solid
|
// at least 30% of object's height have to be a solid
|
||||||
size_t i;
|
int i;
|
||||||
for (i = 1; i < size_t(0.3 * object->layers().size()); i++) {
|
for (i = 1; i < int(0.3 * num_layers); ++ i) {
|
||||||
double cur_area = area(object->get_layer(i)->lslices);
|
double cur_area = area(object->get_layer(i)->lslices);
|
||||||
if (cur_area != bottom_area && fabs(cur_area - bottom_area) > scale_(scale_(1)))
|
if (cur_area != bottom_area && fabs(cur_area - bottom_area) > scale_(scale_(1)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < size_t(0.3 * object->layers().size()))
|
if (i < size_t(0.3 * num_layers))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// bottom layer have to be a biggest, so control relation between bottom layer and object size
|
// bottom layer have to be a biggest, so control relation between bottom layer and object size
|
||||||
double prev_area = area(object->get_layer(i)->lslices);
|
double prev_area = area(object->get_layer(i)->lslices);
|
||||||
for ( i++; i < object->layers().size(); i++) {
|
for ( i++; i < num_layers; i++) {
|
||||||
double cur_area = area(object->get_layer(i)->lslices);
|
double cur_area = area(object->get_layer(i)->lslices);
|
||||||
if (cur_area > prev_area && prev_area - cur_area > scale_(scale_(1)))
|
if (cur_area > prev_area && prev_area - cur_area > scale_(scale_(1)))
|
||||||
break;
|
break;
|
||||||
prev_area = cur_area;
|
prev_area = cur_area;
|
||||||
}
|
}
|
||||||
if (i < object->layers().size())
|
if (i < num_layers)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
double top_area = area(object->get_layer(int(object->layers().size()) - 1)->lslices);
|
double top_area = area(object->get_layer(int(object->layers().size()) - 1)->lslices);
|
||||||
|
|
Loading…
Reference in a new issue