mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-15 03:11:46 +08:00
Split external infill parameter to top/bottom external infill
This commit is contained in:
parent
c6623bb258
commit
f9344a00e3
@ -43,7 +43,8 @@ default_acceleration = 1000
|
||||
dont_support_bridges = 1
|
||||
elefant_foot_compensation = 0
|
||||
ensure_vertical_shell_thickness = 1
|
||||
external_fill_pattern = rectilinear
|
||||
top_fill_pattern = rectilinear
|
||||
bottom_fill_pattern = rectilinear
|
||||
external_perimeters_first = 0
|
||||
external_perimeter_extrusion_width = 0.45
|
||||
extra_perimeters = 0
|
||||
|
@ -369,7 +369,8 @@ Usage: slic3r.pl [ OPTIONS ] [ file.stl ] [ file2.stl ] ...
|
||||
--fill-density Infill density (range: 0%-100%, default: $config->{fill_density}%)
|
||||
--fill-angle Infill angle in degrees (range: 0-90, default: $config->{fill_angle})
|
||||
--fill-pattern Pattern to use to fill non-solid layers (default: $config->{fill_pattern})
|
||||
--external-fill-pattern Pattern to use to fill solid layers (default: $config->{external_fill_pattern})
|
||||
--top-fill-pattern Pattern to use to fill solid layers (default: $config->{top_fill_pattern})
|
||||
--bottom-fill-pattern Pattern to use to fill solid layers (default: $config->{bottom_fill_pattern})
|
||||
--start-gcode Load initial G-code from the supplied file. This will overwrite
|
||||
the default command (home all axes [G28]).
|
||||
--end-gcode Load final G-code from the supplied file. This will overwrite
|
||||
|
3
t/fill.t
3
t/fill.t
@ -165,7 +165,8 @@ SKIP:
|
||||
for my $pattern (qw(rectilinear honeycomb hilbertcurve concentric)) {
|
||||
my $config = Slic3r::Config::new_from_defaults;
|
||||
$config->set('fill_pattern', $pattern);
|
||||
$config->set('external_fill_pattern', $pattern);
|
||||
$config->set('top_fill_pattern', $pattern);
|
||||
$config->set('bottom_fill_pattern', $pattern);
|
||||
$config->set('perimeters', 1);
|
||||
$config->set('skirts', 0);
|
||||
$config->set('fill_density', 20);
|
||||
|
@ -69,7 +69,8 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
if (surface.is_solid() && (!surface.is_bridge() || layerm.layer()->id() == 0)) {
|
||||
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].pattern = surface.is_external() ? layerm.region()->config.external_fill_pattern.value : ipRectilinear;
|
||||
group_attrib[i].pattern = (surface.surface_type == stTop && surface.is_external()) ? layerm.region()->config.top_fill_pattern.value : ipRectilinear;
|
||||
group_attrib[i].pattern = (surface.surface_type == stBottom && surface.is_external()) ? layerm.region()->config.bottom_fill_pattern.value : ipRectilinear;
|
||||
}
|
||||
}
|
||||
// Loop through solid groups, find compatible groups and append them to this one.
|
||||
@ -161,7 +162,7 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
if (surface.is_solid()) {
|
||||
density = 100.;
|
||||
fill_pattern = (surface.is_external() && ! is_bridge) ?
|
||||
layerm.region()->config.external_fill_pattern.value :
|
||||
(surface.surface_type == stTop ? layerm.region()->config.top_fill_pattern.value : layerm.region()->config.bottom_fill_pattern.value) :
|
||||
ipRectilinear;
|
||||
} else if (density <= 0)
|
||||
continue;
|
||||
|
@ -242,12 +242,11 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->cli = "ensure-vertical-shell-thickness!";
|
||||
def->default_value = new ConfigOptionBool(false);
|
||||
|
||||
def = this->add("external_fill_pattern", coEnum);
|
||||
def->label = L("Top/bottom fill pattern");
|
||||
def = this->add("top_fill_pattern", coEnum);
|
||||
def->label = L("Top fill pattern");
|
||||
def->category = L("Infill");
|
||||
def->tooltip = L("Fill pattern for top/bottom infill. This only affects the external visible layer, "
|
||||
"and not its adjacent solid shells.");
|
||||
def->cli = "external-fill-pattern|solid-fill-pattern=s";
|
||||
def->tooltip = L("Fill pattern for top infill. This only affects the top external visible layer, and not its adjacent solid shells.");
|
||||
def->cli = "top-fill-pattern|solid-fill-pattern=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
def->enum_values.push_back("rectilinear");
|
||||
def->enum_values.push_back("concentric");
|
||||
@ -259,10 +258,28 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->enum_labels.push_back("Hilbert Curve");
|
||||
def->enum_labels.push_back("Archimedean Chords");
|
||||
def->enum_labels.push_back("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.push_back("solid_fill_pattern");
|
||||
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||
|
||||
def = this->add("bottom_fill_pattern", coEnum);
|
||||
def->label = L("bottom fill pattern");
|
||||
def->category = L("Infill");
|
||||
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|solid-fill-pattern=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
def->enum_values.push_back("rectilinear");
|
||||
def->enum_values.push_back("concentric");
|
||||
def->enum_values.push_back("hilbertcurve");
|
||||
def->enum_values.push_back("archimedeanchords");
|
||||
def->enum_values.push_back("octagramspiral");
|
||||
def->enum_labels.push_back("Rectilinear");
|
||||
def->enum_labels.push_back("Concentric");
|
||||
def->enum_labels.push_back("Hilbert Curve");
|
||||
def->enum_labels.push_back("Archimedean Chords");
|
||||
def->enum_labels.push_back("Octagram Spiral");
|
||||
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||
|
||||
def = this->add("external_perimeter_extrusion_width", coFloatOrPercent);
|
||||
def->label = L("External perimeters");
|
||||
def->category = L("Extrusion Width");
|
||||
@ -1961,13 +1978,19 @@ std::string FullPrintConfig::validate()
|
||||
if (! print_config_def.get("fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
|
||||
return "Invalid value for --fill-pattern";
|
||||
|
||||
// --external-fill-pattern
|
||||
if (! print_config_def.get("external_fill_pattern")->has_enum_value(this->external_fill_pattern.serialize()))
|
||||
return "Invalid value for --external-fill-pattern";
|
||||
// --top-fill-pattern
|
||||
if (! print_config_def.get("top_fill_pattern")->has_enum_value(this->top_fill_pattern.serialize()))
|
||||
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
|
||||
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())
|
||||
|| ! print_config_def.get("bottom_fill_pattern")->has_enum_value(this->fill_pattern.serialize())
|
||||
))
|
||||
return "The selected fill pattern is not supposed to work at 100% density";
|
||||
|
||||
// --infill-every-layers
|
||||
|
@ -378,7 +378,8 @@ public:
|
||||
ConfigOptionFloat bridge_flow_ratio;
|
||||
ConfigOptionFloat bridge_speed;
|
||||
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_speed;
|
||||
ConfigOptionBool external_perimeters_first;
|
||||
@ -416,7 +417,8 @@ protected:
|
||||
OPT_PTR(bridge_flow_ratio);
|
||||
OPT_PTR(bridge_speed);
|
||||
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_speed);
|
||||
OPT_PTR(external_perimeters_first);
|
||||
|
@ -198,7 +198,8 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|
||||
|| opt_key == "bridge_angle") {
|
||||
steps.emplace_back(posPrepareInfill);
|
||||
} 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 == "fill_angle"
|
||||
|| opt_key == "fill_pattern"
|
||||
|
@ -454,7 +454,7 @@ boost::any Choice::get_value()
|
||||
else
|
||||
{
|
||||
int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();
|
||||
if (m_opt_id.compare("external_fill_pattern") == 0)
|
||||
if (m_opt_id.compare("top_fill_pattern") == 0 || m_opt_id.compare("bottom_fill_pattern") == 0 )
|
||||
{
|
||||
if (!m_opt.enum_values.empty()){
|
||||
std::string key = m_opt.enum_values[ret_enum];
|
||||
|
@ -453,7 +453,7 @@ void change_opt_value(DynamicPrintConfig& config, t_config_option_key opt_key, b
|
||||
}
|
||||
break;
|
||||
case coEnum:{
|
||||
if (opt_key.compare("external_fill_pattern") == 0 ||
|
||||
if (opt_key.compare("top_fill_pattern") == 0 || opt_key.compare("bottom_fill_pattern") == 0 ||
|
||||
opt_key.compare("fill_pattern") == 0)
|
||||
config.set_key_value(opt_key, new ConfigOptionEnum<InfillPattern>(boost::any_cast<InfillPattern>(value)));
|
||||
else if (opt_key.compare("gcode_flavor") == 0)
|
||||
|
@ -399,7 +399,7 @@ boost::any ConfigOptionsGroup::get_config_value(DynamicPrintConfig& config, std:
|
||||
ret = config.opt_int(opt_key, idx);
|
||||
break;
|
||||
case coEnum:{
|
||||
if (opt_key.compare("external_fill_pattern") == 0 ||
|
||||
if (opt_key.compare("top_fill_pattern") == 0 || opt_key.compare("bottom_fill_pattern") == 0 ||
|
||||
opt_key.compare("fill_pattern") == 0 ){
|
||||
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
|
||||
}
|
||||
|
@ -180,7 +180,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", "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
|
||||
|
@ -418,7 +418,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");
|
||||
@ -721,9 +722,15 @@ void TabPrint::update()
|
||||
}
|
||||
}
|
||||
if (!str_fill_pattern.empty()){
|
||||
auto external_fill_pattern = m_config->def()->get("external_fill_pattern")->enum_values;
|
||||
auto top_fill_pattern = m_config->def()->get("top_fill_pattern")->enum_values;
|
||||
bool correct_100p_fill = false;
|
||||
for (auto fill : external_fill_pattern)
|
||||
for (auto fill : top_fill_pattern)
|
||||
{
|
||||
if (str_fill_pattern.compare(fill) == 0)
|
||||
correct_100p_fill = true;
|
||||
}
|
||||
auto bottom_fill_pattern = m_config->def()->get("bottom_fill_pattern")->enum_values;
|
||||
for (auto fill : bottom_fill_pattern)
|
||||
{
|
||||
if (str_fill_pattern.compare(fill) == 0)
|
||||
correct_100p_fill = true;
|
||||
@ -766,7 +773,7 @@ void TabPrint::update()
|
||||
|
||||
bool have_solid_infill = m_config->opt_int("top_solid_layers") > 0 || m_config->opt_int("bottom_solid_layers") > 0;
|
||||
vec_enable.resize(0);
|
||||
vec_enable = { "external_fill_pattern", "infill_first", "solid_infill_extruder",
|
||||
vec_enable = { "top_fill_pattern", "bottom_fill_pattern", "infill_first", "solid_infill_extruder",
|
||||
"solid_infill_extrusion_width", "solid_infill_speed" };
|
||||
// solid_infill_extruder uses the same logic as in Print::extruders()
|
||||
for (auto el : vec_enable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user