Skip to content

Commit

Permalink
Fix roof cradle base calculation creating non-supportable bases
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRahm committed May 2, 2024
1 parent ba8208d commit 2cec577
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
20 changes: 16 additions & 4 deletions src/TreeSupportCradle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,11 @@ void SupportCradleGeneration::generateCradleLineAreasAndBase(const SliceDataStor
support_rests_on_model,
! xy_overrides);
std::vector<std::pair<Polygons, int32_t>> roofs;
roofs.emplace_back(cradle_base, -1);

if(cradle.is_roof_)
{
roofs.emplace_back(cradle_base, -1);
}

for (size_t line_idx = 0; line_idx < cradle.lines_.size(); line_idx++)
{
Expand Down Expand Up @@ -1108,7 +1112,12 @@ void SupportCradleGeneration::generateCradleLineAreasAndBase(const SliceDataStor
}
else
{
if (roof_area_before.area() > 1)

if(dtt_roof == 0 && roof_area_pair.second < 0) // There was no roof base!
{
cradle.is_roof_ = false; //Try a regular base
}
else if (roof_area_before.area() > 1)
{
LayerIndex line_layer_idx
= roof_area_pair.second < 0 ? LayerIndex(-1) : cradle_data_[mesh_idx][layer_idx][cradle_idx]->lines_[roof_area_pair.second].front().layer_idx_;
Expand All @@ -1121,7 +1130,8 @@ void SupportCradleGeneration::generateCradleLineAreasAndBase(const SliceDataStor
}
}
}
else

if(!cradle.is_roof_)
{
Polygons forbidden_here = volumes_.getAvoidance(
0,
Expand All @@ -1136,7 +1146,9 @@ void SupportCradleGeneration::generateCradleLineAreasAndBase(const SliceDataStor
OverhangInformation cradle_overhang(cradle_base, false, cradle_data_[mesh_idx][layer_idx][cradle_idx]);
cradle.overhang_[layer_idx].emplace_back(cradle_overhang);
}

}
if(!cradle.config_->cradle_lines_roof_)
{
for (size_t line_idx = 0; line_idx < cradle.lines_.size(); line_idx++)
{
if (! cradle.lines_[line_idx].empty())
Expand Down
3 changes: 1 addition & 2 deletions src/TreeSupportTipGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,7 @@ void TreeSupportTipGenerator::calculateRoofAreas(const cura::SliceMeshStorage& m
{
// Roof does not have a radius, so remove it using offset. Note that there is no 0 radius avoidance, and it would not be identical with the avoidance offset with
// -radius. This is intentional here, as support roof is still valid if only a part of the tip may reach it.
Polygons forbidden_here = volumes_
.getAvoidance(
Polygons forbidden_here = volumes_.getAvoidance(
0,
layer_idx,
(only_gracious_ || ! config_.support_rests_on_model) ? AvoidanceType::FAST : AvoidanceType::COLLISION,
Expand Down

0 comments on commit 2cec577

Please sign in to comment.