mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 11:45:56 +08:00
add solid fill pattern option (useful for translucent printing)
This commit is contained in:
parent
204e7f7647
commit
d3017889c0
@ -103,8 +103,8 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
if (surface.is_solid() && (!surface.is_bridge() || layerm.layer()->id() == 0) && !surface.is_overBridge()) {
|
||||
group_attrib[i].is_solid = true;
|
||||
group_attrib[i].flow_width = (surface.is_top()) ? top_solid_infill_flow.width : solid_infill_flow.width;
|
||||
group_attrib[i].pattern = (surface.is_top() && surface.is_external()) ? layerm.region()->config().top_fill_pattern.value : ipRectilinear;
|
||||
group_attrib[i].pattern = (surface.is_bottom() && surface.is_external()) ? layerm.region()->config().bottom_fill_pattern.value : ipRectilinear;
|
||||
group_attrib[i].pattern = (surface.is_top() && surface.is_external()) ? layerm.region()->config().top_fill_pattern.value : layerm.region()->config().solid_fill_pattern.value;
|
||||
group_attrib[i].pattern = (surface.is_bottom() && surface.is_external()) ? layerm.region()->config().bottom_fill_pattern.value : layerm.region()->config().solid_fill_pattern.value;
|
||||
}
|
||||
}
|
||||
// Loop through solid groups, find compatible groups and append them to this one.
|
||||
@ -214,9 +214,11 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
|
||||
if (surface.is_solid()) {
|
||||
density = 100.;
|
||||
fill_pattern = (surface.is_external() && ! is_bridge) ?
|
||||
(surface.is_top() ? layerm.region()->config().top_fill_pattern.value : layerm.region()->config().bottom_fill_pattern.value) :
|
||||
ipRectilinear;
|
||||
fill_pattern = ipRectilinear;
|
||||
if (surface.is_external() && !is_bridge)
|
||||
fill_pattern = surface.is_top() ? layerm.region()->config().top_fill_pattern.value : layerm.region()->config().bottom_fill_pattern.value;
|
||||
else if (!is_bridge)
|
||||
fill_pattern = layerm.region()->config().solid_fill_pattern.value;
|
||||
} else {
|
||||
if (layerm.region()->config().infill_dense.getBool()
|
||||
&& layerm.region()->config().fill_density<40
|
||||
|
@ -409,7 +409,7 @@ void PrintConfigDef::init_fff_params()
|
||||
def->label = L("Top Pattern");
|
||||
def->category = L("Infill");
|
||||
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->cli = "top-fill-pattern|external-fill-pattern=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
def->enum_values.push_back("rectilinear");
|
||||
def->enum_values.push_back("concentric");
|
||||
@ -427,15 +427,13 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_labels.push_back(L("Archimedean Chords"));
|
||||
def->enum_labels.push_back(L("Octagram Spiral"));
|
||||
def->enum_labels.push_back(L("Ironing"));
|
||||
// solid_fill_pattern is an obsolete equivalent to top_fill_pattern/bottom_fill_pattern.
|
||||
def->aliases = { "solid_fill_pattern" };
|
||||
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||
|
||||
def = this->add("bottom_fill_pattern", coEnum);
|
||||
def->label = L("Bottom 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->cli = "bottom-fill-pattern|external-fill-pattern=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
def->enum_values.push_back("rectilinear");
|
||||
def->enum_values.push_back("concentric");
|
||||
@ -443,15 +441,40 @@ void PrintConfigDef::init_fff_params()
|
||||
def->enum_values.push_back("hilbertcurve");
|
||||
def->enum_values.push_back("archimedeanchords");
|
||||
def->enum_values.push_back("octagramspiral");
|
||||
def->enum_values.push_back("smooth");
|
||||
def->enum_labels.push_back(L("Rectilinear"));
|
||||
def->enum_labels.push_back(L("Concentric"));
|
||||
def->enum_labels.push_back(L("Concentric (filled)"));
|
||||
def->enum_labels.push_back(L("Hilbert Curve"));
|
||||
def->enum_labels.push_back(L("Archimedean Chords"));
|
||||
def->enum_labels.push_back(L("Octagram Spiral"));
|
||||
def->enum_labels.push_back(L("Ironing"));
|
||||
def->mode = comAdvanced;
|
||||
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||
|
||||
def = this->add("solid_fill_pattern", coEnum);
|
||||
def->label = L("Fill solid");
|
||||
def->category = L("Infill");
|
||||
def->tooltip = L("Fill pattern for solid (internal) infill. This only affects the solid not-visible layers. You should use rectilinear is most cases. You can use ironing for transluscnet material.");
|
||||
def->cli = "solid-fill-pattern=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
def->enum_values.push_back("rectilinear");
|
||||
def->enum_values.push_back("smooth");
|
||||
def->enum_values.push_back("concentric");
|
||||
def->enum_values.push_back("concentricgapfill");
|
||||
def->enum_values.push_back("hilbertcurve");
|
||||
def->enum_values.push_back("archimedeanchords");
|
||||
def->enum_values.push_back("octagramspiral");
|
||||
def->enum_labels.push_back(L("Rectilinear"));
|
||||
def->enum_labels.push_back(L("Ironing"));
|
||||
def->enum_labels.push_back(L("Concentric"));
|
||||
def->enum_labels.push_back(L("Concentric (filled)"));
|
||||
def->enum_labels.push_back(L("Hilbert Curve"));
|
||||
def->enum_labels.push_back(L("Archimedean Chords"));
|
||||
def->enum_labels.push_back(L("Octagram Spiral"));
|
||||
def->mode = comExpert;
|
||||
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
|
||||
|
||||
def = this->add("enforce_full_fill_volume", coBool);
|
||||
def->label = L("Enforce 100% fill volume");
|
||||
def->category = L("Infill");
|
||||
@ -3301,15 +3324,19 @@ std::string FullPrintConfig::validate()
|
||||
// --fill-pattern
|
||||
if (! print_config_def.get("fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
|
||||
return "Invalid value for --fill-pattern";
|
||||
|
||||
|
||||
// --top-fill-pattern
|
||||
if (! print_config_def.get("top_fill_pattern")->has_enum_value(this->top_fill_pattern.serialize()))
|
||||
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";
|
||||
|
||||
// --solid-fill-pattern
|
||||
if (!print_config_def.get("solid_fill_pattern")->has_enum_value(this->solid_fill_pattern.serialize()))
|
||||
return "Invalid value for --solid-fill-pattern";
|
||||
|
||||
// --fill-density
|
||||
if (fabs(this->fill_density.value - 100.) < EPSILON &&
|
||||
(! print_config_def.get("top_fill_pattern")->has_enum_value(this->fill_pattern.serialize())
|
||||
|
@ -526,10 +526,9 @@ public:
|
||||
ConfigOptionInt bottom_solid_layers;
|
||||
ConfigOptionFloat bridge_flow_ratio;
|
||||
ConfigOptionFloat over_bridge_flow_ratio;
|
||||
ConfigOptionEnum<InfillPattern> bottom_fill_pattern;
|
||||
ConfigOptionFloat bridge_speed;
|
||||
ConfigOptionBool ensure_vertical_shell_thickness;
|
||||
ConfigOptionEnum<InfillPattern> top_fill_pattern;
|
||||
ConfigOptionEnum<InfillPattern> bottom_fill_pattern;
|
||||
ConfigOptionBool enforce_full_fill_volume;
|
||||
ConfigOptionFloat external_infill_margin;
|
||||
ConfigOptionFloat bridged_infill_margin;
|
||||
@ -565,6 +564,7 @@ public:
|
||||
// Total number of perimeters.
|
||||
ConfigOptionInt perimeters;
|
||||
ConfigOptionFloatOrPercent small_perimeter_speed;
|
||||
ConfigOptionEnum<InfillPattern> solid_fill_pattern;
|
||||
ConfigOptionFloat solid_infill_below_area;
|
||||
ConfigOptionInt solid_infill_extruder;
|
||||
ConfigOptionFloatOrPercent solid_infill_extrusion_width;
|
||||
@ -574,6 +574,7 @@ public:
|
||||
ConfigOptionBool thin_walls;
|
||||
ConfigOptionFloatOrPercent thin_walls_min_width;
|
||||
ConfigOptionFloatOrPercent thin_walls_overlap;
|
||||
ConfigOptionEnum<InfillPattern> top_fill_pattern;
|
||||
ConfigOptionFloatOrPercent top_infill_extrusion_width;
|
||||
ConfigOptionInt top_solid_layers;
|
||||
ConfigOptionFloatOrPercent top_solid_infill_speed;
|
||||
@ -586,10 +587,9 @@ protected:
|
||||
OPT_PTR(bottom_solid_layers);
|
||||
OPT_PTR(bridge_flow_ratio);
|
||||
OPT_PTR(over_bridge_flow_ratio);
|
||||
OPT_PTR(bottom_fill_pattern);
|
||||
OPT_PTR(bridge_speed);
|
||||
OPT_PTR(ensure_vertical_shell_thickness);
|
||||
OPT_PTR(top_fill_pattern);
|
||||
OPT_PTR(bottom_fill_pattern);
|
||||
OPT_PTR(enforce_full_fill_volume);
|
||||
OPT_PTR(external_infill_margin);
|
||||
OPT_PTR(bridged_infill_margin);
|
||||
@ -623,6 +623,7 @@ protected:
|
||||
OPT_PTR(perimeter_speed);
|
||||
OPT_PTR(perimeters);
|
||||
OPT_PTR(small_perimeter_speed);
|
||||
OPT_PTR(solid_fill_pattern);
|
||||
OPT_PTR(solid_infill_below_area);
|
||||
OPT_PTR(solid_infill_extruder);
|
||||
OPT_PTR(solid_infill_extrusion_width);
|
||||
@ -631,6 +632,7 @@ protected:
|
||||
OPT_PTR(thin_walls);
|
||||
OPT_PTR(thin_walls_min_width);
|
||||
OPT_PTR(thin_walls_overlap);
|
||||
OPT_PTR(top_fill_pattern);
|
||||
OPT_PTR(top_infill_extrusion_width);
|
||||
OPT_PTR(top_solid_infill_speed);
|
||||
OPT_PTR(top_solid_layers);
|
||||
|
@ -530,8 +530,9 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|
||||
|| opt_key == "bridge_angle") {
|
||||
steps.emplace_back(posPrepareInfill);
|
||||
} else if (
|
||||
opt_key == "top_fill_pattern"
|
||||
opt_key == "top_fill_pattern"
|
||||
|| opt_key == "bottom_fill_pattern"
|
||||
|| opt_key == "solid_fill_pattern"
|
||||
|| opt_key == "enforce_full_fill_volume"
|
||||
|| opt_key == "external_fill_link_max_length"
|
||||
|| opt_key == "fill_angle"
|
||||
@ -2716,6 +2717,8 @@ void PrintObject::combine_infill()
|
||||
// so let's remove those areas from all layers.
|
||||
Polygons intersection_with_clearance;
|
||||
intersection_with_clearance.reserve(intersection.size());
|
||||
//TODO: check if that 'hack' isn't counter-productive : the overlap is done at perimetergenerator (so before this)
|
||||
// and the not-overlap area is stored in the LayerRegion object
|
||||
float clearance_offset =
|
||||
0.5f * layerms.back()->flow(frPerimeter).scaled_width() +
|
||||
// Because fill areas for rectilinear and honeycomb are grown
|
||||
|
@ -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("top_fill_pattern") == 0 || m_opt_id.compare("bottom_fill_pattern") == 0 )
|
||||
if (m_opt_id.compare("top_fill_pattern") == 0 || m_opt_id.compare("bottom_fill_pattern") == 0 || m_opt_id.compare("solid_fill_pattern") == 0)
|
||||
{
|
||||
if (!m_opt.enum_values.empty()) {
|
||||
std::string key;
|
||||
@ -728,7 +728,7 @@ boost::any& Choice::get_value()
|
||||
if (m_opt.type == coEnum)
|
||||
{
|
||||
int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();
|
||||
if (m_opt_id.compare("top_fill_pattern") == 0 || m_opt_id.compare("bottom_fill_pattern") == 0 )
|
||||
if (m_opt_id.compare("top_fill_pattern") == 0 || m_opt_id.compare("bottom_fill_pattern") == 0 || m_opt_id.compare("solid_fill_pattern") == 0)
|
||||
{
|
||||
if (!m_opt.enum_values.empty()) {
|
||||
std::string key = m_opt.enum_values[ret_enum];
|
||||
|
@ -211,8 +211,8 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
||||
}
|
||||
break;
|
||||
case coEnum:{
|
||||
if (opt_key.compare("top_fill_pattern") == 0 || opt_key.compare("bottom_fill_pattern") == 0 ||
|
||||
opt_key.compare("fill_pattern") == 0)
|
||||
if (opt_key.compare("top_fill_pattern") == 0 || opt_key.compare("bottom_fill_pattern") == 0 ||
|
||||
opt_key.compare("solid_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)
|
||||
config.set_key_value(opt_key, new ConfigOptionEnum<GCodeFlavor>(boost::any_cast<GCodeFlavor>(value)));
|
||||
|
@ -539,7 +539,7 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
||||
break;
|
||||
case coEnum:{
|
||||
if (opt_key.compare("top_fill_pattern") == 0 || opt_key.compare("bottom_fill_pattern") == 0 ||
|
||||
opt_key.compare("fill_pattern") == 0 ) {
|
||||
opt_key.compare("solid_fill_pattern") == 0 || opt_key.compare("fill_pattern") == 0) {
|
||||
ret = static_cast<int>(config.option<ConfigOptionEnum<InfillPattern>>(opt_key)->value);
|
||||
}
|
||||
else if (opt_key.compare("gcode_flavor") == 0 ) {
|
||||
|
@ -320,7 +320,11 @@ 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", "only_one_perimeter_top", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters", "thin_walls", "overhangs",
|
||||
"seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "top_fill_pattern", "bottom_fill_pattern",
|
||||
"seam_position", "external_perimeters_first", "fill_density"
|
||||
, "fill_pattern"
|
||||
, "top_fill_pattern"
|
||||
, "bottom_fill_pattern"
|
||||
, "solid_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",
|
||||
|
@ -952,8 +952,8 @@ void TabPrint::build()
|
||||
optgroup->append_single_option_line("overhangs");
|
||||
line = { _(L("Avoid unsupported perimeters")), "" };
|
||||
line.append_option(optgroup->get_option("no_perimeter_unsupported"));
|
||||
line.append_option(optgroup->get_option("min_perimeter_unsupported"));
|
||||
line.append_option(optgroup->get_option("noperi_bridge_only"));
|
||||
//line.append_option(optgroup->get_option("min_perimeter_unsupported"));
|
||||
//line.append_option(optgroup->get_option("noperi_bridge_only"));
|
||||
optgroup->append_line(line);
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Advanced")));
|
||||
@ -979,6 +979,7 @@ void TabPrint::build()
|
||||
line.append_option(optgroup->get_option("top_fill_pattern"));
|
||||
line.append_option(optgroup->get_option("bottom_fill_pattern"));
|
||||
optgroup->append_line(line);
|
||||
optgroup->append_single_option_line("solid_fill_pattern");
|
||||
optgroup = page->new_optgroup(_(L("Reducing printing time")));
|
||||
optgroup->append_single_option_line("infill_every_layers");
|
||||
optgroup->append_single_option_line("infill_only_where_needed");
|
||||
@ -1330,20 +1331,25 @@ void TabPrint::update()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!str_fill_pattern.empty()){
|
||||
if (!str_fill_pattern.empty()) {
|
||||
bool correct_100p_fill = false;
|
||||
const std::vector<std::string> top_fill_pattern = m_config->def()->get("top_fill_pattern")->enum_values;
|
||||
bool correct_100p_fill = false;
|
||||
for (const std::string &fill : top_fill_pattern)
|
||||
{
|
||||
if (str_fill_pattern == fill)
|
||||
correct_100p_fill = true;
|
||||
}
|
||||
const std::vector<std::string> bottom_fill_pattern = m_config->def()->get("bottom_fill_pattern")->enum_values;
|
||||
for (const std::string &fill : bottom_fill_pattern)
|
||||
{
|
||||
if (str_fill_pattern.compare(fill) == 0)
|
||||
correct_100p_fill = true;
|
||||
}
|
||||
}
|
||||
const std::vector<std::string> bottom_fill_pattern = m_config->def()->get("bottom_fill_pattern")->enum_values;
|
||||
for (const std::string &fill : bottom_fill_pattern) {
|
||||
if (str_fill_pattern.compare(fill) == 0)
|
||||
correct_100p_fill = true;
|
||||
}
|
||||
//note: supermerill : i don't understand this but i copy-paste
|
||||
const std::vector<std::string> solid_fill_pattern = m_config->def()->get("solid_fill_pattern")->enum_values;
|
||||
for (const std::string &fill : solid_fill_pattern) {
|
||||
if (str_fill_pattern.compare(fill) == 0)
|
||||
correct_100p_fill = true;
|
||||
}
|
||||
// get fill_pattern name from enum_labels for using this one at dialog_msg
|
||||
str_fill_pattern = m_config->def()->get("fill_pattern")->enum_labels[fill_pattern];
|
||||
if (!correct_100p_fill) {
|
||||
@ -1373,9 +1379,9 @@ void TabPrint::update()
|
||||
for (auto el : { "thin_walls_min_width", "thin_walls_overlap" }) get_field(el)->toggle(m_config->opt_bool("thin_walls"));
|
||||
get_field("perimeter_loop_seam")->toggle(m_config->opt_bool("perimeter_loop"));
|
||||
|
||||
bool have_no_perimeter_unsupported = have_perimeters && m_config->opt_bool("no_perimeter_unsupported");
|
||||
for (auto el : { "min_perimeter_unsupported", "noperi_bridge_only" })
|
||||
get_field(el)->toggle(have_no_perimeter_unsupported);
|
||||
//bool have_no_perimeter_unsupported = have_perimeters && m_config->opt_bool("no_perimeter_unsupported");
|
||||
//for (auto el : { "min_perimeter_unsupported", "noperi_bridge_only" })
|
||||
// get_field(el)->toggle(have_no_perimeter_unsupported);
|
||||
|
||||
|
||||
bool have_infill = m_config->option<ConfigOptionPercent>("fill_density")->value > 0;
|
||||
@ -1393,8 +1399,8 @@ 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 : {"top_fill_pattern", "bottom_fill_pattern", "enforce_full_fill_volume", "external_infill_margin", "infill_first",
|
||||
"solid_infill_extruder", "solid_infill_extrusion_width", "solid_infill_speed" })
|
||||
for (auto el : { "top_fill_pattern", "bottom_fill_pattern", "solid_fill_pattern", "enforce_full_fill_volume", "external_infill_margin",
|
||||
"infill_first", "solid_infill_extruder", "solid_infill_extrusion_width", "solid_infill_speed" })
|
||||
get_field(el)->toggle(have_solid_infill);
|
||||
|
||||
for (auto el : {"fill_angle", "bridge_angle", "infill_extrusion_width",
|
||||
|
Loading…
x
Reference in New Issue
Block a user