Add filament shrink

This commit is contained in:
QIDI TECH
2024-02-22 16:53:56 +08:00
parent 9856ad7031
commit ca4f336d62
6 changed files with 60 additions and 7 deletions

View File

@@ -190,6 +190,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
} else if (
opt_key == "first_layer_height"
|| opt_key == "nozzle_diameter"
//Y23
|| opt_key == "filament_shrink"
|| opt_key == "resolution"
// 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.

View File

@@ -1205,6 +1205,19 @@ void PrintConfigDef::init_fff_params()
def->min = 0;
def->set_default_value(new ConfigOptionFloats { 1.75 });
//Y23
def = this->add("filament_shrink", coPercents);
def->label = L("Shrinkage");
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 = 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

@@ -839,6 +839,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionInts, fan_below_layer_time))
((ConfigOptionStrings, filament_colour))
((ConfigOptionStrings, filament_notes))
//Y23
((ConfigOptionPercents, filament_shrink))
((ConfigOptionFloat, first_layer_acceleration))
((ConfigOptionInts, first_layer_bed_temperature))
((ConfigOptionFloatOrPercent, first_layer_extrusion_width))

View File

@@ -234,6 +234,7 @@ static std::vector<PrintObjectRegions::LayerRangeRegions>::const_iterator layer_
}
static std::vector<std::vector<ExPolygons>> slices_to_regions(
const PrintConfig &print_config,
ModelVolumePtrs model_volumes,
const PrintObjectRegions &print_object_regions,
const std::vector<float> &zs,
@@ -396,6 +397,21 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
});
}
//Y23
for (const std::unique_ptr<PrintRegion>& pr : print_object_regions.all_regions) {
if (pr.get()) {
std::vector<ExPolygons>& region_polys = slices_by_region[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);
}
}
}
return slices_by_region;
}
@@ -698,7 +714,7 @@ void PrintObject::slice_volumes()
}
std::vector<float> slice_zs = zs_from_layers(m_layers);
std::vector<std::vector<ExPolygons>> region_slices = slices_to_regions(this->model_object()->volumes, *m_shared_regions, slice_zs,
std::vector<std::vector<ExPolygons>> region_slices = slices_to_regions(print->config(), this->model_object()->volumes, *m_shared_regions, slice_zs,
slice_volumes_inner(
print->config(), this->config(), this->trafo_centered(),
this->model_object()->volumes, m_shared_regions->layer_ranges, slice_zs, throw_on_cancel_callback),

View File

@@ -2165,6 +2165,8 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_diameter");
optgroup->append_single_option_line("extrusion_multiplier");
optgroup->append_single_option_line("filament_density");
//Y23
optgroup->append_single_option_line("filament_shrink");
optgroup->append_single_option_line("filament_cost");
optgroup->append_single_option_line("filament_spool_weight");
//B