mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-01 13:12:38 -06:00
Support filament shrinkage
Ported from SuperSlicer Signed-off-by: SoftFever <softfeverever@gmail.com> #360
This commit is contained in:
parent
23189c8726
commit
c58ed92da1
19 changed files with 843 additions and 354 deletions
|
|
@ -778,7 +778,7 @@ static std::vector<std::string> s_Preset_filament_options {
|
|||
"filament_wipe_distance", "additional_cooling_fan_speed",
|
||||
"bed_temperature_difference", "nozzle_temperature_range_low", "nozzle_temperature_range_high",
|
||||
//SoftFever
|
||||
"enable_pressure_advance", "pressure_advance","chamber_temperature" /*,"filament_seam_gap"*/
|
||||
"enable_pressure_advance", "pressure_advance","chamber_temperature", "filament_shrink"/*,"filament_seam_gap"*/
|
||||
};
|
||||
|
||||
static std::vector<std::string> s_Preset_machine_limits_options {
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
} else if (
|
||||
opt_key == "initial_layer_print_height"
|
||||
|| opt_key == "nozzle_diameter"
|
||||
|| 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.
|
||||
|
|
|
|||
|
|
@ -1290,6 +1290,18 @@ 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");
|
||||
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");
|
||||
|
|
|
|||
|
|
@ -981,6 +981,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
((ConfigOptionPoints, thumbnails))
|
||||
// BBS: move from PrintObjectConfig
|
||||
((ConfigOptionBool, independent_support_layer_height))
|
||||
// SoftFever
|
||||
((ConfigOptionPercents, filament_shrink))
|
||||
|
||||
)
|
||||
|
||||
// This object is mapped to Perl as Slic3r::Config::Full.
|
||||
|
|
|
|||
|
|
@ -236,6 +236,8 @@ static std::vector<PrintObjectRegions::LayerRangeRegions>::const_iterator layer_
|
|||
}
|
||||
|
||||
static std::vector<std::vector<ExPolygons>> slices_to_regions(
|
||||
const PrintConfig &print_config,
|
||||
const PrintObject &print_object,
|
||||
ModelVolumePtrs model_volumes,
|
||||
const PrintObjectRegions &print_object_regions,
|
||||
const std::vector<float> &zs,
|
||||
|
|
@ -437,6 +439,22 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
|
|||
});
|
||||
}
|
||||
|
||||
// SoftFever: ported from SuperSlicer
|
||||
// filament shrink
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -900,10 +918,9 @@ void PrintObject::slice_volumes()
|
|||
groupingVolumes(objSliceByVolumeParts, firstLayerObjSliceByGroups, scaled_resolution);
|
||||
applyNegtiveVolumes(this->model_object()->volumes, objSliceByVolume, firstLayerObjSliceByGroups, scaled_resolution);
|
||||
|
||||
std::vector<std::vector<ExPolygons>> region_slices = slices_to_regions(this->model_object()->volumes, *m_shared_regions, slice_zs,
|
||||
std::move(objSliceByVolume),
|
||||
PrintObject::clip_multipart_objects,
|
||||
throw_on_cancel_callback);
|
||||
std::vector<std::vector<ExPolygons>> region_slices =
|
||||
slices_to_regions(print->config(), *this, this->model_object()->volumes, *m_shared_regions, slice_zs,
|
||||
std::move(objSliceByVolume), PrintObject::clip_multipart_objects, throw_on_cancel_callback);
|
||||
|
||||
for (size_t region_id = 0; region_id < region_slices.size(); ++ region_id) {
|
||||
std::vector<ExPolygons> &by_layer = region_slices[region_id];
|
||||
|
|
|
|||
|
|
@ -2567,6 +2567,7 @@ void TabFilament::build()
|
|||
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
|
||||
optgroup->append_single_option_line("temperature_vitrification");
|
||||
|
|
@ -2657,7 +2658,7 @@ void TabFilament::build()
|
|||
//};
|
||||
//optgroup->append_line(line);
|
||||
optgroup = page->new_optgroup(L("Cooling for specific layer"), L"param_cooling");
|
||||
optgroup->append_single_option_line("close_fan_the_first_x_layers", "auto-cooling");
|
||||
optgroup->append_single_option_line("close_fan_the_first_x_layers", "auto-cooling");
|
||||
//optgroup->append_single_option_line("full_fan_speed_layer");
|
||||
|
||||
optgroup = page->new_optgroup(L("Part cooling fan"), L"param_cooling_fan");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue