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:
parent
917f044f81
commit
ab30370fb4
11 changed files with 51 additions and 26 deletions
|
@ -69,7 +69,9 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||||
if (surface.is_solid() && (!surface.is_bridge() || layerm.layer()->id() == 0)) {
|
if (surface.is_solid() && (!surface.is_bridge() || layerm.layer()->id() == 0)) {
|
||||||
group_attrib[i].is_solid = true;
|
group_attrib[i].is_solid = true;
|
||||||
group_attrib[i].flow_width = (surface.surface_type == stTop) ? top_solid_infill_flow.width : solid_infill_flow.width;
|
group_attrib[i].flow_width = (surface.surface_type == stTop) ? top_solid_infill_flow.width : solid_infill_flow.width;
|
||||||
group_attrib[i].pattern = surface.is_external() ? layerm.region()->config().external_fill_pattern.value : ipRectilinear;
|
group_attrib[i].pattern = surface.is_external() ?
|
||||||
|
(surface.is_top() ? layerm.region()->config().top_fill_pattern.value : layerm.region()->config().bottom_fill_pattern.value) :
|
||||||
|
ipRectilinear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Loop through solid groups, find compatible groups and append them to this one.
|
// Loop through solid groups, find compatible groups and append them to this one.
|
||||||
|
@ -161,7 +163,7 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||||
if (surface.is_solid()) {
|
if (surface.is_solid()) {
|
||||||
density = 100.;
|
density = 100.;
|
||||||
fill_pattern = (surface.is_external() && ! is_bridge) ?
|
fill_pattern = (surface.is_external() && ! is_bridge) ?
|
||||||
layerm.region()->config().external_fill_pattern.value :
|
(surface.is_top() ? layerm.region()->config().top_fill_pattern.value : layerm.region()->config().bottom_fill_pattern.value) :
|
||||||
ipRectilinear;
|
ipRectilinear;
|
||||||
} else if (density <= 0)
|
} else if (density <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -362,12 +362,11 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->default_value = new ConfigOptionBool(false);
|
def->default_value = new ConfigOptionBool(false);
|
||||||
|
|
||||||
def = this->add("external_fill_pattern", coEnum);
|
auto def_top_fill_pattern = def = this->add("top_fill_pattern", coEnum);
|
||||||
def->label = L("Top/bottom fill pattern");
|
def->label = L("Top fill pattern");
|
||||||
def->category = L("Infill");
|
def->category = L("Infill");
|
||||||
def->tooltip = L("Fill pattern for top/bottom infill. This only affects the external visible layer, "
|
def->tooltip = L("Fill pattern for top infill. This only affects the top visible layer, and not its adjacent solid shells.");
|
||||||
"and not its adjacent solid shells.");
|
def->cli = "top-fill-pattern|external-fill-pattern|solid-fill-pattern=s";
|
||||||
def->cli = "external-fill-pattern|solid-fill-pattern=s";
|
|
||||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||||
def->enum_values.push_back("rectilinear");
|
def->enum_values.push_back("rectilinear");
|
||||||
def->enum_values.push_back("concentric");
|
def->enum_values.push_back("concentric");
|
||||||
|
@ -379,8 +378,15 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->enum_labels.push_back(L("Hilbert Curve"));
|
def->enum_labels.push_back(L("Hilbert Curve"));
|
||||||
def->enum_labels.push_back(L("Archimedean Chords"));
|
def->enum_labels.push_back(L("Archimedean Chords"));
|
||||||
def->enum_labels.push_back(L("Octagram Spiral"));
|
def->enum_labels.push_back(L("Octagram Spiral"));
|
||||||
// solid_fill_pattern is an obsolete equivalent to external_fill_pattern.
|
// solid_fill_pattern is an obsolete equivalent to top_fill_pattern/bottom_fill_pattern.
|
||||||
def->aliases = { "solid_fill_pattern" };
|
def->aliases = { "solid_fill_pattern", "external_fill_pattern" };
|
||||||
|
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||||
|
|
||||||
|
def = this->add("bottom_fill_pattern", coEnum);
|
||||||
|
*def = *def_top_fill_pattern;
|
||||||
|
def->label = L("Bottom Pattern");
|
||||||
|
def->tooltip = L("Fill pattern for bottom infill. This only affects the bottom external visible layer, and not its adjacent solid shells.");
|
||||||
|
def->cli = "bottom-fill-pattern|external-fill-pattern|solid-fill-pattern=s";
|
||||||
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||||
|
|
||||||
def = this->add("external_perimeter_extrusion_width", coFloatOrPercent);
|
def = this->add("external_perimeter_extrusion_width", coFloatOrPercent);
|
||||||
|
@ -2939,13 +2945,17 @@ std::string FullPrintConfig::validate()
|
||||||
if (! print_config_def.get("fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
|
if (! print_config_def.get("fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
|
||||||
return "Invalid value for --fill-pattern";
|
return "Invalid value for --fill-pattern";
|
||||||
|
|
||||||
// --external-fill-pattern
|
// --top-fill-pattern
|
||||||
if (! print_config_def.get("external_fill_pattern")->has_enum_value(this->external_fill_pattern.serialize()))
|
if (! print_config_def.get("top_fill_pattern")->has_enum_value(this->top_fill_pattern.serialize()))
|
||||||
return "Invalid value for --external-fill-pattern";
|
return "Invalid value for --top-fill-pattern";
|
||||||
|
|
||||||
|
// --bottom-fill-pattern
|
||||||
|
if (! print_config_def.get("bottom_fill_pattern")->has_enum_value(this->bottom_fill_pattern.serialize()))
|
||||||
|
return "Invalid value for --bottom-fill-pattern";
|
||||||
|
|
||||||
// --fill-density
|
// --fill-density
|
||||||
if (fabs(this->fill_density.value - 100.) < EPSILON &&
|
if (fabs(this->fill_density.value - 100.) < EPSILON &&
|
||||||
! print_config_def.get("external_fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
|
! print_config_def.get("top_fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
|
||||||
return "The selected fill pattern is not supposed to work at 100% density";
|
return "The selected fill pattern is not supposed to work at 100% density";
|
||||||
|
|
||||||
// --infill-every-layers
|
// --infill-every-layers
|
||||||
|
|
|
@ -462,7 +462,8 @@ public:
|
||||||
ConfigOptionFloat bridge_flow_ratio;
|
ConfigOptionFloat bridge_flow_ratio;
|
||||||
ConfigOptionFloat bridge_speed;
|
ConfigOptionFloat bridge_speed;
|
||||||
ConfigOptionBool ensure_vertical_shell_thickness;
|
ConfigOptionBool ensure_vertical_shell_thickness;
|
||||||
ConfigOptionEnum<InfillPattern> external_fill_pattern;
|
ConfigOptionEnum<InfillPattern> top_fill_pattern;
|
||||||
|
ConfigOptionEnum<InfillPattern> bottom_fill_pattern;
|
||||||
ConfigOptionFloatOrPercent external_perimeter_extrusion_width;
|
ConfigOptionFloatOrPercent external_perimeter_extrusion_width;
|
||||||
ConfigOptionFloatOrPercent external_perimeter_speed;
|
ConfigOptionFloatOrPercent external_perimeter_speed;
|
||||||
ConfigOptionBool external_perimeters_first;
|
ConfigOptionBool external_perimeters_first;
|
||||||
|
@ -504,7 +505,8 @@ protected:
|
||||||
OPT_PTR(bridge_flow_ratio);
|
OPT_PTR(bridge_flow_ratio);
|
||||||
OPT_PTR(bridge_speed);
|
OPT_PTR(bridge_speed);
|
||||||
OPT_PTR(ensure_vertical_shell_thickness);
|
OPT_PTR(ensure_vertical_shell_thickness);
|
||||||
OPT_PTR(external_fill_pattern);
|
OPT_PTR(top_fill_pattern);
|
||||||
|
OPT_PTR(bottom_fill_pattern);
|
||||||
OPT_PTR(external_perimeter_extrusion_width);
|
OPT_PTR(external_perimeter_extrusion_width);
|
||||||
OPT_PTR(external_perimeter_speed);
|
OPT_PTR(external_perimeter_speed);
|
||||||
OPT_PTR(external_perimeters_first);
|
OPT_PTR(external_perimeters_first);
|
||||||
|
|
|
@ -498,7 +498,8 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|
||||||
|| opt_key == "bridge_angle") {
|
|| opt_key == "bridge_angle") {
|
||||||
steps.emplace_back(posPrepareInfill);
|
steps.emplace_back(posPrepareInfill);
|
||||||
} else if (
|
} else if (
|
||||||
opt_key == "external_fill_pattern"
|
opt_key == "top_fill_pattern"
|
||||||
|
|| opt_key == "bottom_fill_pattern"
|
||||||
|| opt_key == "external_fill_link_max_length"
|
|| opt_key == "external_fill_link_max_length"
|
||||||
|| opt_key == "fill_angle"
|
|| opt_key == "fill_angle"
|
||||||
|| opt_key == "fill_pattern"
|
|| opt_key == "fill_pattern"
|
||||||
|
|
|
@ -42,6 +42,12 @@ Surface::is_internal() const
|
||||||
|| this->surface_type == stInternalVoid;
|
|| this->surface_type == stInternalVoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Surface::is_top() const
|
||||||
|
{
|
||||||
|
return this->surface_type == stTop;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Surface::is_bottom() const
|
Surface::is_bottom() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
bool is_solid() const;
|
bool is_solid() const;
|
||||||
bool is_external() const;
|
bool is_external() const;
|
||||||
bool is_internal() const;
|
bool is_internal() const;
|
||||||
|
bool is_top() const;
|
||||||
bool is_bottom() const;
|
bool is_bottom() const;
|
||||||
bool is_bridge() const;
|
bool is_bridge() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -638,7 +638,7 @@ void Choice::set_value(const boost::any& value, bool change_event)
|
||||||
}
|
}
|
||||||
case coEnum: {
|
case coEnum: {
|
||||||
int val = boost::any_cast<int>(value);
|
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()) {
|
if (!m_opt.enum_values.empty()) {
|
||||||
std::string key;
|
std::string key;
|
||||||
|
@ -707,7 +707,7 @@ boost::any& Choice::get_value()
|
||||||
if (m_opt.type == coEnum)
|
if (m_opt.type == coEnum)
|
||||||
{
|
{
|
||||||
int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();
|
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()) {
|
if (!m_opt.enum_values.empty()) {
|
||||||
std::string key = m_opt.enum_values[ret_enum];
|
std::string key = m_opt.enum_values[ret_enum];
|
||||||
|
|
|
@ -211,8 +211,9 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case coEnum:{
|
case coEnum:{
|
||||||
if (opt_key.compare("external_fill_pattern") == 0 ||
|
if (opt_key == "top_fill_pattern" ||
|
||||||
opt_key.compare("fill_pattern") == 0)
|
opt_key == "bottom_fill_pattern" ||
|
||||||
|
opt_key == "fill_pattern")
|
||||||
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
|
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
|
||||||
else if (opt_key.compare("gcode_flavor") == 0)
|
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)));
|
||||||
|
|
|
@ -559,8 +559,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
||||||
ret = config.opt_int(opt_key, idx);
|
ret = config.opt_int(opt_key, idx);
|
||||||
break;
|
break;
|
||||||
case coEnum:{
|
case coEnum:{
|
||||||
if (opt_key.compare("external_fill_pattern") == 0 ||
|
if (opt_key == "top_fill_pattern" ||
|
||||||
opt_key.compare("fill_pattern") == 0 ) {
|
opt_key == "bottom_fill_pattern" ||
|
||||||
|
opt_key == "fill_pattern" ) {
|
||||||
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
|
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
|
||||||
}
|
}
|
||||||
else if (opt_key.compare("gcode_flavor") == 0 ) {
|
else if (opt_key.compare("gcode_flavor") == 0 ) {
|
||||||
|
|
|
@ -356,7 +356,7 @@ const std::vector<std::string>& Preset::print_options()
|
||||||
static std::vector<std::string> s_opts {
|
static std::vector<std::string> s_opts {
|
||||||
"layer_height", "first_layer_height", "perimeters", "spiral_vase", "top_solid_layers", "bottom_solid_layers",
|
"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",
|
"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",
|
"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",
|
"solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first", "max_print_speed",
|
||||||
"max_volumetric_speed",
|
"max_volumetric_speed",
|
||||||
|
|
|
@ -971,7 +971,8 @@ void TabPrint::build()
|
||||||
optgroup = page->new_optgroup(_(L("Infill")));
|
optgroup = page->new_optgroup(_(L("Infill")));
|
||||||
optgroup->append_single_option_line("fill_density");
|
optgroup->append_single_option_line("fill_density");
|
||||||
optgroup->append_single_option_line("fill_pattern");
|
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 = page->new_optgroup(_(L("Reducing printing time")));
|
||||||
optgroup->append_single_option_line("infill_every_layers");
|
optgroup->append_single_option_line("infill_every_layers");
|
||||||
|
@ -1280,7 +1281,7 @@ void TabPrint::update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!str_fill_pattern.empty()) {
|
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;
|
bool correct_100p_fill = false;
|
||||||
for (const std::string &fill : external_fill_pattern)
|
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;
|
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()
|
// 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" })
|
"solid_infill_extrusion_width", "solid_infill_speed" })
|
||||||
get_field(el)->toggle(have_solid_infill);
|
get_field(el)->toggle(have_solid_infill);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue