Skip to content

Commit

Permalink
export to prusa: compute min & max layer height
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jun 28, 2024
1 parent 0b7ea21 commit c5ecd87
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8625,6 +8625,10 @@ std::map<std::string, std::string> PrintConfigDef::to_prusa(t_config_option_key&
} else if ("seam_position" == opt_key) {
if ("cost" == value) {
value = "nearest";
}else if ("allrandom" == value) {
value = "random";
}else if ("contiguous" == value) {
value = "aligned";
}
} else if ("first_layer_size_compensation" == opt_key) {
opt_key = "elefant_foot_compensation";
Expand All @@ -8637,13 +8641,14 @@ std::map<std::string, std::string> PrintConfigDef::to_prusa(t_config_option_key&
}
} else if ("elephant_foot_min_width" == opt_key) {
opt_key = "elefant_foot_min_width";
} else if("first_layer_acceleration" == opt_key) {
} else if("first_layer_acceleration" == opt_key || "first_layer_acceleration_over_raft" == opt_key) {
if (value.find("%") != std::string::npos) {
// can't support %, so we uese the default accel a baseline for half-assed conversion
value = std::to_string(all_conf.get_abs_value(opt_key, all_conf.get_computed_value("default_acceleration")));
}
} else if ("infill_acceleration" == opt_key || "bridge_acceleration" == opt_key || "default_acceleration" == opt_key || "perimeter_acceleration" == opt_key
|| "overhangs_speed" == opt_key || "ironing_speed" == opt_key || "perimeter_speed" == opt_key || "infill_speed" == opt_key || "bridge_speed" == opt_key || "support_material_speed" == opt_key
|| "overhangs_speed" == opt_key || "ironing_speed" == opt_key || "perimeter_speed" == opt_key
|| "infill_speed" == opt_key || "bridge_speed" == opt_key || "support_material_speed" == opt_key
|| "max_print_speed" == opt_key
) {
// remove '%'
Expand Down Expand Up @@ -8763,6 +8768,20 @@ std::map<std::string, std::string> PrintConfigDef::to_prusa(t_config_option_key&
new_entries["fan_always_on"] = "1";
}
}

// compute max & min height from % to flat value
if ("min_layer_height" == opt_key || "max_layer_height" == opt_key) {
ConfigOptionFloats computed_opt;
const ConfigOptionFloatsOrPercents *current_opt = all_conf.option<ConfigOptionFloatsOrPercents>(opt_key);
const ConfigOptionFloats *nozzle_diameters = all_conf.option<ConfigOptionFloats>("nozzle_diameter");
assert(current_opt && nozzle_diameters);
assert(current_opt->size() == nozzle_diameters->size());
for (int i = 0; i < current_opt->size(); i++) {
computed_opt.set_at(current_opt->get_abs_value(i, nozzle_diameters->get_at(i)), i);
}
assert(computed_opt.size() == nozzle_diameters->size());
value = computed_opt.serialize();
}

if ("thumbnails" == opt_key) {
// add format to thumbnails
Expand Down

0 comments on commit c5ecd87

Please sign in to comment.