Skip to content

Commit

Permalink
Revert "Fix build"
Browse files Browse the repository at this point in the history
This reverts commit b33c2e5
  • Loading branch information
casperlamboo committed Dec 19, 2023
1 parent 5510151 commit 5910ded
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 71 deletions.
3 changes: 1 addition & 2 deletions include/TreeSupportSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ struct TreeSupportSettings
max_radius(mesh_group_settings.get<coord_t>("support_tree_max_diameter") / 2)
, maximum_move_distance((angle < TAU / 4) ? std::llround(tan(angle) * layer_height) : std::numeric_limits<coord_t>::max())
, maximum_move_distance_slow((angle_slow < TAU / 4) ? std::llround(tan(angle_slow) * layer_height) : std::numeric_limits<coord_t>::max())
, support_bottom_layers(
(false && mesh_group_settings.get<bool>("support_bottom_enable")) ? round_divide(mesh_group_settings.get<coord_t>("support_bottom_height"), layer_height) : 0)
, support_bottom_layers(mesh_group_settings.get<bool>("support_bottom_enable") ? round_divide(mesh_group_settings.get<coord_t>("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<AngleRadians>("support_tree_branch_diameter_angle")) * layer_height / branch_radius)
Expand Down
8 changes: 4 additions & 4 deletions src/TreeSupportTipGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ namespace cura

TreeSupportTipGenerator::TreeSupportTipGenerator(const SliceMeshStorage& mesh, TreeModelVolumes& volumes_s)
: config_(mesh.settings)
, use_fake_roof_(! (false && mesh.settings.get<bool>("support_roof_enable")))
, use_fake_roof_(! mesh.settings.get<bool>("support_roof_enable"))
, volumes_(volumes_s)
, minimum_support_area_(mesh.settings.get<double>("minimum_support_area"))
, minimum_roof_area_(! use_fake_roof_ ? mesh.settings.get<double>("minimum_roof_area") : std::max(SUPPORT_TREE_MINIMUM_FAKE_ROOF_AREA, minimum_support_area_))
, support_roof_layers_(
(false && mesh.settings.get<bool>("support_roof_enable")) ? round_divide(mesh.settings.get<coord_t>("support_roof_height"), config_.layer_height)
: use_fake_roof_ ? SUPPORT_TREE_MINIMUM_FAKE_ROOF_LAYERS
: 0)
mesh.settings.get<bool>("support_roof_enable") ? round_divide(mesh.settings.get<coord_t>("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<double>("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_)
Expand Down
34 changes: 9 additions & 25 deletions src/sliceDataStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ std::vector<bool> SliceDataStorage::getExtrudersUsed() const
{
ret[mesh_group_settings.get<ExtruderTrain&>("support_extruder_nr_layer_0").extruder_nr_] = true;
ret[mesh_group_settings.get<ExtruderTrain&>("support_infill_extruder_nr").extruder_nr_] = true;
if (false && mesh_group_settings.get<bool>("support_roof_enable"))
if (mesh_group_settings.get<bool>("support_roof_enable"))
{
ret[mesh_group_settings.get<ExtruderTrain&>("support_roof_extruder_nr").extruder_nr_] = true;
}
if (false && mesh_group_settings.get<bool>("support_bottom_enable"))
if (mesh_group_settings.get<bool>("support_bottom_enable"))
{
ret[mesh_group_settings.get<ExtruderTrain&>("support_bottom_extruder_nr").extruder_nr_] = true;
}
Expand Down Expand Up @@ -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;
}
}

Expand Down
44 changes: 4 additions & 40 deletions src/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -700,11 +691,11 @@ void AreaSupport::generateSupportAreas(SliceDataStorage& storage)
continue;
}

if (false && mesh->settings.get<bool>("support_roof_enable"))
if (mesh->settings.get<bool>("support_roof_enable"))
{
generateSupportRoof(storage, *mesh, global_support_areas_per_layer);
}
if (false && mesh->settings.get<bool>("support_bottom_enable"))
if (mesh->settings.get<bool>("support_bottom_enable"))
{
generateSupportBottom(storage, *mesh, global_support_areas_per_layer);
}
Expand Down Expand Up @@ -890,20 +881,13 @@ 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;
const auto delta_z = z_delta_poly.delta_z;
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)
Expand Down Expand Up @@ -969,14 +953,6 @@ Polygons AreaSupport::generateVaryingXYDisallowedArea(const SliceMeshStorage& st
offset_dist = commutative_offset / static_cast<double>(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<coord_t>(offset_dist));
}
}
Expand Down Expand Up @@ -1033,7 +1009,7 @@ void AreaSupport::generateSupportAreasForMesh(

// early out
const coord_t layer_thickness = mesh_group_settings.get<coord_t>("layer_height");
const coord_t z_distance_top = ((false && mesh.settings.get<bool>("support_roof_enable")) ? roof_settings : infill_settings).get<coord_t>("support_top_distance");
const coord_t z_distance_top = ((mesh.settings.get<bool>("support_roof_enable")) ? roof_settings : infill_settings).get<coord_t>("support_top_distance");
const size_t layer_z_distance_top = (z_distance_top / layer_thickness) + 1;
if (layer_z_distance_top + 1 > layer_count)
{
Expand Down Expand Up @@ -1123,7 +1099,7 @@ void AreaSupport::generateSupportAreasForMesh(
const coord_t max_tower_supported_diameter = infill_settings.get<coord_t>("support_tower_maximum_supported_diameter");
const bool use_towers = infill_settings.get<bool>("support_use_towers") && max_tower_supported_diameter > 0;

const coord_t z_distance_bottom = ((false && mesh.settings.get<bool>("support_bottom_enable")) ? bottom_settings : infill_settings).get<coord_t>("support_bottom_distance");
const coord_t z_distance_bottom = ((mesh.settings.get<bool>("support_bottom_enable")) ? bottom_settings : infill_settings).get<coord_t>("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<coord_t>(0), mesh.settings.get<coord_t>("support_bottom_stair_step_height"));
const size_t bottom_stair_step_layer_count
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 5910ded

Please sign in to comment.