Split the external infill pattern to separate top / bottom config values.

Based on f9344a00e3
thanks @supermerill
Implements  #475, #479, #1133, #1474
This commit is contained in:
bubnikv 2019-02-22 15:25:35 +01:00
parent 917f044f81
commit ab30370fb4
11 changed files with 51 additions and 26 deletions

View file

@ -638,7 +638,7 @@ void Choice::set_value(const boost::any& value, bool change_event)
}
case coEnum: {
int val = boost::any_cast<int>(value);
if (m_opt_id.compare("external_fill_pattern") == 0)
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern")
{
if (!m_opt.enum_values.empty()) {
std::string key;
@ -707,7 +707,7 @@ boost::any& Choice::get_value()
if (m_opt.type == coEnum)
{
int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();
if (m_opt_id.compare("external_fill_pattern") == 0)
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern")
{
if (!m_opt.enum_values.empty()) {
std::string key = m_opt.enum_values[ret_enum];

View file

@ -211,8 +211,9 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
}
break;
case coEnum:{
if (opt_key.compare("external_fill_pattern") == 0 ||
opt_key.compare("fill_pattern") == 0)
if (opt_key == "top_fill_pattern" ||
opt_key == "bottom_fill_pattern" ||
opt_key == "fill_pattern")
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
else if (opt_key.compare("gcode_flavor") == 0)
config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value)));

View file

@ -559,8 +559,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
ret = config.opt_int(opt_key, idx);
break;
case coEnum:{
if (opt_key.compare("external_fill_pattern") == 0 ||
opt_key.compare("fill_pattern") == 0 ) {
if (opt_key == "top_fill_pattern" ||
opt_key == "bottom_fill_pattern" ||
opt_key == "fill_pattern" ) {
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
}
else if (opt_key.compare("gcode_flavor") == 0 ) {

View file

@ -356,7 +356,7 @@ const std::vector<std::string>& Preset::print_options()
static std::vector<std::string> s_opts {
"layer_height", "first_layer_height", "perimeters", "spiral_vase", "top_solid_layers", "bottom_solid_layers",
"extra_perimeters", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters", "thin_walls", "overhangs",
"seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "external_fill_pattern",
"seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "top_fill_pattern", "bottom_fill_pattern",
"infill_every_layers", "infill_only_where_needed", "solid_infill_every_layers", "fill_angle", "bridge_angle",
"solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first", "max_print_speed",
"max_volumetric_speed",

View file

@ -971,7 +971,8 @@ void TabPrint::build()
optgroup = page->new_optgroup(_(L("Infill")));
optgroup->append_single_option_line("fill_density");
optgroup->append_single_option_line("fill_pattern");
optgroup->append_single_option_line("external_fill_pattern");
optgroup->append_single_option_line("top_fill_pattern");
optgroup->append_single_option_line("bottom_fill_pattern");
optgroup = page->new_optgroup(_(L("Reducing printing time")));
optgroup->append_single_option_line("infill_every_layers");
@ -1280,7 +1281,7 @@ void TabPrint::update()
}
}
if (!str_fill_pattern.empty()) {
const std::vector<std::string> &external_fill_pattern = m_config->def()->get("external_fill_pattern")->enum_values;
const std::vector<std::string> &external_fill_pattern = m_config->def()->get("top_fill_pattern")->enum_values;
bool correct_100p_fill = false;
for (const std::string &fill : external_fill_pattern)
{
@ -1321,7 +1322,7 @@ void TabPrint::update()
bool have_solid_infill = m_config->opt_int("top_solid_layers") > 0 || m_config->opt_int("bottom_solid_layers") > 0;
// solid_infill_extruder uses the same logic as in Print::extruders()
for (auto el : {"external_fill_pattern", "infill_first", "solid_infill_extruder",
for (auto el : {"top_fill_pattern", "bottom_fill_pattern", "infill_first", "solid_infill_extruder",
"solid_infill_extrusion_width", "solid_infill_speed" })
get_field(el)->toggle(have_solid_infill);