New inner-outer-inner/infill mode

This commit is contained in:
SoftFever 2022-11-20 11:22:35 +08:00
parent ff2cf17a73
commit e022c5ad5b
6 changed files with 25 additions and 13 deletions

View file

@ -5519,6 +5519,9 @@ msgstr "内圈墙/外圈墙/填充的打印顺序"
msgid "inner/outer/infill"
msgstr "内墙/外墙/填充"
msgid "inner-outer-inner/infill"
msgstr "内墙/外墙/内墙/填充"
msgid "outer/inner/infill"
msgstr "外墙/内墙/填充"

Binary file not shown.

View file

@ -3304,7 +3304,8 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
if (!m_config.spiral_mode && description == "perimeter") {
assert(m_layer != nullptr);
bool is_outer_wall_first = m_config.wall_infill_order == WallInfillOrder::OuterInnerInfill
|| m_config.wall_infill_order == WallInfillOrder::InfillOuterInner;
|| m_config.wall_infill_order == WallInfillOrder::InfillOuterInner
|| m_config.wall_infill_order == WallInfillOrder::InnerOuterInnerInfill;
m_seam_placer.place_seam(m_layer, loop, is_outer_wall_first, this->last_pos());
} else
loop.split_at(last_pos, false);

View file

@ -673,26 +673,30 @@ void PerimeterGenerator::process()
// TODO: add test for perimeter order
bool is_outer_wall_first =
this->print_config->wall_infill_order == WallInfillOrder::OuterInnerInfill ||
this->print_config->wall_infill_order == WallInfillOrder::InfillOuterInner;
this->print_config->wall_infill_order == WallInfillOrder::InfillOuterInner ||
this->print_config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill;
if (is_outer_wall_first ||
//BBS: always print outer wall first when there indeed has brim.
(this->layer_id == 0 &&
this->object_config->brim_type == BrimType::btOuterOnly &&
this->object_config->brim_width.value > 0))
{
//entities.reverse();
if (entities.entities.size() > 1) {
std::vector<int> extPs;
for (int i = 0; i < entities.entities.size(); ++i) {
if (entities.entities[i]->role() == erExternalPerimeter)
extPs.push_back(i);
}
for (int i = 0; i < extPs.size(); ++i) {
if (extPs[i] == 0 || extPs[i] - 1 == extPs[i - 1])
continue;
std::swap(entities.entities[extPs[i]], entities.entities[extPs[i] - 1]);
if (this->print_config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill) {
if (entities.entities.size() > 1) {
std::vector<int> extPs;
for (int i = 0; i < entities.entities.size(); ++i) {
if (entities.entities[i]->role() == erExternalPerimeter)
extPs.push_back(i);
}
for (int i = 0; i < extPs.size(); ++i) {
if (extPs[i] == 0 || (i > 0 && extPs[i] - 1 == extPs[i - 1]))
continue;
std::swap(entities.entities[extPs[i]], entities.entities[extPs[i] - 1]);
}
}
}
else
entities.reverse();
}
// append perimeters for this slice as a collection
if (! entities.empty())

View file

@ -159,6 +159,7 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(IroningType)
static t_config_enum_values s_keys_map_WallInfillOrder {
{ "inner wall/outer wall/infill", int(WallInfillOrder::InnerOuterInfill) },
{ "outer wall/inner wall/infill", int(WallInfillOrder::OuterInnerInfill) },
{ "inner-outer-inner wall/infill", int(WallInfillOrder::InnerOuterInnerInfill) },
{ "infill/inner wall/outer wall", int(WallInfillOrder::InfillInnerOuter) },
{ "infill/outer wall/inner wall", int(WallInfillOrder::InfillOuterInner) }
};
@ -1000,10 +1001,12 @@ void PrintConfigDef::init_fff_params()
def->enum_values.push_back("outer wall/inner wall/infill");
def->enum_values.push_back("infill/inner wall/outer wall");
def->enum_values.push_back("infill/outer wall/inner wall");
def->enum_values.push_back("inner-outer-inner wall/infill");
def->enum_labels.push_back(L("inner/outer/infill"));
def->enum_labels.push_back(L("outer/inner/infill"));
def->enum_labels.push_back(L("infill/inner/outer"));
def->enum_labels.push_back(L("infill/outer/inner"));
def->enum_labels.push_back(L("inner-outer-inner/infill"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<WallInfillOrder>(WallInfillOrder::InnerOuterInfill));

View file

@ -75,6 +75,7 @@ enum class WallInfillOrder {
OuterInnerInfill,
InfillInnerOuter,
InfillOuterInner,
InnerOuterInnerInfill,
Count,
};
//BBS