Squash merge of pull request Raft enhancements #6003

thanks @nemart69
This commit is contained in:
Vojtech Bubnik 2021-02-24 09:22:31 +01:00
parent 255b23f0fc
commit aee136cedd
14 changed files with 168 additions and 164 deletions

View File

@ -197,7 +197,7 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
fuzzified = loop.polygon;
fuzzy_polygon(fuzzified, scaled<float>(perimeter_generator.config->fuzzy_skin_thickness.value), scaled<float>(perimeter_generator.config->fuzzy_skin_point_dist.value));
}
if (perimeter_generator.config->overhangs && perimeter_generator.layer_id > 0
if (perimeter_generator.config->overhangs && perimeter_generator.layer_id > perimeter_generator.object_config->raft_layers
&& ! ((perimeter_generator.object_config->support_material || perimeter_generator.object_config->support_material_enforce_layers > 0) &&
perimeter_generator.object_config->support_material_contact_distance.value == 0)) {
// get non-overhang paths by intersecting this loop with the grown lower slices

View File

@ -426,7 +426,7 @@ const std::vector<std::string>& Preset::print_options()
"bridge_speed", "gap_fill_speed", "gap_fill_enabled", "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration",
"bridge_acceleration", "first_layer_acceleration", "default_acceleration", "skirts", "skirt_distance", "skirt_height", "draft_shield",
"min_skirt_length", "brim_width", "brim_offset", "brim_type", "support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers",
"raft_layers", "raft_first_layer_density", "raft_first_layer_expansion",
"raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion",
"support_material_pattern", "support_material_with_sheath", "support_material_spacing",
"support_material_synchronize_layers", "support_material_angle", "support_material_interface_layers",
"support_material_interface_spacing", "support_material_interface_contact_loops", "support_material_contact_distance",

View File

@ -1775,6 +1775,24 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionString(""));
def->cli = ConfigOptionDef::nocli;
def = this->add("raft_contact_distance", coFloat);
def->label = L("Raft contact Z distance");
def->category = L("Support material");
def->tooltip = L("The vertical distance between object and raft. Ignored for soluble interface.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.1));
def = this->add("raft_expansion", coFloat);
def->label = L("Raft expansion");
def->category = L("Support material");
def->tooltip = L("Expansion of the raft in XY plane for better stability.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(1.5));
def = this->add("raft_first_layer_density", coPercent);
def->label = L("First layer density");
def->category = L("Support material");

View File

@ -473,6 +473,8 @@ public:
// Force the generation of solid shells between adjacent materials/volumes.
ConfigOptionBool interface_shells;
ConfigOptionFloat layer_height;
ConfigOptionFloat raft_contact_distance;
ConfigOptionFloat raft_expansion;
ConfigOptionPercent raft_first_layer_density;
ConfigOptionFloat raft_first_layer_expansion;
ConfigOptionInt raft_layers;
@ -522,6 +524,8 @@ protected:
OPT_PTR(infill_only_where_needed);
OPT_PTR(interface_shells);
OPT_PTR(layer_height);
OPT_PTR(raft_contact_distance);
OPT_PTR(raft_expansion);
OPT_PTR(raft_first_layer_density);
OPT_PTR(raft_first_layer_expansion);
OPT_PTR(raft_layers);

View File

@ -542,6 +542,7 @@ bool PrintObject::invalidate_state_by_config_options(
opt_key == "layer_height"
|| opt_key == "first_layer_height"
|| opt_key == "raft_layers"
|| opt_key == "raft_contact_distance"
|| opt_key == "slice_closing_radius") {
steps.emplace_back(posSlice);
} else if (
@ -576,6 +577,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "support_material_synchronize_layers"
|| opt_key == "support_material_threshold"
|| opt_key == "support_material_with_sheath"
|| opt_key == "raft_expansion"
|| opt_key == "raft_first_layer_density"
|| opt_key == "raft_first_layer_expansion"
|| opt_key == "dont_support_bridges"
@ -766,10 +768,6 @@ void PrintObject::detect_surfaces_type()
// In non-spiral vase mode, go over all layers.
m_layers.size()),
[this, idx_region, interface_shells, &surfaces_new](const tbb::blocked_range<size_t>& range) {
// If we have raft layers, consider bottom layer as a bridge just like any other bottom surface lying on the void.
SurfaceType surface_type_bottom_1st =
(this->has_raft() && m_config.support_material_contact_distance.value > 0) ?
stBottomBridge : stBottom;
// If we have soluble support material, don't bridge. The overhang will be squished against a soluble layer separating
// the support from the print.
SurfaceType surface_type_bottom_other =
@ -848,7 +846,7 @@ void PrintObject::detect_surfaces_type()
// we clone surfaces because we're going to clear the slices collection
bottom = layerm->slices.surfaces;
for (Surface &surface : bottom)
surface.surface_type = surface_type_bottom_1st;
surface.surface_type = stBottom;
}
// now, if the object contained a thin membrane, we could have overlapping bottom

View File

@ -111,7 +111,7 @@ SlicingParameters SlicingParameters::create_from_config(
params.max_layer_height = std::max(params.max_layer_height, params.layer_height);
if (! soluble_interface) {
params.gap_raft_object = object_config.support_material_contact_distance.value;
params.gap_raft_object = object_config.raft_contact_distance.value;
params.gap_object_support = object_config.support_material_contact_distance.value;
params.gap_support_object = object_config.support_material_contact_distance.value;
}
@ -122,27 +122,9 @@ SlicingParameters SlicingParameters::create_from_config(
// Use as large as possible layer height for the intermediate raft layers.
params.base_raft_layer_height = std::max(params.layer_height, 0.75 * support_material_extruder_dmr);
params.interface_raft_layer_height = std::max(params.layer_height, 0.75 * support_material_interface_extruder_dmr);
params.contact_raft_layer_height_bridging = false;
params.first_object_layer_bridging = false;
#if 1
params.contact_raft_layer_height = std::max(params.layer_height, 0.75 * support_material_interface_extruder_dmr);
if (! soluble_interface) {
// Compute the average of all nozzles used for printing the object over a raft.
//FIXME It is expected, that the 1st layer of the object is printed with a bridging flow over a full raft. Shall it not be vice versa?
coordf_t average_object_extruder_dmr = 0.;
if (! object_extruders.empty()) {
for (unsigned int extruder_id : object_extruders)
average_object_extruder_dmr += print_config.nozzle_diameter.get_at(extruder_id);
average_object_extruder_dmr /= coordf_t(object_extruders.size());
}
params.first_object_layer_height = average_object_extruder_dmr;
params.first_object_layer_bridging = true;
}
#else
params.contact_raft_layer_height = soluble_interface ? support_material_interface_extruder_dmr : 0.75 * support_material_interface_extruder_dmr;
params.contact_raft_layer_height_bridging = ! soluble_interface;
...
#endif
params.first_object_layer_height = params.layer_height;
}
if (params.has_raft()) {

View File

@ -55,7 +55,6 @@ struct SlicingParameters
coordf_t base_raft_layer_height;
coordf_t interface_raft_layer_height;
coordf_t contact_raft_layer_height;
bool contact_raft_layer_height_bridging;
// The regular layer height, applied for all but the first layer, if not overridden by layer ranges
// or by the variable layer thickness table.
@ -110,7 +109,6 @@ inline bool equal_layering(const SlicingParameters &sp1, const SlicingParameters
sp1.base_raft_layer_height == sp2.base_raft_layer_height &&
sp1.interface_raft_layer_height == sp2.interface_raft_layer_height &&
sp1.contact_raft_layer_height == sp2.contact_raft_layer_height &&
sp1.contact_raft_layer_height_bridging == sp2.contact_raft_layer_height_bridging &&
sp1.layer_height == sp2.layer_height &&
sp1.min_layer_height == sp2.min_layer_height &&
sp1.max_layer_height == sp2.max_layer_height &&

View File

@ -44,6 +44,10 @@
namespace Slic3r {
// how much we extend support around the actual contact area
//FIXME this should be dependent on the nozzle diameter!
#define SUPPORT_MATERIAL_MARGIN 1.5
// Increment used to reach MARGIN in steps to avoid trespassing thin objects
#define NUM_MARGIN_STEPS 3
@ -1342,8 +1346,8 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
// we're here just to get the object footprint for the raft.
// We only consider contours and discard holes to get a more continuous raft.
overhang_polygons = collect_slices_outer(layer);
// Extend by SUPPORT_MATERIAL_MARGIN, which is 1.5mm
contact_polygons = offset(overhang_polygons, scale_(SUPPORT_MATERIAL_MARGIN));
// Expand for better stability.
contact_polygons = offset(overhang_polygons, scaled<float>(m_object_config->raft_expansion.value));
} else {
// Generate overhang / contact_polygons for non-raft layers.
const Layer &lower_layer = *object.layers()[layer_id-1];
@ -2178,7 +2182,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::raft_and_int
assert(extr2z > extr1z || (extr1 != nullptr && extr2->layer_type == sltBottomContact));
if (std::abs(extr1z) < EPSILON) {
// This layer interval starts with the 1st layer. Print the 1st layer using the prescribed 1st layer thickness.
assert(! m_slicing_params.has_raft());
// assert(! m_slicing_params.has_raft()); RaftingEdition: unclear where the issue is: assert fails with 1-layer raft & base supports
assert(intermediate_layers.empty() || intermediate_layers.back()->print_z <= m_slicing_params.first_print_layer_height);
// At this point only layers above first_print_layer_heigth + EPSILON are expected as the other cases were captured earlier.
assert(extr2z >= m_slicing_params.first_print_layer_height + EPSILON);
@ -3540,15 +3544,17 @@ void PrintObjectSupportMaterial::generate_toolpaths(
} else
continue;
filler->link_max_length = coord_t(scale_(filler->spacing * link_max_length_factor / density));
fill_expolygons_generate_paths(
fill_expolygons_with_sheath_generate_paths(
// Destination
support_layer.support_fills.entities,
// Regions to fill
offset2_ex(raft_layer.polygons, float(SCALED_EPSILON), float(- SCALED_EPSILON)),
raft_layer.polygons,
// Filler and its parameters
filler, density,
// Extrusion parameters
(support_layer_id < m_slicing_params.base_raft_layers) ? erSupportMaterial : erSupportMaterialInterface, flow);
(support_layer_id < m_slicing_params.base_raft_layers) ? erSupportMaterial : erSupportMaterialInterface, flow,
// sheath at first layer
support_layer_id == 0);
}
});

View File

@ -11,10 +11,6 @@ class PrintObject;
class PrintConfig;
class PrintObjectConfig;
// how much we extend support around the actual contact area
//FIXME this should be dependent on the nozzle diameter!
#define SUPPORT_MATERIAL_MARGIN 1.5
// This class manages raft and supports for a single PrintObject.
// Instantiated by Slic3r::Print::Object->_support_material()
// This class is instantiated before the slicing starts as Object.pm will query

View File

@ -294,6 +294,9 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
toggle_field("support_material_extruder", have_support_material || have_skirt);
toggle_field("support_material_speed", have_support_material || have_brim || have_skirt);
toggle_field("raft_contact_distance", have_raft && !have_support_soluble);
toggle_field("raft_expansion", have_raft);
bool has_ironing = config->opt_bool("ironing");
for (auto el : { "ironing_type", "ironing_flowrate", "ironing_spacing", "ironing_speed" })
toggle_field(el, has_ironing);

View File

@ -1625,5 +1625,3 @@ boost::any& SliderCtrl::get_value()
} // GUI
} // Slic3r

View File

@ -1501,7 +1501,8 @@ void TabPrint::build()
optgroup->append_single_option_line("raft_layers", category_path + "raft-layers");
optgroup->append_single_option_line("raft_first_layer_density", category_path + "raft-first-layer-density");
optgroup->append_single_option_line("raft_first_layer_expansion", category_path + "raft-first-layer-expansion");
// # optgroup->append_single_option_line(get_option_("raft_contact_distance");
optgroup->append_single_option_line("raft_contact_distance");
optgroup->append_single_option_line("raft_expansion");
optgroup = page->new_optgroup(L("Options for support material and raft"));
optgroup->append_single_option_line("support_material_contact_distance", category_path + "contact-z-distance");