Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/ultimaker/curaengine
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub committed Oct 2, 2021
2 parents abd144f + 164f5a4 commit 14788c4
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ Polygons LayerPlan::computeCombBoundaryInside(const size_t max_inset)
}
}
}
else if (combing_mode == CombingMode::NO_OUTER_SURFACES)
{
Polygons top_and_bottom_most_fill;
for (const SliceLayerPart& part : layer.parts)
{
for (const SkinPart& skin_part : part.skin_parts)
{
top_and_bottom_most_fill.add(skin_part.top_most_surface_fill);
top_and_bottom_most_fill.add(skin_part.bottom_most_surface_fill);
}
}
comb_boundary.add(layer.getInnermostWalls(max_inset, mesh).difference(top_and_bottom_most_fill));
}
else if (combing_mode == CombingMode::INFILL)
{
for (const SliceLayerPart& part : layer.parts)
Expand Down
1 change: 1 addition & 0 deletions src/settings/EnumSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ enum class CombingMode
OFF,
ALL,
NO_SKIN,
NO_OUTER_SURFACES,
INFILL
};

Expand Down
4 changes: 4 additions & 0 deletions src/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ template<> CombingMode Settings::get<CombingMode>(const std::string& key) const
{
return CombingMode::NO_SKIN;
}
else if (value == "no_outer_surfaces")
{
return CombingMode::NO_OUTER_SURFACES;
}
else if (value == "infill")
{
return CombingMode::INFILL;
Expand Down
58 changes: 54 additions & 4 deletions src/skin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ void SkinInfillAreaComputation::generateSkinsAndInfill()
generateSkinInsetsAndInnerSkinInfill(&part);

generateRoofing(part);

generateTopAndBottomMostSkinSurfaces(part);
}
}

Expand Down Expand Up @@ -473,7 +475,7 @@ void SkinInfillAreaComputation::generateRoofing(SliceLayerPart& part)

for (SkinPart& skin_part : part.skin_parts)
{
Polygons no_air_above = generateNoAirAbove(part);
Polygons no_air_above = generateNoAirAbove(part, roofing_layer_count);
skin_part.roofing_fill = skin_part.inner_infill.difference(no_air_above);
skin_part.inner_infill = skin_part.inner_infill.intersection(no_air_above);

Expand Down Expand Up @@ -512,9 +514,8 @@ void SkinInfillAreaComputation::generateRoofing(SliceLayerPart& part)
*
* this function may only read the skin and infill from the *current* layer.
*/
Polygons SkinInfillAreaComputation::generateNoAirAbove(SliceLayerPart& part)
Polygons SkinInfillAreaComputation::generateNoAirAbove(SliceLayerPart& part, size_t roofing_layer_count)
{
const size_t roofing_layer_count = std::min(mesh.settings.get<size_t>("roofing_layer_count"), mesh.settings.get<size_t>("top_layers"));
const size_t wall_idx = std::min(size_t(2), mesh.settings.get<size_t>("wall_line_count"));

Polygons no_air_above = getWalls(part, layer_nr + roofing_layer_count, wall_idx);
Expand Down Expand Up @@ -545,6 +546,35 @@ Polygons SkinInfillAreaComputation::generateNoAirAbove(SliceLayerPart& part)
return no_air_above;
}

/*
* This function is executed in a parallel region based on layer_nr.
* When modifying make sure any changes does not introduce data races.
*
* this function may only read the skin and infill from the *current* layer.
*/
Polygons SkinInfillAreaComputation::generateNoAirBelow(SliceLayerPart& part, size_t flooring_layer_count)
{
if (layer_nr < flooring_layer_count)
{
return {};
}
constexpr size_t min_wall_line_count = 2;
const size_t wall_idx = std::min(min_wall_line_count, mesh.settings.get<size_t>("wall_line_count"));
const int lowest_flooring_layer = layer_nr - flooring_layer_count;
Polygons no_air_below = getWalls(part, lowest_flooring_layer, wall_idx);

if (!no_small_gaps_heuristic)
{
const int next_lowest_flooring_layer = lowest_flooring_layer + 1;
for (int layer_nr_below = next_lowest_flooring_layer; layer_nr_below < layer_nr; layer_nr_below++)
{
Polygons outlines_below = getWalls(part, layer_nr_below, wall_idx);
no_air_below = no_air_below.intersection(outlines_below);
}
}
return no_air_below;
}

/*
* This function is executed in a parallel region based on layer_nr.
* When modifying make sure any changes does not introduce data races.
Expand All @@ -553,8 +583,10 @@ Polygons SkinInfillAreaComputation::generateNoAirAbove(SliceLayerPart& part)
*/
void SkinInfillAreaComputation::regenerateRoofingFillAndInnerInfill(SliceLayerPart& part, SkinPart& skin_part)
{
const size_t roofing_layer_count = std::min(mesh.settings.get<size_t>("roofing_layer_count"), mesh.settings.get<size_t>("top_layers"));

generateInnerSkinInfill(skin_part);
Polygons no_air_above = generateNoAirAbove(part);
Polygons no_air_above = generateNoAirAbove(part, roofing_layer_count);
skin_part.roofing_fill = skin_part.inner_infill.difference(no_air_above);
skin_part.inner_infill = skin_part.inner_infill.intersection(no_air_above);
}
Expand Down Expand Up @@ -759,5 +791,23 @@ void SkinInfillAreaComputation::combineInfillLayers(SliceMeshStorage& mesh)
}
}

