#680 fix prusa ironing "Topmost surface only"

and some cleaning on enum settings conversions
This commit is contained in:
supermerill 2020-11-22 14:22:35 +01:00
parent 6ca46edae3
commit 0fe20a6dc4
5 changed files with 133 additions and 121 deletions

View File

@ -763,6 +763,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "infill_dense_algo"
|| opt_key == "infill_not_connected"
|| opt_key == "infill_only_where_needed"
|| opt_key == "ironing_type"
|| opt_key == "solid_infill_below_area"
|| opt_key == "solid_infill_extruder"
|| opt_key == "solid_infill_every_layers"
@ -780,8 +781,8 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "fill_top_flow_ratio"
|| opt_key == "fill_smooth_width"
|| opt_key == "fill_smooth_distribution"
|| opt_key == "top_infill_extrusion_width"
|| opt_key == "first_layer_extrusion_width") {
|| opt_key == "first_layer_extrusion_width"
|| opt_key == "top_infill_extrusion_width") {
steps.emplace_back(posInfill);
} else if (
opt_key == "extra_perimeters"

View File

@ -1053,32 +1053,38 @@ void Choice::set_value(const boost::any& value, bool change_event)
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "solid_fill_pattern"
|| m_opt_id == "fill_pattern" || m_opt_id == "support_material_interface_pattern" || m_opt_id == "brim_ears_pattern")
val = idx_from_enum_value<InfillPattern>(val);
else if (m_opt_id.compare("perimeter_loop_seam") == 0)
val = idx_from_enum_value<SeamPosition>(val);
else if (m_opt_id.compare("complete_objects_sort") == 0)
val = idx_from_enum_value<CompleteObjectSort>(val);
else if (m_opt_id.compare("gcode_flavor") == 0)
val = idx_from_enum_value<GCodeFlavor>(val);
else if (m_opt_id.compare("support_material_pattern") == 0)
val = idx_from_enum_value<SupportMaterialPattern>(val);
else if (m_opt_id.compare("seam_position") == 0)
val = idx_from_enum_value<SeamPosition>(val);
else if (m_opt_id.compare("host_type") == 0)
val = idx_from_enum_value<PrintHostType>(val);
else if (m_opt_id.compare("infill_dense_algo") == 0)
val = idx_from_enum_value<DenseInfillAlgo>(val);
else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0)
val = idx_from_enum_value<NoPerimeterUnsupportedAlgo>(val);
else if (m_opt_id.compare("infill_connection") == 0)
val = idx_from_enum_value<InfillConnection>(val);
else if (m_opt_id.compare("wipe_advanced_algo") == 0)
val = idx_from_enum_value<WipeAlgo>(val);
else if (m_opt_id.compare("support_material_contact_distance_type") == 0)
val = idx_from_enum_value<SupportZDistanceType>(val);
else if (m_opt_id.compare("display_orientation") == 0)
val = idx_from_enum_value<SLADisplayOrientation>(val);
else if (m_opt_id.compare("gcode_flavor") == 0)
val = idx_from_enum_value<GCodeFlavor>(val);
else if (m_opt_id.compare("host_type") == 0)
val = idx_from_enum_value<PrintHostType>(val);
else if (m_opt_id.compare("infill_connection") == 0)
val = idx_from_enum_value<InfillConnection>(val);
else if (m_opt_id.compare("infill_dense_algo") == 0)
val = idx_from_enum_value<DenseInfillAlgo>(val);
else if (m_opt_id == "ironing_type")
val = idx_from_enum_value<IroningType>(val);
else if (m_opt_id.compare("machine_limits_usage") == 0)
val = idx_from_enum_value<MachineLimitsUsage>(val);
else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0)
val = idx_from_enum_value<NoPerimeterUnsupportedAlgo>(val);
else if (m_opt_id.compare("perimeter_loop_seam") == 0)
val = idx_from_enum_value<SeamPosition>(val);
else if (m_opt_id == "printhost_authorization_type")
val = idx_from_enum_value<AuthorizationType>(val);
else if (m_opt_id.compare("seam_position") == 0)
val = idx_from_enum_value<SeamPosition>(val);
else if (m_opt_id.compare("support_material_contact_distance_type") == 0)
val = idx_from_enum_value<SupportZDistanceType>(val);
else if (m_opt_id.compare("support_material_pattern") == 0)
val = idx_from_enum_value<SupportMaterialPattern>(val);
else if (m_opt_id.compare("support_pillar_connection_mode") == 0)
val = idx_from_enum_value<SLAPillarConnectionMode>(val);
else if (m_opt_id.compare("wipe_advanced_algo") == 0)
val = idx_from_enum_value<WipeAlgo>(val);
field->SetSelection(val);
break;
}
@ -1161,37 +1167,39 @@ boost::any& Choice::get_value()
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "solid_fill_pattern"
|| m_opt_id == "support_material_interface_pattern" || m_opt_id == "fill_pattern" || m_opt_id == "brim_ears_pattern")
convert_to_enum_value<InfillPattern>(ret_enum);
else if (m_opt_id.compare("gcode_flavor") == 0)
convert_to_enum_value<GCodeFlavor>(ret_enum);
else if (m_opt_id.compare("complete_objects_sort") == 0)
convert_to_enum_value<CompleteObjectSort>(ret_enum);
else if (m_opt_id.compare("machine_limits_usage") == 0)
m_value = static_cast<MachineLimitsUsage>(ret_enum);
else if (m_opt_id.compare("support_material_pattern") == 0)
convert_to_enum_value<SupportMaterialPattern>(ret_enum);
else if (m_opt_id.compare("seam_position") == 0)
convert_to_enum_value<SeamPosition>(ret_enum);
else if (m_opt_id.compare("perimeter_loop_seam") == 0)
convert_to_enum_value<SeamPosition>(ret_enum);
else if (m_opt_id.compare("display_orientation") == 0)
convert_to_enum_value<SLADisplayOrientation>(ret_enum);
else if (m_opt_id.compare("gcode_flavor") == 0)
convert_to_enum_value<GCodeFlavor>(ret_enum);
else if (m_opt_id.compare("host_type") == 0)
convert_to_enum_value<PrintHostType>(ret_enum);
else if (m_opt_id.compare("infill_dense_algo") == 0)
convert_to_enum_value<DenseInfillAlgo>(ret_enum);
else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0)
convert_to_enum_value<NoPerimeterUnsupportedAlgo>(ret_enum);
else if (m_opt_id.compare("infill_connection") == 0)
convert_to_enum_value<InfillConnection>(ret_enum);
else if (m_opt_id.compare("wipe_advanced_algo") == 0)
convert_to_enum_value<WipeAlgo>(ret_enum);
else if (m_opt_id.compare("infill_dense_algo") == 0)
convert_to_enum_value<DenseInfillAlgo>(ret_enum);
else if (m_opt_id == "ironing_type")
convert_to_enum_value<IroningType>(ret_enum);
else if (m_opt_id.compare("machine_limits_usage") == 0)
convert_to_enum_value<MachineLimitsUsage>(ret_enum);
else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0)
convert_to_enum_value<NoPerimeterUnsupportedAlgo>(ret_enum);
else if (m_opt_id.compare("perimeter_loop_seam") == 0)
convert_to_enum_value<SeamPosition>(ret_enum);
else if (m_opt_id == "printhost_authorization_type")
convert_to_enum_value<AuthorizationType>(ret_enum);
else if (m_opt_id.compare("seam_position") == 0)
convert_to_enum_value<SeamPosition>(ret_enum);
else if (m_opt_id.compare("support_material_contact_distance_type") == 0)
convert_to_enum_value<SupportZDistanceType>(ret_enum);
else if (m_opt_id.compare("display_orientation") == 0)
convert_to_enum_value<SLADisplayOrientation>(ret_enum);
else if (m_opt_id.compare("support_material_pattern") == 0)
convert_to_enum_value<SupportMaterialPattern>(ret_enum);
else if (m_opt_id.compare("support_pillar_connection_mode") == 0)
convert_to_enum_value<SLAPillarConnectionMode>(ret_enum);
else if (m_opt_id == "printhost_authorization_type")
m_value = static_cast<AuthorizationType>(ret_enum);
}
else if (m_opt_id.compare("wipe_advanced_algo") == 0)
convert_to_enum_value<WipeAlgo>(ret_enum);
}
else if (m_opt.gui_type == "f_enum_open") {
const int ret_enum = field->GetSelection();
if (ret_enum < 0 || m_opt.enum_values.empty() || m_opt.type == coStrings ||

View File

@ -180,40 +180,39 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
opt_key == "bottom_fill_pattern" ||
opt_key == "solid_fill_pattern" ||
opt_key == "fill_pattern" ||
opt_key == "brim_ears_pattern")
opt_key == "brim_ears_pattern" ||
opt_key == "support_material_interface_pattern")
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
else if (opt_key.compare("complete_objects_sort") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<CompleteObjectSort>(boost::any_cast<CompleteObjectSort>(value)));
else if (opt_key.compare("ironing_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<IroningType>(boost::any_cast<IroningType>(value)));
config.set_key_value(opt_key, new ConfigOptionEnum<CompleteObjectSort>(boost::any_cast<CompleteObjectSort>(value)));
else if (opt_key.compare("display_orientation") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value)));
else if (opt_key.compare("gcode_flavor") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value)));
config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value)));
else if (opt_key.compare("host_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
else if (opt_key.compare("infill_connection") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<InfillConnection>(boost::any_cast<InfillConnection>(value)));
else if (opt_key.compare("infill_dense_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<DenseInfillAlgo>(boost::any_cast<DenseInfillAlgo>(value)));
else if (opt_key.compare("ironing_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<IroningType>(boost::any_cast<IroningType>(value)));
else if (opt_key.compare("machine_limits_usage") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<MachineLimitsUsage>(boost::any_cast<MachineLimitsUsage>(value)));
else if (opt_key.compare("support_material_interface_pattern") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
else if (opt_key.compare("support_material_pattern") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SupportMaterialPattern>(boost::any_cast<SupportMaterialPattern>(value)));
config.set_key_value(opt_key, new ConfigOptionEnum<MachineLimitsUsage>(boost::any_cast<MachineLimitsUsage>(value)));
else if (opt_key.compare("no_perimeter_unsupported_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<NoPerimeterUnsupportedAlgo>(boost::any_cast<NoPerimeterUnsupportedAlgo>(value)));
else if (opt_key == "printhost_authorization_type")
config.set_key_value(opt_key, new ConfigOptionEnum<AuthorizationType>(boost::any_cast<AuthorizationType>(value)));
else if (opt_key.compare("seam_position") == 0 || opt_key.compare("perimeter_loop_seam") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SeamPosition>(boost::any_cast<SeamPosition>(value)));
else if (opt_key.compare("host_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<PrintHostType>(boost::any_cast<PrintHostType>(value)));
else if (opt_key.compare("infill_dense_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<DenseInfillAlgo>(boost::any_cast<DenseInfillAlgo>(value)));
else if (opt_key.compare("no_perimeter_unsupported_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<NoPerimeterUnsupportedAlgo>(boost::any_cast<NoPerimeterUnsupportedAlgo>(value)));
else if (opt_key.compare("infill_connection") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<InfillConnection>(boost::any_cast<InfillConnection>(value)));
else if (opt_key.compare("wipe_advanced_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<WipeAlgo>(boost::any_cast<WipeAlgo>(value)));
else if (opt_key.compare("support_material_contact_distance_type") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SupportZDistanceType>(boost::any_cast<SupportZDistanceType>(value)));
else if (opt_key.compare("display_orientation") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLADisplayOrientation>(boost::any_cast<SLADisplayOrientation>(value)));
else if (opt_key.compare("support_material_pattern") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SupportMaterialPattern>(boost::any_cast<SupportMaterialPattern>(value)));
else if(opt_key.compare("support_pillar_connection_mode") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<SLAPillarConnectionMode>(boost::any_cast<SLAPillarConnectionMode>(value)));
else if(opt_key == "printhost_authorization_type")
config.set_key_value(opt_key, new ConfigOptionEnum<AuthorizationType>(boost::any_cast<AuthorizationType>(value)));
else if (opt_key.compare("wipe_advanced_algo") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<WipeAlgo>(boost::any_cast<WipeAlgo>(value)));
}
break;
case coPoints:{

View File

@ -924,56 +924,39 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
opt_key == "bottom_fill_pattern" ||
opt_key == "solid_fill_pattern" ||
opt_key == "fill_pattern" ||
opt_key == "brim_ears_pattern" ) {
opt_key == "brim_ears_pattern" ||
opt_key == "support_material_interface_pattern") {
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
}
else if (opt_key == "complete_objects_sort") {
} else if (opt_key == "complete_objects_sort") {
ret = static_cast<int>(config.option<ConfigOptionEnum<CompleteObjectSort>>(opt_key)->value);
}
else if (opt_key == "ironing_type") {
ret = static_cast<int>(config.option<ConfigOptionEnum<IroningType>>(opt_key)->value);
}
else if (opt_key == "gcode_flavor") {
} else if (opt_key == "display_orientation") {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value);
} else if (opt_key == "gcode_flavor") {
ret = static_cast<int>(config.option<ConfigOptionEnum<GCodeFlavor>>(opt_key)->value);
}
else if (opt_key == "machine_limits_usage") {
ret = static_cast<int>(config.option<ConfigOptionEnum<MachineLimitsUsage>>(opt_key)->value);
}
else if (opt_key == "support_material_interface_pattern") {
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
}
else if (opt_key == "support_material_pattern") {
ret = static_cast<int>(config.option<ConfigOptionEnum<SupportMaterialPattern>>(opt_key)->value);
}
else if (opt_key.compare("seam_position") == 0 || opt_key.compare("perimeter_loop_seam") == 0) {
ret = static_cast<int>(config.option<ConfigOptionEnum<SeamPosition>>(opt_key)->value);
}
else if (opt_key.compare("host_type") == 0) {
} else if (opt_key == "host_type") {
ret = static_cast<int>(config.option<ConfigOptionEnum<PrintHostType>>(opt_key)->value);
}
else if (opt_key == "infill_dense_algo"){
ret = static_cast<int>(config.option<ConfigOptionEnum<DenseInfillAlgo>>(opt_key)->value);
}
else if (opt_key == "no_perimeter_unsupported_algo"){
ret = static_cast<int>(config.option<ConfigOptionEnum<NoPerimeterUnsupportedAlgo>>(opt_key)->value);
}
else if (opt_key == "infill_connection") {
} else if (opt_key == "infill_connection") {
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillConnection>>(opt_key)->value);
}
else if (opt_key == "wipe_advanced_algo"){
ret = static_cast<int>(config.option<ConfigOptionEnum<WipeAlgo>>(opt_key)->value);
}
else if (opt_key == "support_material_contact_distance_type"){
} else if (opt_key == "infill_dense_algo") {
ret = static_cast<int>(config.option<ConfigOptionEnum<DenseInfillAlgo>>(opt_key)->value);
} else if (opt_key == "ironing_type") {
ret = static_cast<int>(config.option<ConfigOptionEnum<IroningType>>(opt_key)->value);
} else if (opt_key == "machine_limits_usage") {
ret = static_cast<int>(config.option<ConfigOptionEnum<MachineLimitsUsage>>(opt_key)->value);
} else if (opt_key == "no_perimeter_unsupported_algo") {
ret = static_cast<int>(config.option<ConfigOptionEnum<NoPerimeterUnsupportedAlgo>>(opt_key)->value);
} else if (opt_key == "printhost_authorization_type") {
ret = static_cast<int>(config.option<ConfigOptionEnum<AuthorizationType>>(opt_key)->value);
} else if (opt_key == "seam_position" || opt_key == "perimeter_loop_seam") {
ret = static_cast<int>(config.option<ConfigOptionEnum<SeamPosition>>(opt_key)->value);
} else if (opt_key == "support_material_contact_distance_type"){
ret = static_cast<int>(config.option<ConfigOptionEnum<SupportZDistanceType>>(opt_key)->value);
}
else if (opt_key == "display_orientation") {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLADisplayOrientation>>(opt_key)->value);
}
else if (opt_key == "support_pillar_connection_mode") {
} else if (opt_key == "support_material_pattern") {
ret = static_cast<int>(config.option<ConfigOptionEnum<SupportMaterialPattern>>(opt_key)->value);
} else if (opt_key == "support_pillar_connection_mode") {
ret = static_cast<int>(config.option<ConfigOptionEnum<SLAPillarConnectionMode>>(opt_key)->value);
}
else if (opt_key == "printhost_authorization_type") {
ret = static_cast<int>(config.option<ConfigOptionEnum<AuthorizationType>>(opt_key)->value);
} else if (opt_key == "wipe_advanced_algo") {
ret = static_cast<int>(config.option<ConfigOptionEnum<WipeAlgo>>(opt_key)->value);
}
}
break;

View File

@ -938,22 +938,43 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
case coEnum: {
if (opt_key == "top_fill_pattern" ||
opt_key == "bottom_fill_pattern" ||
opt_key == "fill_pattern")
opt_key == "fill_pattern" ||
opt_key == "solid_fill_pattern" ||
opt_key == "brim_ears_pattern" ||
opt_key == "support_material_interface_pattern")
return get_string_from_enum<InfillPattern>(opt_key, config, true);
if (opt_key == "gcode_flavor")
return get_string_from_enum<GCodeFlavor>(opt_key, config);
if (opt_key == "machine_limits_usage")
return get_string_from_enum<MachineLimitsUsage>(opt_key, config);
if (opt_key == "ironing_type")
return get_string_from_enum<IroningType>(opt_key, config);
if (opt_key == "support_material_pattern")
return get_string_from_enum<SupportMaterialPattern>(opt_key, config);
if (opt_key == "seam_position")
return get_string_from_enum<SeamPosition>(opt_key, config);
if (opt_key == "complete_objects_sort")
return get_string_from_enum<CompleteObjectSort>(opt_key, config);
if (opt_key == "display_orientation")
return get_string_from_enum<SLADisplayOrientation>(opt_key, config);
if (opt_key == "gcode_flavor")
return get_string_from_enum<GCodeFlavor>(opt_key, config);
if (opt_key == "host_type")
return get_string_from_enum<PrintHostType>(opt_key, config);
if (opt_key == "infill_connection")
return get_string_from_enum<InfillConnection>(opt_key, config);
if (opt_key == "infill_dense_algo")
return get_string_from_enum<DenseInfillAlgo>(opt_key, config);
if (opt_key == "ironing_type")
return get_string_from_enum<IroningType>(opt_key, config);
if (opt_key == "machine_limits_usage")
return get_string_from_enum<MachineLimitsUsage>(opt_key, config);
if (opt_key == "no_perimeter_unsupported_algo")
return get_string_from_enum<NoPerimeterUnsupportedAlgo>(opt_key, config);
if (opt_key == "perimeter_loop_seam")
return get_string_from_enum<SeamPosition>(opt_key, config, true);
if (opt_key == "printhost_authorization_type")
return get_string_from_enum<AuthorizationType>(opt_key, config);
if (opt_key == "seam_position")
return get_string_from_enum<SeamPosition>(opt_key, config);
if (opt_key == "support_material_contact_distance_type")
return get_string_from_enum<SupportZDistanceType>(opt_key, config);
if (opt_key == "support_material_pattern")
return get_string_from_enum<SupportMaterialPattern>(opt_key, config);
if (opt_key == "support_pillar_connection_mode")
return get_string_from_enum<SLAPillarConnectionMode>(opt_key, config);
if (opt_key == "wipe_advanced_algo")
return get_string_from_enum<WipeAlgo>(opt_key, config);
break;
}
case coPoints: {