Skip to content

Commit

Permalink
Fix flip-around of boolean. Refactor in prep for consolidation.
Browse files Browse the repository at this point in the history
There's some code duplication that needs to be consolidated, so refactor the 'copy' (or original rather) so it's like the others and can be easily combined into one funciton. While that was being done, found that the booleans weren't flipped after the order of the input array was changed. (In order to print the lower bits _first_, _then_ the 'normal' support.

part of CURA-10407
  • Loading branch information
rburema committed Oct 17, 2023
1 parent f61991b commit 774cc0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/TreeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2230,14 +2230,14 @@ void TreeSupport::finalizeInterfaceAndSupportAreas(std::vector<Polygons>& suppor
= (layer_idx + 1) >= support_layer_storage.size() || layer_idx <= 0 ? Polygons() : support_layer_storage[layer_idx + 1].offset(config.maximum_move_distance);
const auto all_support_areas_in_layer
= { support_layer_storage[layer_idx].difference(support_layer_storage_above), support_layer_storage[layer_idx].intersection(support_layer_storage_above) };
bool use_fractional_config = false;
bool use_fractional_config = true;
for (auto& support_areas : all_support_areas_in_layer)
{
for (auto& part : support_areas.splitIntoParts(true)) // Convert every part into a PolygonsPart for the support.
{
storage.support.supportLayers[layer_idx].support_infill_parts.emplace_back(part, config.support_line_width, use_fractional_config, config.support_wall_count);
}
use_fractional_config = true;
use_fractional_config = false;
}

{
Expand Down
4 changes: 2 additions & 2 deletions src/TreeSupportTipGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,15 +1168,15 @@ void TreeSupportTipGenerator::generateTips(
= (layer_idx + 1) >= support_roof_drawn.size() || layer_idx <= 0 ? Polygons() : support_roof_drawn[layer_idx + 1].offset(config.maximum_move_distance);
const auto all_support_areas_in_layer
= { support_roof_drawn[layer_idx].difference(support_roof_drawn_above), support_roof_drawn[layer_idx].intersection(support_roof_drawn_above) };
bool use_fractional_config = false;
bool use_fractional_config = true;
for (auto& support_areas : all_support_areas_in_layer)
{
for (const auto& part : support_areas.splitIntoParts())
{
storage.support.supportLayers[layer_idx]
.support_infill_parts.emplace_back(part, config.support_line_width, use_fractional_config, 0, support_roof_line_distance);
}
use_fractional_config = true;
use_fractional_config = false;
}
placed_support_lines_support_areas[layer_idx].add(TreeSupportUtils::generateSupportInfillLines(
support_roof_drawn[layer_idx],
Expand Down
26 changes: 12 additions & 14 deletions src/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,25 @@ void AreaSupport::splitGlobalSupportAreasIntoSupportInfillParts(
continue;
}

coord_t support_line_width_here = support_line_width;
if (layer_nr == 0 && mesh_group_settings.get<EPlatformAdhesion>("adhesion_type") != EPlatformAdhesion::RAFT)
{
support_line_width_here *= infill_extruder.settings.get<Ratio>("initial_layer_line_width_factor");
}
// We don't generate insets and infill area for the parts yet because later the skirt/brim and prime
// tower will remove themselves from the support, so the outlines of the parts can be changed.

const Polygons& global_support_areas_above
= (layer_nr + 1) >= global_support_areas_per_layer.size() || layer_nr <= 0 ? Polygons() : global_support_areas_per_layer[layer_nr + 1];
const auto all_support_areas_in_layer = { global_support_areas.difference(global_support_areas_above), global_support_areas.intersection(global_support_areas_above) };
bool use_fractional_config = false;
bool use_fractional_config = true;
for (auto& support_areas : all_support_areas_in_layer)
{
std::vector<PolygonsPart> support_islands = support_areas.splitIntoParts();
for (const PolygonsPart& island_outline : support_islands)
for (const PolygonsPart& island_outline : support_areas.splitIntoParts())
{
coord_t support_line_width_here = support_line_width;
if (layer_nr == 0 && mesh_group_settings.get<EPlatformAdhesion>("adhesion_type") != EPlatformAdhesion::RAFT)
{
support_line_width_here *= infill_extruder.settings.get<Ratio>("initial_layer_line_width_factor");
}
// We don't generate insets and infill area for the parts yet because later the skirt/brim and prime
// tower will remove themselves from the support, so the outlines of the parts can be changed.
SupportInfillPart support_infill_part(island_outline, support_line_width_here, use_fractional_config, wall_line_count_this_layer);

storage.support.supportLayers[layer_nr].support_infill_parts.push_back(support_infill_part);
storage.support.supportLayers[layer_nr].support_infill_parts.emplace_back(island_outline, support_line_width_here, use_fractional_config, wall_line_count_this_layer);
}
use_fractional_config = true;
use_fractional_config = false;
}
}
}
Expand Down

0 comments on commit 774cc0f

Please sign in to comment.