fix Seam Travel Cost not saved/loaded

supermerill/SuperSlicer#1352
This commit is contained in:
remi durand 2021-06-23 18:40:11 +02:00
parent 48b8fc16e0
commit 2fae23a512
4 changed files with 12 additions and 8 deletions

View File

@ -394,6 +394,10 @@ Point SeamPlacer::get_seam(const Layer& layer, SeamPosition seam_position,
last_pos_weight = 5.f; last_pos_weight = 5.f;
travel_cost = 0; travel_cost = 0;
}else if (seam_position == spNearest) { }else if (seam_position == spNearest) {
last_pos_weight = 25.f;
travel_cost = 0;
angle_weight = 0;
}else if (seam_position == spCost) {
// last_pos already contains current nozzle position // last_pos already contains current nozzle position
// set base last_pos_weight to the same value as penaltyFlatSurface // set base last_pos_weight to the same value as penaltyFlatSurface
last_pos_weight = 5.f; last_pos_weight = 5.f;

View File

@ -3177,7 +3177,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Position of perimeters' starting points." def->tooltip = L("Position of perimeters' starting points."
"\n "); "\n ");
def->enum_keys_map = &ConfigOptionEnum<SeamPosition>::get_enum_values(); def->enum_keys_map = &ConfigOptionEnum<SeamPosition>::get_enum_values();
def->enum_values.push_back("near"); def->enum_values.push_back("cost");
def->enum_values.push_back("random"); def->enum_values.push_back("random");
def->enum_values.push_back("aligned"); def->enum_values.push_back("aligned");
def->enum_values.push_back("rear"); def->enum_values.push_back("rear");
@ -3186,7 +3186,7 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("Aligned")); def->enum_labels.push_back(L("Aligned"));
def->enum_labels.push_back(L("Rear")); def->enum_labels.push_back(L("Rear"));
def->mode = comSimple; def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<SeamPosition>(spNearest)); def->set_default_value(new ConfigOptionEnum<SeamPosition>(spCost));
def = this->add("seam_angle_cost", coPercent); def = this->add("seam_angle_cost", coPercent);
def->label = L("Angle cost"); def->label = L("Angle cost");
@ -5296,7 +5296,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
if (value == "hidden") { if (value == "hidden") {
opt_key = "seam_travel_cost"; opt_key = "seam_travel_cost";
value = "20%"; value = "20%";
} }else if ("near" == value || "nearest" == value )
value = "cost";
} else if (opt_key == "overhangs") { } else if (opt_key == "overhangs") {
opt_key = "overhangs_width_speed"; opt_key = "overhangs_width_speed";
if (value == "1") if (value == "1")
@ -5521,7 +5522,7 @@ void PrintConfigDef::to_prusa(t_config_option_key& opt_key, std::string& value,
value = "concentric"; value = "concentric";
} }
} else if ("seam_position" == opt_key) { } else if ("seam_position" == opt_key) {
if ("seam_travel_cost" == value || "near" == value || "hidden" == value) { if ("cost" == value) {
value = "nearest"; value = "nearest";
} }
} else if ("first_layer_size_compensation" == opt_key) { } else if ("first_layer_size_compensation" == opt_key) {

View File

@ -109,7 +109,7 @@ enum SupportMaterialPattern {
}; };
enum SeamPosition { enum SeamPosition {
spRandom, spNearest, spAligned, spRear, spCustom spRandom, spNearest, spAligned, spRear, spCustom, spCost
}; };
enum SLAMaterial { enum SLAMaterial {
@ -293,10 +293,9 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<SeamPosition>::ge
static t_config_enum_values keys_map{ static t_config_enum_values keys_map{
{"random", spRandom}, {"random", spRandom},
{"nearest", spNearest}, {"nearest", spNearest},
{"near", spNearest}, {"cost", spCost},
{"aligned", spAligned}, {"aligned", spAligned},
{"rear", spRear}, {"rear", spRear},
{"hidden", spNearest},
{"custom", spCustom}, {"custom", spCustom},
}; };
return keys_map; return keys_map;

View File

@ -373,7 +373,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
toggle_field(el, have_perimeters && config->opt_bool("thin_walls")); toggle_field(el, have_perimeters && config->opt_bool("thin_walls"));
for (auto el : { "seam_angle_cost", "seam_travel_cost" }) for (auto el : { "seam_angle_cost", "seam_travel_cost" })
toggle_field(el, have_perimeters && config->option<ConfigOptionEnum<SeamPosition>>("seam_position")->value == SeamPosition::spNearest); toggle_field(el, have_perimeters && config->option<ConfigOptionEnum<SeamPosition>>("seam_position")->value == SeamPosition::spCost);
toggle_field("perimeter_loop_seam", config->opt_bool("perimeter_loop")); toggle_field("perimeter_loop_seam", config->opt_bool("perimeter_loop"));