NEW:add variable layer height

Change-Id: Idef7f0dea32e4faaeb4d6eb188695cc7b554099c
(cherry picked from commit 4969835159eebb356e9b26dab223ad0a18882b70)
This commit is contained in:
liz.li 2022-10-28 11:19:43 +08:00 committed by Lane.Wei
parent b44f3ae3e6
commit 22dd20ab58
16 changed files with 927 additions and 75 deletions

View file

@ -1892,9 +1892,8 @@ std::vector<unsigned int> PrintObject::object_extruders() const
bool PrintObject::update_layer_height_profile(const ModelObject &model_object, const SlicingParameters &slicing_parameters, std::vector<coordf_t> &layer_height_profile)
{
bool updated = false;
//BBS:annotate these part and will do adaptive layer height below
/*if (layer_height_profile.empty()) {
if (layer_height_profile.empty()) {
// use the constructor because the assignement is crashing on ASAN OsX
layer_height_profile = std::vector<coordf_t>(model_object.layer_height_profile.get());
// layer_height_profile = model_object.layer_height_profile;
@ -1909,22 +1908,22 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_parameters.object_print_z_max + slicing_parameters.object_print_z_min) > 1e-3))
layer_height_profile.clear();
if (layer_height_profile.empty()) {
if (layer_height_profile.empty() || layer_height_profile[1] != slicing_parameters.layer_height) {
//layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_config_ranges, model_object.volumes);
layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges);
updated = true;
}*/
}
//BBS
if (slicing_parameters.adaptive_layer_height) {
layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object, 0.5);
HeightProfileSmoothingParams smoothing_params(5, true);
layer_height_profile = smooth_height_profile(layer_height_profile, slicing_parameters, smoothing_params);
}
else {
layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges);
}
updated = true;
//if (slicing_parameters.adaptive_layer_height) {
// layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object, 0.5);
// HeightProfileSmoothingParams smoothing_params(5, true);
// layer_height_profile = smooth_height_profile(layer_height_profile, slicing_parameters, smoothing_params);
//}
//else {
// layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges);
//}
//updated = true;
return updated;
}