#287 filament shrinkage compensation

This commit is contained in:
supermerill 2020-08-19 15:22:02 +02:00
parent a1acd5b167
commit f5dd32d969
6 changed files with 43 additions and 9 deletions

View File

@ -16,6 +16,14 @@ group:Temperature °C
setting:label:Other layers:bed_temperature
end_line
setting:chamber_temperature
group:Filament properties
setting:width$7:filament_type
setting:filament_soluble
setting:filament_shrink
group:Print speed override
setting:filament_max_wipe_tower_speed
setting:filament_max_volumetric_speed
volumetric_speed_description
page:Cooling:time
group:Fan speed - default
@ -35,10 +43,7 @@ group:Very short layer time - began to decrease extrusion rate
group:Behavior
cooling_description
page:Advanced:wrench
group:Filament properties
setting:width$7:filament_type
setting:filament_soluble
page:Multimaterial:funnel
group:Multimaterial toolchange temperature
setting:filament_enable_toolchange_temp
setting:filament_toolchange_temp
@ -52,10 +57,6 @@ group:Multimaterial toolchange string reduction
setting:filament_cooling_zone_pause
setting:filament_dip_insertion_speed
setting:filament_dip_extraction_speed
group:Print speed override
setting:filament_max_wipe_tower_speed
setting:filament_max_volumetric_speed
volumetric_speed_description
group:Wipe tower parameters
setting:filament_minimal_purge_on_wipe_tower
group:Toolchange parameters with single extruder MM printers

View File

@ -203,6 +203,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
} else if (
opt_key == "nozzle_diameter"
|| opt_key == "resolution"
|| opt_key == "filament_shrink"
// Spiral Vase forces different kind of slicing than the normal model:
// In Spiral Vase mode, holes are closed and only the largest area contour is kept at each layer.
// Therefore toggling the Spiral Vase on / off requires complete reslicing.

View File

@ -1240,10 +1240,21 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Enter your filament diameter here. Good precision is required, so use a caliper "
"and do multiple measurements along the filament, then compute the average.");
def->sidetext = L("mm");
def->min = 0;
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 1.75 });
def = this->add("filament_shrink", coPercents);
def->label = L("Shrikage");
def->tooltip = L("Enter the shrinkage percentage that the filament will get after cooling (94% if you measure 94mm instead of 100mm)."
" The part will be scaled in xy to conpensate."
" Only the filament used for the perimeter is taken into account."
"\nBe sure to let enough space between objects, as this compensation is done after the checks.");
def->sidetext = L("%");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionPercents{ 100 });
def = this->add("filament_density", coFloats);
def->label = L("Density");
def->tooltip = L("Enter your filament density here. This is only for statistical information. "

View File

@ -1065,6 +1065,7 @@ public:
ConfigOptionInts fan_below_layer_time;
ConfigOptionStrings filament_colour;
ConfigOptionStrings filament_notes;
ConfigOptionPercents filament_shrink;
ConfigOptionFloat first_layer_acceleration;
ConfigOptionInts first_layer_bed_temperature;
ConfigOptionFloatOrPercent first_layer_extrusion_width;
@ -1156,6 +1157,7 @@ protected:
OPT_PTR(fan_below_layer_time);
OPT_PTR(filament_colour);
OPT_PTR(filament_notes);
OPT_PTR(filament_shrink);
OPT_PTR(first_layer_acceleration);
OPT_PTR(first_layer_bed_temperature);
OPT_PTR(first_layer_extrusion_width);

View File

@ -2161,6 +2161,14 @@ void PrintObject::_slice(const std::vector<coordf_t> &layer_height_profile)
BOOST_LOG_TRIVIAL(debug) << "Slicing objects - region " << region_id;
// slicing in parallel
std::vector<ExPolygons> expolygons_by_layer = this->slice_region(region_id, slice_zs, slicing_mode);
//scale for shrinkage
double scale = print()->config().filament_shrink.get_abs_value(this->print()->regions()[region_id]->extruder(FlowRole::frPerimeter) - 1, 1);
if (scale != 1) {
scale = 1 / scale;
for (ExPolygons &polys : expolygons_by_layer)
for (ExPolygon &poly : polys)
poly.scale(scale);
}
m_print->throw_if_canceled();
BOOST_LOG_TRIVIAL(debug) << "Slicing objects - append slices " << region_id << " start";
for (size_t layer_id = 0; layer_id < expolygons_by_layer.size(); ++ layer_id)
@ -2204,6 +2212,16 @@ void PrintObject::_slice(const std::vector<coordf_t> &layer_height_profile)
++ i;
}
}
//scale for shrinkage
for (SlicedVolume &sv : sliced_volumes) {
double scale = print()->config().filament_shrink.get_abs_value(this->print()->regions()[sv.region_id]->extruder(FlowRole::frPerimeter) - 1, 1);
if (scale != 1) {
scale = 1 / scale;
for (ExPolygons &polys : sv.expolygons_by_layer)
for (ExPolygon &poly : polys)
poly.scale(scale);
}
}
// Second clip the volumes in the order they are presented at the user interface.
BOOST_LOG_TRIVIAL(debug) << "Slicing objects - parallel clipping - start";
tbb::parallel_for(

View File

@ -559,6 +559,7 @@ const std::vector<std::string>& Preset::filament_options()
"extrusion_multiplier", "filament_density", "filament_cost", "filament_loading_speed", "filament_loading_speed_start", "filament_load_time",
"filament_unloading_speed", "filament_toolchange_delay", "filament_unloading_speed_start", "filament_unload_time", "filament_cooling_moves",
"filament_cooling_initial_speed", "filament_cooling_final_speed", "filament_ramming_parameters", "filament_minimal_purge_on_wipe_tower",
"filament_shrink",
"filament_use_skinnydip", // skinnydip params start
"filament_use_fast_skinnydip",
"filament_skinnydip_distance",