ENH: filamet shrinkage

Github: 2769

This feature ported from superslicer

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: Ic92d248aa90222e6f74530f01876cc14944f2444
This commit is contained in:
qing.zhang 2024-06-05 17:58:11 +08:00 committed by Lane.Wei
parent d5b14e5c09
commit 63be8a61fb
8 changed files with 36 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{
"name": "Bambulab",
"url": "http://www.bambulab.com/Parameters/vendor/BBL.json",
"version": "01.10.00.11",
"version": "01.10.00.12",
"force_update": "0",
"description": "the initial version of BBL configurations",
"machine_model_list": [

View File

@ -174,6 +174,9 @@
"filament_scarf_length":[
"10"
],
"filament_shrink": [
"100%"
],
"compatible_printers": [],
"filament_start_gcode": [
"; Filament gcode\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}"

View File

@ -879,7 +879,7 @@ static std::vector<std::string> s_Preset_filament_options {
"nozzle_temperature_range_low", "nozzle_temperature_range_high",
//OrcaSlicer
"enable_pressure_advance", "pressure_advance", "chamber_temperatures","filament_notes",
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut"
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut","filament_shrink"
};
static std::vector<std::string> s_Preset_machine_limits_options {

View File

@ -217,6 +217,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "nozzle_diameter"
|| opt_key == "resolution"
|| opt_key == "precise_z_height"
|| 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

@ -1548,6 +1548,19 @@ void PrintConfigDef::init_fff_params()
def->min = 0;
def->set_default_value(new ConfigOptionFloats { 1.75 });
def = this->add("filament_shrink", coPercents);
def->label = L("Shrinkage");
// xgettext:no-c-format, no-boost-format
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 compensate."
" Only the filament used for the perimeter is taken into account."
"\nBe sure to allow enough space between objects, as this compensation is done after the checks.");
def->sidetext = L("%");
def->ratio_over = "";
def->min = 10;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercents{ 100 });
def = this->add("filament_density", coFloats);
def->label = L("Density");
def->tooltip = L("Filament density. For statistics only");

View File

@ -1118,6 +1118,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
// BBS: move from PrintObjectConfig
((ConfigOptionBool, independent_support_layer_height))
((ConfigOptionBool, exclude_object))
((ConfigOptionPercents, filament_shrink))
)
// This object is mapped to Perl as Slic3r::Config::Full.

View File

@ -1016,6 +1016,21 @@ void PrintObject::slice_volumes()
PrintObject::clip_multipart_objects,
throw_on_cancel_callback);
// SuperSlicer: filament shrink
for (const std::unique_ptr<PrintRegion> &pr : m_shared_regions->all_regions) {
if (pr.get()) {
std::vector<ExPolygons> &region_polys = region_slices[pr->print_object_region_id()];
const size_t extruder_id = pr->extruder(FlowRole::frPerimeter) - 1;
double scale = print->config().filament_shrink.values[extruder_id] * 0.01;
if (scale != 1) {
scale = 1 / scale;
for (ExPolygons &polys : region_polys)
for (ExPolygon &poly : polys) poly.scale(scale);
}
}
}
for (size_t region_id = 0; region_id < region_slices.size(); ++ region_id) {
std::vector<ExPolygons> &by_layer = region_slices[region_id];
for (size_t layer_id = 0; layer_id < by_layer.size(); ++ layer_id)

View File

@ -3005,6 +3005,7 @@ void TabFilament::build()
optgroup->append_single_option_line("enable_pressure_advance");
optgroup->append_single_option_line("pressure_advance");
optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_shrink");
optgroup->append_single_option_line("filament_cost");
//BBS