mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 06:15:57 +08:00
add first_layer_size_compensation_layers rewrote from bitblaster (Roberto Mozzicato) pr
see prusa3d/PrusaSlicer#6569
This commit is contained in:
parent
610d35fcab
commit
4028cd2a1b
@ -92,7 +92,10 @@ group:Modifying slices
|
||||
line:XY compensation
|
||||
setting:width$6:xy_size_compensation
|
||||
setting:width$6:xy_inner_size_compensation
|
||||
end_line
|
||||
line:XY First layer compensation
|
||||
setting:width$6:first_layer_size_compensation
|
||||
setting:width$6:first_layer_size_compensation_layers
|
||||
end_line
|
||||
line:Vertical Hole shrinking compensation
|
||||
setting:width$6:hole_size_compensation
|
||||
|
@ -562,6 +562,7 @@ const std::vector<std::string>& Preset::print_options()
|
||||
"first_layer_flow_ratio",
|
||||
"clip_multipart_objects", "enforce_full_fill_volume", "external_infill_margin", "bridged_infill_margin",
|
||||
"first_layer_size_compensation",
|
||||
"first_layer_size_compensation_layers",
|
||||
"xy_size_compensation",
|
||||
"xy_inner_size_compensation",
|
||||
"hole_size_compensation",
|
||||
|
@ -1704,6 +1704,19 @@ void PrintConfigDef::init_fff_params()
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloat(0));
|
||||
|
||||
def = this->add("first_layer_size_compensation_layers", coInt);
|
||||
def->label = L("height in layers");
|
||||
def->full_label = L("XY First layer compensation height in layers");
|
||||
def->category = OptionCategory::slicing;
|
||||
def->tooltip = L("The number of layers on which the elephant foot compensation will be active. "
|
||||
"The first layer will be shrunk by the elephant foot compensation value, then "
|
||||
"the next layers will be gradually shrunk less, up to the layer indicated by this value.");
|
||||
def->sidetext = L("layers");
|
||||
def->min = 1;
|
||||
def->max = 30;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInt(1));
|
||||
|
||||
def = this->add("fill_smooth_width", coFloatOrPercent);
|
||||
def->label = L("Width");
|
||||
def->full_label = L("Ironing width");
|
||||
@ -5517,6 +5530,7 @@ void PrintConfigDef::to_prusa(t_config_option_key& opt_key, std::string& value,
|
||||
"start_gcode_manual",
|
||||
"perimeter_round_corners",
|
||||
"travel_speed_z",
|
||||
"first_layer_size_compensation_layers",
|
||||
};
|
||||
//looks if it's to be removed, or have to be transformed
|
||||
if (to_remove_keys.find(opt_key) != to_remove_keys.end()) {
|
||||
|
@ -623,6 +623,7 @@ public:
|
||||
ConfigOptionFloatOrPercent first_layer_height;
|
||||
ConfigOptionFloatOrPercent first_layer_extrusion_width;
|
||||
ConfigOptionFloat first_layer_size_compensation;
|
||||
ConfigOptionInt first_layer_size_compensation_layers;
|
||||
ConfigOptionFloat hole_size_compensation;
|
||||
ConfigOptionFloat hole_size_threshold;
|
||||
ConfigOptionBool infill_only_where_needed;
|
||||
@ -693,6 +694,7 @@ protected:
|
||||
OPT_PTR(first_layer_height);
|
||||
OPT_PTR(first_layer_extrusion_width);
|
||||
OPT_PTR(first_layer_size_compensation);
|
||||
OPT_PTR(first_layer_size_compensation_layers);
|
||||
OPT_PTR(infill_only_where_needed);
|
||||
OPT_PTR(interface_shells);
|
||||
OPT_PTR(layer_height);
|
||||
|
@ -707,6 +707,7 @@ namespace Slic3r {
|
||||
|| opt_key == "slice_closing_radius"
|
||||
|| opt_key == "clip_multipart_objects"
|
||||
|| opt_key == "first_layer_size_compensation"
|
||||
|| opt_key == "first_layer_size_compensation_layers"
|
||||
|| opt_key == "elephant_foot_min_width"
|
||||
|| opt_key == "support_material_contact_distance_type"
|
||||
|| opt_key == "support_material_contact_distance_top"
|
||||
@ -2491,9 +2492,13 @@ namespace Slic3r {
|
||||
float hole_delta = inner_delta + float(scale_(m_config.hole_size_compensation.value));
|
||||
//FIXME only apply the compensation if no raft is enabled.
|
||||
float first_layer_compensation = 0.f;
|
||||
if (layer_id == 0 && m_config.raft_layers == 0 && m_config.first_layer_size_compensation.value != 0) {
|
||||
int first_layers = m_config.first_layer_size_compensation_layers.value;
|
||||
if (layer_id < first_layers && m_config.raft_layers == 0 && m_config.first_layer_size_compensation.value != 0) {
|
||||
// Only enable Elephant foot compensation if printing directly on the print bed.
|
||||
first_layer_compensation = float(scale_(m_config.first_layer_size_compensation.value));
|
||||
// reduce first_layer_compensation for every layer over the first one.
|
||||
first_layer_compensation = (first_layers - layer_id + 1) * first_layer_compensation / float(first_layers);
|
||||
// simplify compensations if possible
|
||||
if (first_layer_compensation > 0) {
|
||||
outter_delta += first_layer_compensation;
|
||||
inner_delta += first_layer_compensation;
|
||||
@ -2528,7 +2533,7 @@ namespace Slic3r {
|
||||
expolygons = _shrink_contour_holes(std::max(0.f, outter_delta), std::max(0.f, inner_delta), std::max(0.f, hole_delta), expolygons);
|
||||
}
|
||||
// Apply the elephant foot compensation.
|
||||
if (layer_id == 0 && first_layer_compensation != 0.f) {
|
||||
if (layer_id < first_layers && first_layer_compensation != 0.f) {
|
||||
expolygons = union_ex(Slic3r::elephant_foot_compensation(expolygons, layerm->flow(frExternalPerimeter),
|
||||
unscale<double>(-first_layer_compensation)));
|
||||
}
|
||||
@ -2582,7 +2587,7 @@ namespace Slic3r {
|
||||
// Apply the negative XY compensation. (the ones that is <0)
|
||||
ExPolygons trimming;
|
||||
static const float eps = float(scale_(m_config.slice_closing_radius.value) * 1.5);
|
||||
if (layer_id == 0 && first_layer_compensation < 0.f) {
|
||||
if (layer_id < first_layers && first_layer_compensation < 0.f) {
|
||||
ExPolygons expolygons_first_layer = offset_ex(layer->merged(eps), -eps);
|
||||
trimming = Slic3r::elephant_foot_compensation(expolygons_first_layer,
|
||||
layer->regions().front()->flow(frExternalPerimeter), unscale<double>(-first_layer_compensation));
|
||||
|
Loading…
x
Reference in New Issue
Block a user