Skip to content

Commit

Permalink
Remove "auto" wall direction
Browse files Browse the repository at this point in the history
  • Loading branch information
vovodroid committed Jan 10, 2025
1 parent e315586 commit 14eea1d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 28 deletions.
7 changes: 5 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4574,7 +4574,10 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou

if (m_config.spiral_mode && !is_hole) {
// if spiral vase, we have to ensure that all contour are in the same orientation.
loop.make_counter_clockwise();
if (m_config.wall_direction == WallDirection::CounterClockwise)
loop.make_counter_clockwise();
else
loop.make_clockwise();
}
if (loop.loop_role() == elrSkirt && (this->m_layer->id() % 2 == 1))
loop.reverse();
Expand Down Expand Up @@ -4635,7 +4638,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
// 1 - the currently printed external perimeter and 2 - the neighbouring internal perimeter.
if (m_config.wipe_before_external_loop.value && !paths.empty() && paths.front().size() > 1 && paths.back().size() > 1 && paths.front().role() == erExternalPerimeter && region_perimeters.size() > 1) {
const bool is_full_loop_ccw = loop.polygon().is_counter_clockwise();
bool is_hole_loop = (loop.loop_role() & ExtrusionLoopRole::elrHole) != 0; // loop.make_counter_clockwise();
bool is_hole_loop = (loop.loop_role() & ExtrusionLoopRole::elrHole) != 0;
const double nozzle_diam = nozzle_diameter;

// note: previous & next are inverted to extrude "in the opposite direction, and we are "rewinding"
Expand Down
31 changes: 17 additions & 14 deletions src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,10 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
ExtrusionLoop *eloop = static_cast<ExtrusionLoop*>(coll.entities[idx.first]);
coll.entities[idx.first] = nullptr;

eloop->make_counter_clockwise();
if (perimeter_generator.config->wall_direction == WallDirection::CounterClockwise)
eloop->make_counter_clockwise();
else
eloop->make_clockwise();
eloop->inset_idx = loop.depth;
if (loop.is_contour) {
out.append(std::move(children.entities));
Expand Down Expand Up @@ -1243,7 +1246,10 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p
if (!paths.empty()) {
if (extrusion.is_closed) {
ExtrusionLoop extrusion_loop(std::move(paths), pg_extrusion.is_contour() ? elrDefault : elrHole);
extrusion_loop.make_counter_clockwise();
if (perimeter_generator.config->wall_direction == WallDirection::CounterClockwise)
extrusion_loop.make_counter_clockwise();
else
extrusion_loop.make_clockwise();
// TODO: it seems in practice that ExtrusionLoops occasionally have significantly disconnected paths,
// triggering the asserts below. Is this a problem?
for (auto it = std::next(extrusion_loop.paths.begin()); it != extrusion_loop.paths.end(); ++it) {
Expand Down Expand Up @@ -1832,7 +1838,7 @@ static void reorient_perimeters(ExtrusionEntityCollection &entities, bool steep_
}

if (need_reverse && !isExternal) {
eloop->make_clockwise();
eloop->reverse();
}
}
}
Expand Down Expand Up @@ -2313,18 +2319,16 @@ void PerimeterGenerator::process_arachne()

bool steep_overhang_contour = false;
bool steep_overhang_hole = false;
const WallDirection wall_direction = config->wall_direction;
if (wall_direction != WallDirection::Auto) {
// Skip steep overhang detection if wall direction is specified
if (!config->overhang_reverse) {
// Skip steep overhang detection if no reverse is specified
steep_overhang_contour = true;
steep_overhang_hole = true;
}
if (ExtrusionEntityCollection extrusion_coll = traverse_extrusions(*this, ordered_extrusions, steep_overhang_contour, steep_overhang_hole); !extrusion_coll.empty()) {
// All walls are counter-clockwise initially, so we don't need to reorient it if that's what we want
if (wall_direction != WallDirection::CounterClockwise) {
if (config->overhang_reverse) {
reorient_perimeters(extrusion_coll, steep_overhang_contour, steep_overhang_hole,
// Reverse internal only if the wall direction is auto
this->config->overhang_reverse_internal_only && wall_direction == WallDirection::Auto);
this->config->overhang_reverse_internal_only);
}
this->loops->append(extrusion_coll);
}
Expand Down Expand Up @@ -2692,18 +2696,17 @@ void PerimeterGenerator::process_classic()
// at this point, all loops should be in contours[0]
bool steep_overhang_contour = false;
bool steep_overhang_hole = false;
const WallDirection wall_direction = config->wall_direction;
if (wall_direction != WallDirection::Auto) {
// Skip steep overhang detection if wall direction is specified
if (!config->overhang_reverse) {
// Skip steep overhang detection if no reverse is specified
steep_overhang_contour = true;
steep_overhang_hole = true;
}
ExtrusionEntityCollection entities = traverse_loops(*this, contours.front(), thin_walls, steep_overhang_contour, steep_overhang_hole);
// All walls are counter-clockwise initially, so we don't need to reorient it if that's what we want
if (wall_direction != WallDirection::CounterClockwise) {
if (config->overhang_reverse) {
reorient_perimeters(entities, steep_overhang_contour, steep_overhang_hole,
// Reverse internal only if the wall direction is auto
this->config->overhang_reverse_internal_only && wall_direction == WallDirection::Auto);
this->config->overhang_reverse_internal_only);
}

// if brim will be printed, reverse the order of perimeters so that
Expand Down
8 changes: 4 additions & 4 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WallSequence)

//Orca
static t_config_enum_values s_keys_map_WallDirection{
{ "auto", int(WallDirection::Auto) },
{ "ccw", int(WallDirection::CounterClockwise) },
{ "cw", int(WallDirection::Clockwise)},
};
Expand Down Expand Up @@ -1613,14 +1612,12 @@ void PrintConfigDef::init_fff_params()
def->category = L("Quality");
def->tooltip = L("The direction which the wall loops are extruded when looking down from the top.\n\nBy default all walls are extruded in counter-clockwise, unless Reverse on even is enabled. Set this to any option other than Auto will force the wall direction regardless of the Reverse on even.\n\nThis option will be disabled if spiral vase mode is enabled.");
def->enum_keys_map = &ConfigOptionEnum<WallDirection>::get_enum_values();
def->enum_values.push_back("auto");
def->enum_values.push_back("ccw");
def->enum_values.push_back("cw");
def->enum_labels.push_back(L("Auto"));
def->enum_labels.push_back(L("Counter clockwise"));
def->enum_labels.push_back(L("Clockwise"));
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<WallDirection>(WallDirection::Auto));
def->set_default_value(new ConfigOptionEnum<WallDirection>(WallDirection::CounterClockwise));

def = this->add("extruder", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
Expand Down Expand Up @@ -6285,6 +6282,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
else if(opt_key == "counterbole_hole_bridging") {
opt_key = "counterbore_hole_bridging";
}
else if (opt_key == "wall_direction" && value == "auto") {
value = "ccw";
}
else if (opt_key == "draft_shield" && value == "limited") {
value = "disabled";
} else if (opt_key == "overhang_speed_classic") {
Expand Down
1 change: 0 additions & 1 deletion src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ enum class WallSequence {
// Orca
enum class WallDirection
{
Auto,
CounterClockwise,
Clockwise,
Count,
Expand Down
7 changes: 1 addition & 6 deletions src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
config->opt_int("enforce_support_layers") == 0 &&
! config->opt_bool("detect_thin_wall") &&
! config->opt_bool("overhang_reverse") &&
config->opt_enum<WallDirection>("wall_direction") == WallDirection::Auto &&
config->opt_enum<TimelapseType>("timelapse_type") == TimelapseType::tlTraditional))
{
DynamicPrintConfig new_conf = *config;
Expand All @@ -307,7 +306,6 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
new_conf.set_key_value("enforce_support_layers", new ConfigOptionInt(0));
new_conf.set_key_value("detect_thin_wall", new ConfigOptionBool(false));
new_conf.set_key_value("overhang_reverse", new ConfigOptionBool(false));
new_conf.set_key_value("wall_direction", new ConfigOptionEnum<WallDirection>(WallDirection::Auto));
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
sparse_infill_density = 0;
timelapse_type = TimelapseType::tlTraditional;
Expand Down Expand Up @@ -541,8 +539,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_field("top_shell_thickness", ! has_spiral_vase && has_top_solid_infill);
toggle_field("bottom_shell_thickness", ! has_spiral_vase && has_bottom_solid_infill);

toggle_field("wall_direction", !has_spiral_vase);

// Gap fill is newly allowed in between perimeter lines even for empty infill (see GH #1476).
toggle_field("gap_infill_speed", have_perimeters);

Expand Down Expand Up @@ -736,8 +732,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co

bool has_detect_overhang_wall = config->opt_bool("detect_overhang_wall");
bool has_overhang_reverse = config->opt_bool("overhang_reverse");
bool force_wall_direction = config->opt_enum<WallDirection>("wall_direction") != WallDirection::Auto;
bool allow_overhang_reverse = !has_spiral_vase && !force_wall_direction;
bool allow_overhang_reverse = !has_spiral_vase;
toggle_field("overhang_reverse", allow_overhang_reverse);
toggle_field("overhang_reverse_threshold", has_detect_overhang_wall);
toggle_line("overhang_reverse_threshold", allow_overhang_reverse && has_overhang_reverse);
Expand Down
1 change: 0 additions & 1 deletion src/slic3r/GUI/PartPlate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,6 @@ void PartPlate::set_vase_mode_related_object_config(int obj_id) {
new_conf.set_key_value("detect_thin_wall", new ConfigOptionBool(false));
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
new_conf.set_key_value("overhang_reverse", new ConfigOptionBool(false));
new_conf.set_key_value("wall_direction", new ConfigOptionEnum<WallDirection>(WallDirection::Auto));
auto applying_keys = global_config->diff(new_conf);

for (ModelObject* object : obj_ptrs) {
Expand Down

0 comments on commit 14eea1d

Please sign in to comment.