WIP: Organic supports - bottom interfaces

This commit is contained in:
Vojtech Bubnik 2023-05-05 14:23:09 +02:00
parent ad203baf77
commit 89f0895dd6
3 changed files with 19 additions and 7 deletions

View File

@ -79,7 +79,9 @@ TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(const PrintObject &pr
// this->support_interface_skip_height =
// this->support_infill_angles =
this->support_roof_enable = config.support_material_interface_layers.value > 0;
this->support_roof_height = config.support_material_interface_layers.value * this->layer_height;
this->support_roof_layers = this->support_roof_enable ? config.support_material_interface_layers.value : 0;
this->support_floor_enable = config.support_material_interface_layers.value > 0 && config.support_material_bottom_interface_layers.value > 0;
this->support_floor_layers = this->support_floor_enable ? config.support_material_bottom_interface_layers.value : 0;
// this->minimum_roof_area =
// this->support_roof_angles =
this->support_roof_pattern = config.support_material_interface_pattern;

View File

@ -94,7 +94,9 @@ struct TreeSupportMeshGroupSettings {
bool support_roof_enable { false };
// Support Roof Thickness
// The thickness of the support roofs. This controls the amount of dense layers at the top of the support on which the model rests.
coord_t support_roof_height { scaled<coord_t>(1.) };
coord_t support_roof_layers { 2 };
bool support_floor_enable { false };
coord_t support_floor_layers { 2 };
// Minimum Support Roof Area
// Minimum area size for the roofs of the support. Polygons which have an area smaller than this value will be printed as normal support.
double minimum_roof_area { scaled<double>(scaled<double>(1.)) };

View File

@ -1460,7 +1460,7 @@ static void generate_initial_areas(
//FIXME this is a heuristic value for support enforcers to work.
// + 10 * config.support_line_width;
;
const size_t num_support_roof_layers = mesh_group_settings.support_roof_enable ? (mesh_group_settings.support_roof_height + config.layer_height / 2) / config.layer_height : 0;
const size_t num_support_roof_layers = mesh_group_settings.support_roof_layers;
const bool roof_enabled = num_support_roof_layers > 0;
const bool force_tip_to_roof = sqr<double>(config.min_radius) * M_PI > mesh_group_settings.minimum_roof_area && roof_enabled;
// cap for how much layer below the overhang a new support point may be added, as other than with regular support every new inserted point
@ -4211,6 +4211,7 @@ static std::vector<Polygons> draw_branches(
struct Slice {
Polygons polygons;
Polygons bottom_interfaces;
size_t num_branches{ 0 };
};
@ -4310,6 +4311,7 @@ static std::vector<Polygons> draw_branches(
const SlicingParameters &slicing_params = print_object.slicing_parameters();
MeshSlicingParams mesh_slicing_params;
mesh_slicing_params.mode = MeshSlicingParams::SlicingMode::Positive;
tbb::parallel_for(tbb::blocked_range<size_t>(0, trees.size(), 1),
[&trees, &volumes, &config, &slicing_params, &move_bounds, &mesh_slicing_params, &throw_on_cancel](const tbb::blocked_range<size_t> &range) {
indexed_triangle_set partial_mesh;
@ -4343,6 +4345,7 @@ static std::vector<Polygons> draw_branches(
struct BottomExtraSlice {
Polygons polygons;
Polygons supported;
Polygons bottom_interfaces;
double area;
double supported_area;
};
@ -4371,12 +4374,17 @@ static std::vector<Polygons> draw_branches(
*/
Polygons supported;
double supported_area;
bottom_extra_slices.push_back({ rest_support, std::move(supported), rest_support_area, supported_area });
bottom_extra_slices.push_back({ rest_support, std::move(supported), {}, rest_support_area, supported_area });
}
// Now remove those bottom slices that are not supported at all.
while (! bottom_extra_slices.empty() &&
area(intersection_clipped(bottom_extra_slices.back().polygons, volumes.getPlaceableAreas(0, layer_begin - LayerIndex(bottom_extra_slices.size()), [] {}))) < support_area_min)
bottom_extra_slices.pop_back();
while (! bottom_extra_slices.empty()) {
Polygons bottom_interfaces = intersection_clipped(bottom_extra_slices.back().polygons, volumes.getPlaceableAreas(0, layer_begin - LayerIndex(bottom_extra_slices.size()), [] {}));
if (area(bottom_interfaces) < support_area_min)
bottom_extra_slices.pop_back();
else {
bottom_extra_slices.back().bottom_interfaces = std::move(bottom_interfaces);
}
}
layer_begin -= LayerIndex(bottom_extra_slices.size());
slices.insert(slices.begin(), bottom_extra_slices.size(), {});
size_t i = 0;