From b7405e20f382eb2682def9f22366cf090015ee13 Mon Sep 17 00:00:00 2001
From: Thomas Rahm <67757218+ThomasRahm@users.noreply.github.com>
Date: Fri, 3 May 2024 00:21:03 +0200
Subject: [PATCH] Fix roof generating for areas that are handled by cradle
bases or lines. Prevents some kind of overlapping roof lines.
---
.idea old/CuraEngine.iml | 8 +
.idea old/modules.xml | 8 +
.idea old/vcs.xml | 6 +
.idea old/workspace.xml | 620 ++++++++++++++++++++++++++++++++
src/TreeSupportTipGenerator.cpp | 10 +-
5 files changed, 649 insertions(+), 3 deletions(-)
create mode 100644 .idea old/CuraEngine.iml
create mode 100644 .idea old/modules.xml
create mode 100644 .idea old/vcs.xml
create mode 100644 .idea old/workspace.xml
diff --git a/.idea old/CuraEngine.iml b/.idea old/CuraEngine.iml
new file mode 100644
index 0000000000..bc2cd87409
--- /dev/null
+++ b/.idea old/CuraEngine.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea old/modules.xml b/.idea old/modules.xml
new file mode 100644
index 0000000000..b2c143199d
--- /dev/null
+++ b/.idea old/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea old/vcs.xml b/.idea old/vcs.xml
new file mode 100644
index 0000000000..35eb1ddfbb
--- /dev/null
+++ b/.idea old/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea old/workspace.xml b/.idea old/workspace.xml
new file mode 100644
index 0000000000..266b24e9f9
--- /dev/null
+++ b/.idea old/workspace.xml
@@ -0,0 +1,620 @@
+
+
+
+
+
+ {
+ "useNewFormat": true
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "associatedIndex": 4
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1678394920451
+
+
+ 1678394920451
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1678421241480
+
+
+
+ 1678421241480
+
+
+ 1700343676433
+
+
+
+ 1700343676433
+
+
+ 1700431581566
+
+
+
+ 1700431581566
+
+
+ 1700431675358
+
+
+
+ 1700431675358
+
+
+ 1700465653211
+
+
+
+ 1700465653211
+
+
+ 1700466016952
+
+
+
+ 1700466016952
+
+
+ 1702835717484
+
+
+
+ 1702835717484
+
+
+ 1702922709142
+
+
+
+ 1702922709142
+
+
+ 1702932319666
+
+
+
+ 1702932319666
+
+
+
+ 1703420088921
+
+
+
+ 1703420088921
+
+
+ 1703462493363
+
+
+
+ 1703462493363
+
+
+ 1703463612471
+
+
+
+ 1703463612471
+
+
+ 1703463697385
+
+
+
+ 1703463697385
+
+
+ 1703465537553
+
+
+
+ 1703465537553
+
+
+ 1703465554816
+
+
+
+ 1703465554816
+
+
+ 1703465577649
+
+
+
+ 1703465577649
+
+
+ 1704066229353
+
+
+
+ 1704066229353
+
+
+ 1704120994568
+
+
+
+ 1704120994568
+
+
+ 1704561588725
+
+
+
+ 1704561588725
+
+
+ 1704563429670
+
+
+
+ 1704563429670
+
+
+ 1704771760712
+
+
+
+ 1704771760713
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/WallToolPaths.cpp
+ 357
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/TreeSupportTipGenerator.cpp b/src/TreeSupportTipGenerator.cpp
index 0259eb01a7..dd99db7e4f 100644
--- a/src/TreeSupportTipGenerator.cpp
+++ b/src/TreeSupportTipGenerator.cpp
@@ -481,7 +481,7 @@ void TreeSupportTipGenerator::calculateRoofAreas(const cura::SliceMeshStorage& m
dropOverhangAreas(mesh, dropped_overhangs, true);
}
- std::vector all_cradle_areas(cradle_data.size());
+ std::vector all_cradle_areas(cradle_data.size()); // All cradle areas. Later offset by min xy distance.
for (LayerIndex layer_idx = 0; layer_idx < cradle_data.size(); layer_idx++)
{
for (size_t cradle_idx = 0; cradle_idx < cradle_data[layer_idx].size(); cradle_idx++)
@@ -505,6 +505,10 @@ void TreeSupportTipGenerator::calculateRoofAreas(const cura::SliceMeshStorage& m
mesh.overhang_areas.size() - z_distance_delta_,
[&](const LayerIndex layer_idx)
{
+
+ // Needed for fuzzy roof search below.
+ all_cradle_areas[layer_idx] = all_cradle_areas[layer_idx].unionPolygons().offset(config_.xy_distance + FUDGE_LENGTH).unionPolygons();
+
if (mesh.overhang_areas[layer_idx + z_distance_delta_].empty())
{
return; // This is a continue if imagined in a loop context.
@@ -533,7 +537,7 @@ void TreeSupportTipGenerator::calculateRoofAreas(const cura::SliceMeshStorage& m
&config_.simplifier);
// If an area is already supported by cradle don't put roof there.
- full_overhang_area = full_overhang_area.difference(all_cradle_areas[layer_idx].unionPolygons().offset(config_.xy_distance + FUDGE_LENGTH).unionPolygons());
+ full_overhang_area = full_overhang_area.difference(all_cradle_areas[layer_idx]);
for (LayerIndex dtt_roof = 0; dtt_roof < support_roof_layers_ && layer_idx - dtt_roof >= 1; dtt_roof++)
{
@@ -602,7 +606,7 @@ void TreeSupportTipGenerator::calculateRoofAreas(const cura::SliceMeshStorage& m
layer_idx,
(only_gracious_ || ! config_.support_rests_on_model) ? AvoidanceType::FAST : AvoidanceType::COLLISION,
config_.support_rests_on_model,
- ! xy_overrides_);
+ ! xy_overrides_).unionPolygons(all_cradle_areas[layer_idx]);
if (! force_minimum_roof_area_)
{