/*
* This function is executed in a parallel region based on layer_nr.
* When modifying make sure any changes does not introduce data races.
*
* this function may only read/write the skin and infill from the *current* layer.
*/

void SkinInfillAreaComputation::generateTopAndBottomMostSkinSurfaces(SliceLayerPart &part) {

for (SkinPart& skin_part : part.skin_parts) {
Polygons no_air_above = generateNoAirAbove(part, 1);
skin_part.top_most_surface_fill = skin_part.inner_infill.difference(no_air_above);

Polygons no_air_below = generateNoAirBelow(part, 1);
skin_part.bottom_most_surface_fill = skin_part.inner_infill.difference(no_air_below);
}
}


}//namespace cura
21 changes: 20 additions & 1 deletion src/skin.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,31 @@ class SkinInfillAreaComputation
*/
void generateRoofing(SliceLayerPart& part);

/*!
* Remove the areas which are directly under air in the top-most surface and directly above air in bottom-most
* surfaces from the \ref SkinPart::inner_infill and save them in the \ref SkinPart::bottom_most_surface_fill and
* \ref SkinPart::top_most_surface_fill (respectively) of the \p part.
*
* \param[in,out] part Where to get the SkinParts to get the outline info from and to store the top and bottom-most
* infill areas
*/
void generateTopAndBottomMostSkinSurfaces(SliceLayerPart& part);

/*!
* Helper function to calculate and return the areas which are 'directly' under air.
*
* \param part Where to get the SkinParts to get the outline info from
* \param roofing_layer_count The number of layers above the layer which we are looking into
*/
Polygons generateNoAirAbove(SliceLayerPart& part, size_t roofing_layer_count);

/*!
* Helper function to calculate and return the areas which are 'directly' above air.
*
* \param part Where to get the SkinParts to get the outline info from
* \param flooring_layer_count The number of layers below the layer which we are looking into
*/
Polygons generateNoAirAbove(SliceLayerPart& part);
Polygons generateNoAirBelow(SliceLayerPart& part, size_t flooring_layer_count);

/*!
* Helper function to recalculate the roofing fill and inner infill in roofing layers where the
Expand Down
2 changes: 2 additions & 0 deletions src/sliceDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class SkinPart
Polygons perimeter_gaps; //!< The gaps between the extra skin walls and gaps between the outer skin wall and the inner part inset
Polygons inner_infill; //!< The inner infill of the skin with which the area within the innermost inset is filled
Polygons roofing_fill; //!< The inner infill which has air directly above
Polygons top_most_surface_fill; //!< The inner infill of the uppermost top layer which has air directly above.
Polygons bottom_most_surface_fill; //!< The inner infill of the bottommost bottom layer which has air directly below.
};


Expand Down

0 comments on commit 14788c4

Please sign in to comment.