Skip to content

Commit

Permalink
Adaptive layers - respect layer height range modifiers. (#5941)
Browse files Browse the repository at this point in the history
* Adaptive layers - respect layer height range modifiers.

* Remove #pragma optimize
  • Loading branch information
vovodroid authored Nov 21, 2024
1 parent 31be679 commit b3b0961
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/libslic3r/Slicing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ std::vector<double> layer_height_profile_adaptive(const SlicingParameters& slici
else if (layer_height_profile.back() > height && layer_height_profile.back() - height > LAYER_HEIGHT_CHANGE_STEP)
height = layer_height_profile.back() - LAYER_HEIGHT_CHANGE_STEP;

for (auto const& [range,options] : object.layer_config_ranges) {
if ( print_z >= range.first && print_z <= range.second) {
height = options.opt_float("layer_height");
break;
};
};

layer_height_profile.push_back(print_z);
layer_height_profile.push_back(height);
print_z += height;
Expand Down Expand Up @@ -444,6 +451,7 @@ std::vector<double> smooth_height_profile(const std::vector<double>& profile, co
}

void adjust_layer_height_profile(
const ModelObject &model_object,
const SlicingParameters &slicing_params,
std::vector<coordf_t> &layer_height_profile,
coordf_t z,
Expand Down Expand Up @@ -478,6 +486,11 @@ void adjust_layer_height_profile(
}
}

for (auto const& [range,options] : model_object.layer_config_ranges) {
if (z >= range.first - current_layer_height && z <= range.second + current_layer_height)
return;
};

// 2) Is it possible to apply the delta?
switch (action) {
case LAYER_HEIGHT_EDIT_ACTION_DECREASE:
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Slicing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ enum LayerHeightEditActionType : unsigned int {
};

void adjust_layer_height_profile(
const ModelObject &model_object,
const SlicingParameters &slicing_params,
std::vector<coordf_t> &layer_height_profile,
coordf_t z,
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GLCanvas3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ void GLCanvas3D::LayersEditing::adjust_layer_height_profile()
{
this->update_slicing_parameters();
PrintObject::update_layer_height_profile(*m_model_object, *m_slicing_parameters, m_layer_height_profile);
Slic3r::adjust_layer_height_profile(*m_slicing_parameters, m_layer_height_profile, this->last_z, this->strength, this->band_width, this->last_action);
Slic3r::adjust_layer_height_profile(*m_model_object, *m_slicing_parameters, m_layer_height_profile, this->last_z, this->strength, this->band_width, this->last_action);
m_layers_texture.valid = false;
}

Expand Down

0 comments on commit b3b0961

Please sign in to comment.