Skip to content

Commit

Permalink
Merge branch 'main' into CURA-9838_brim_location
Browse files Browse the repository at this point in the history
  • Loading branch information
saumyaj3 authored Mar 5, 2024
2 parents a7047be + 2325bb7 commit 20e3401
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/FffPolygonGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,20 @@ bool FffPolygonGenerator::isEmptyLayer(SliceDataStorage& storage, const LayerInd
void FffPolygonGenerator::removeEmptyFirstLayers(SliceDataStorage& storage, size_t& total_layers)
{
size_t n_empty_first_layers = 0;
coord_t hightest_empty_layer = 0;
for (size_t layer_idx = 0; layer_idx < total_layers; layer_idx++)
{
if (isEmptyLayer(storage, layer_idx))
{
n_empty_first_layers++;

coord_t layer_highest_z = 0;
for (const std::shared_ptr<SliceMeshStorage>& mesh_ptr : storage.meshes)
{
const auto& mesh = *mesh_ptr;
layer_highest_z = layer_idx >= mesh.layers.size() ? layer_highest_z : std::max(layer_highest_z, mesh.layers[layer_idx].printZ);
}
hightest_empty_layer = std::max(hightest_empty_layer, layer_highest_z);
}
else
{
Expand All @@ -798,7 +807,7 @@ void FffPolygonGenerator::removeEmptyFirstLayers(SliceDataStorage& storage, size
layers.erase(layers.begin(), layers.begin() + n_empty_first_layers);
for (SliceLayer& layer : layers)
{
layer.printZ -= n_empty_first_layers * layer_height;
layer.printZ -= hightest_empty_layer;
}
mesh.layer_nr_max_filled_layer -= n_empty_first_layers;
}
Expand Down

0 comments on commit 20e3401

Please sign in to comment.