From 5910dede0aaaea95f32c5676f3281a3fe123656d Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 19 Dec 2023 10:49:55 +0100 Subject: [PATCH] Revert "Fix build" This reverts commit b33c2e52 --- include/TreeSupportSettings.h | 3 +-- src/TreeSupportTipGenerator.cpp | 8 +++--- src/sliceDataStorage.cpp | 34 +++++++------------------ src/support.cpp | 44 +++------------------------------ 4 files changed, 18 insertions(+), 71 deletions(-) diff --git a/include/TreeSupportSettings.h b/include/TreeSupportSettings.h index 476292d4d7..78be092694 100644 --- a/include/TreeSupportSettings.h +++ b/include/TreeSupportSettings.h @@ -34,8 +34,7 @@ struct TreeSupportSettings max_radius(mesh_group_settings.get("support_tree_max_diameter") / 2) , maximum_move_distance((angle < TAU / 4) ? std::llround(tan(angle) * layer_height) : std::numeric_limits::max()) , maximum_move_distance_slow((angle_slow < TAU / 4) ? std::llround(tan(angle_slow) * layer_height) : std::numeric_limits::max()) - , support_bottom_layers( - (false && mesh_group_settings.get("support_bottom_enable")) ? round_divide(mesh_group_settings.get("support_bottom_height"), layer_height) : 0) + , support_bottom_layers(mesh_group_settings.get("support_bottom_enable") ? round_divide(mesh_group_settings.get("support_bottom_height"), layer_height) : 0) , tip_layers(std::max((branch_radius - min_radius) / (support_line_width / 3), branch_radius / layer_height)) , // Ensure lines always stack nicely even if layer height is large diameter_angle_scale_factor(sin(mesh_group_settings.get("support_tree_branch_diameter_angle")) * layer_height / branch_radius) diff --git a/src/TreeSupportTipGenerator.cpp b/src/TreeSupportTipGenerator.cpp index 0e1fa4252e..a908d06d71 100644 --- a/src/TreeSupportTipGenerator.cpp +++ b/src/TreeSupportTipGenerator.cpp @@ -30,14 +30,14 @@ namespace cura TreeSupportTipGenerator::TreeSupportTipGenerator(const SliceMeshStorage& mesh, TreeModelVolumes& volumes_s) : config_(mesh.settings) - , use_fake_roof_(! (false && mesh.settings.get("support_roof_enable"))) + , use_fake_roof_(! mesh.settings.get("support_roof_enable")) , volumes_(volumes_s) , minimum_support_area_(mesh.settings.get("minimum_support_area")) , minimum_roof_area_(! use_fake_roof_ ? mesh.settings.get("minimum_roof_area") : std::max(SUPPORT_TREE_MINIMUM_FAKE_ROOF_AREA, minimum_support_area_)) , support_roof_layers_( - (false && mesh.settings.get("support_roof_enable")) ? round_divide(mesh.settings.get("support_roof_height"), config_.layer_height) - : use_fake_roof_ ? SUPPORT_TREE_MINIMUM_FAKE_ROOF_LAYERS - : 0) + mesh.settings.get("support_roof_enable") ? round_divide(mesh.settings.get("support_roof_height"), config_.layer_height) + : use_fake_roof_ ? SUPPORT_TREE_MINIMUM_FAKE_ROOF_LAYERS + : 0) , connect_length_( (config_.support_line_width * 100 / mesh.settings.get("support_tree_top_rate")) + std::max(2 * config_.min_radius - 1.0 * config_.support_line_width, 0.0)) , support_tree_branch_distance_((config_.support_pattern == EFillMethod::TRIANGLES ? 3 : (config_.support_pattern == EFillMethod::GRID ? 2 : 1)) * connect_length_) diff --git a/src/sliceDataStorage.cpp b/src/sliceDataStorage.cpp index 4b32bbfa04..94e2ccf16f 100644 --- a/src/sliceDataStorage.cpp +++ b/src/sliceDataStorage.cpp @@ -387,11 +387,11 @@ std::vector SliceDataStorage::getExtrudersUsed() const { ret[mesh_group_settings.get("support_extruder_nr_layer_0").extruder_nr_] = true; ret[mesh_group_settings.get("support_infill_extruder_nr").extruder_nr_] = true; - if (false && mesh_group_settings.get("support_roof_enable")) + if (mesh_group_settings.get("support_roof_enable")) { ret[mesh_group_settings.get("support_roof_extruder_nr").extruder_nr_] = true; } - if (false && mesh_group_settings.get("support_bottom_enable")) + if (mesh_group_settings.get("support_bottom_enable")) { ret[mesh_group_settings.get("support_bottom_extruder_nr").extruder_nr_] = true; } @@ -729,29 +729,13 @@ void SupportLayer::fillInfillParts( = (layer_nr + 1) >= support_fill_per_layer.size() || layer_nr <= 0 ? Polygons() : support_fill_per_layer[layer_nr + 1].offset(grow_layer_above); const auto all_support_areas_in_layer = { support_this_layer.difference(support_layer_above), support_this_layer.intersection(support_layer_above) }; bool use_fractional_config = true; - - // AABB aabb; - // for (const auto& support_areas : all_support_areas_in_layer) - // { - // aabb.include(support_areas); - // } - // aabb.expand(1000); - // SVG svg(fmt::format("support_area_{}_.svg", layer_nr), aabb); - // - // for (const auto support_areas : all_support_areas_in_layer) - // { - // svg.writePolygons(support_areas); - // - // for (const PolygonsPart& island_outline : support_areas.splitIntoParts(true)) - // { - //// support_infill_parts.emplace_back(island_outline, support_line_width, false, wall_line_count, custom_line_distance); - // } - // use_fractional_config = false; - // } - - for (const PolygonsPart& island_outline : support_this_layer.splitIntoParts(true)) - { - support_infill_parts.emplace_back(island_outline, support_line_width, false, wall_line_count, custom_line_distance); + for (auto& support_areas : all_support_areas_in_layer) + { + for (const PolygonsPart& island_outline : support_areas.splitIntoParts(unionAll)) + { + support_infill_parts.emplace_back(island_outline, support_line_width, use_fractional_config, wall_line_count, custom_line_distance); + } + use_fractional_config = false; } } diff --git a/src/support.cpp b/src/support.cpp index 444e60ab71..236c0f16ae 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -683,15 +683,6 @@ void AreaSupport::generateSupportAreas(SliceDataStorage& storage) support_areas = support_areas.unionPolygons(); } - for (auto [idx, support_area] : global_support_areas_per_layer | ranges::views::enumerate) - { - AABB aabb; - aabb.include(support_area); - aabb.expand(1000); - SVG svg(fmt::format("support_area_{}.svg", idx), aabb); - svg.writePolygons(support_area); - } - // handle support interface for (auto& mesh : storage.meshes) { @@ -700,11 +691,11 @@ void AreaSupport::generateSupportAreas(SliceDataStorage& storage) continue; } - if (false && mesh->settings.get("support_roof_enable")) + if (mesh->settings.get("support_roof_enable")) { generateSupportRoof(storage, *mesh, global_support_areas_per_layer); } - if (false && mesh->settings.get("support_bottom_enable")) + if (mesh->settings.get("support_bottom_enable")) { generateSupportBottom(storage, *mesh, global_support_areas_per_layer); } @@ -890,8 +881,6 @@ Polygons AreaSupport::generateVaryingXYDisallowedArea(const SliceMeshStorage& st } } - spdlog::info("test"); - for (const auto& z_delta_poly : z_distances_layer_deltas) { const auto support_distance = z_delta_poly.support_distance; @@ -899,11 +888,6 @@ Polygons AreaSupport::generateVaryingXYDisallowedArea(const SliceMeshStorage& st const auto layer_delta = z_delta_poly.layer_delta; const auto xy_distance_natural = support_distance * std::tan(overhang_angle); - spdlog::info("xy_distance_natural: {}", xy_distance_natural); - spdlog::info("support_distance: {}", support_distance); - spdlog::info("overhang_angle: {}", overhang_angle); - - for (auto [current_poly_idx, current_poly] : layer_current | ranges::views::enumerate) { for (auto [current_point_idx, current_point] : current_poly | ranges::views::enumerate) @@ -969,14 +953,6 @@ Polygons AreaSupport::generateVaryingXYDisallowedArea(const SliceMeshStorage& st offset_dist = commutative_offset / static_cast(n); } - if (offset_dist < 0.0) - { - spdlog::warn("varying offset dist is negative: {}", offset_dist); - offset_dist = 0.0; - } - - spdlog::debug("varying offset dist: {}", offset_dist); - varying_offsets.push_back(static_cast(offset_dist)); } } @@ -1033,7 +1009,7 @@ void AreaSupport::generateSupportAreasForMesh( // early out const coord_t layer_thickness = mesh_group_settings.get("layer_height"); - const coord_t z_distance_top = ((false && mesh.settings.get("support_roof_enable")) ? roof_settings : infill_settings).get("support_top_distance"); + const coord_t z_distance_top = ((mesh.settings.get("support_roof_enable")) ? roof_settings : infill_settings).get("support_top_distance"); const size_t layer_z_distance_top = (z_distance_top / layer_thickness) + 1; if (layer_z_distance_top + 1 > layer_count) { @@ -1123,7 +1099,7 @@ void AreaSupport::generateSupportAreasForMesh( const coord_t max_tower_supported_diameter = infill_settings.get("support_tower_maximum_supported_diameter"); const bool use_towers = infill_settings.get("support_use_towers") && max_tower_supported_diameter > 0; - const coord_t z_distance_bottom = ((false && mesh.settings.get("support_bottom_enable")) ? bottom_settings : infill_settings).get("support_bottom_distance"); + const coord_t z_distance_bottom = ((mesh.settings.get("support_bottom_enable")) ? bottom_settings : infill_settings).get("support_bottom_distance"); const size_t bottom_empty_layer_count = round_up_divide(z_distance_bottom, layer_thickness); // number of empty layers between support and model const coord_t bottom_stair_step_height = std::max(static_cast(0), mesh.settings.get("support_bottom_stair_step_height")); const size_t bottom_stair_step_layer_count @@ -1352,17 +1328,6 @@ void AreaSupport::generateSupportAreasForMesh( } } - for (auto [idx, support_area] : support_areas | ranges::views::enumerate) - { - { - AABB aabb; - aabb.include(support_area); - aabb.expand(1000); - SVG svg(fmt::format("support_area_{}_.svg", idx), aabb); - svg.writePolygons(support_area); - } - } - storage.support.generated = true; } @@ -1811,7 +1776,6 @@ void AreaSupport::generateSupportInterfaceLayer( const double minimum_interface_area, Polygons& interface_polygons) { - spdlog::info("Generating support interface layer"); Polygons model = colliding_mesh_outlines.unionPolygons(); interface_polygons = support_areas.offset(safety_offset / 2).intersection(model); interface_polygons = interface_polygons.offset(safety_offset).intersection(support_areas); // Make sure we don't generate any models that are not printable.