Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specify wall directions #4156

Merged
merged 4 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libslic3r/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void Layer::make_perimeters()
&& config.detect_overhang_wall == other_config.detect_overhang_wall
&& config.overhang_reverse == other_config.overhang_reverse
&& config.overhang_reverse_threshold == other_config.overhang_reverse_threshold
&& config.wall_direction == other_config.wall_direction
Noisyfox marked this conversation as resolved.
Show resolved Hide resolved
&& config.opt_serialize("inner_wall_line_width") == other_config.opt_serialize("inner_wall_line_width")
&& config.opt_serialize("outer_wall_line_width") == other_config.opt_serialize("outer_wall_line_width")
&& config.detect_thin_wall == other_config.detect_thin_wall
Expand Down
27 changes: 24 additions & 3 deletions src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class PerimeterGeneratorLoop {
// Polygon of this contour.
Polygon polygon;
// Is it a contour or a hole?
// Contours are CCW oriented, holes are CW oriented.
bool is_contour;
// BBS: is perimeter using smaller width
bool is_smaller_width_perimeter;
Expand Down Expand Up @@ -1732,8 +1731,19 @@ 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::Default) {
// Skip steep overhang detection if wall direction 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);
reorient_perimeters(entities, steep_overhang_contour, steep_overhang_hole, this->config->overhang_reverse_internal_only);
// 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) {
reorient_perimeters(entities, steep_overhang_contour, steep_overhang_hole,
// Reverse internal only if the wall direction is default
this->config->overhang_reverse_internal_only && wall_direction == WallDirection::Default);
}

// if brim will be printed, reverse the order of perimeters so that
// we continue inwards after having finished the brim
Expand Down Expand Up @@ -2521,8 +2531,19 @@ 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::Default) {
// Skip steep overhang detection if wall direction 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()) {
reorient_perimeters(extrusion_coll, steep_overhang_contour, steep_overhang_hole, this->config->overhang_reverse_internal_only);
// 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) {
reorient_perimeters(extrusion_coll, steep_overhang_contour, steep_overhang_hole,
// Reverse internal only if the wall direction is default
this->config->overhang_reverse_internal_only && wall_direction == WallDirection::Default);
}
this->loops->append(extrusion_coll);
}

Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ bool Preset::has_cali_lines(PresetBundle* preset_bundle)
static std::vector<std::string> s_Preset_print_options {
"layer_height", "initial_layer_print_height", "wall_loops", "alternate_extra_wall", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "slicing_mode",
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness","reduce_wall_solid_infill", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness","reduce_wall_solid_infill", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction",
"seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction", "counterbole_hole_bridging",
"minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","gap_fill_target",
Expand Down
22 changes: 22 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ static t_config_enum_values s_keys_map_WallSequence {
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WallSequence)

//Orca
static t_config_enum_values s_keys_map_WallDirection{
{ "default", int(WallDirection::Default) },
Noisyfox marked this conversation as resolved.
Show resolved Hide resolved
{ "ccw", int(WallDirection::CounterClockwise) },
{ "cw", int(WallDirection::Clockwise)},
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(WallDirection)

//BBS
static t_config_enum_values s_keys_map_PrintSequence {
{ "by layer", int(PrintSequence::ByLayer) },
Expand Down Expand Up @@ -1485,6 +1493,20 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool{false});

def = this->add("wall_direction", coEnum);
def->label = L("Wall loop direction");
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 odd is enabled. Set this to any option other than Default will force the wall direction regardless of the Reverse on odd.\n\nThis option will be disabled if sprial vase mode is enabled.");
def->enum_keys_map = &ConfigOptionEnum<WallDirection>::get_enum_values();
def->enum_values.push_back("default");
def->enum_values.push_back("ccw");
def->enum_values.push_back("cw");
def->enum_labels.push_back(L("Default"));
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::Default));

def = this->add("extruder", coInt);
def->gui_type = ConfigOptionDef::GUIType::i_enum_open;
def->label = L("Extruder");
Expand Down
11 changes: 11 additions & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ enum class WallSequence {
InnerOuterInner,
Count,
};

// Orca
enum class WallDirection
{
Default,
CounterClockwise,
Clockwise,
Count,
};

//BBS
enum class PrintSequence {
ByLayer,
Expand Down Expand Up @@ -932,6 +942,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionEnum<WallSequence>, wall_sequence))
((ConfigOptionBool, is_infill_first))
((ConfigOptionBool, small_area_infill_flow_compensation))
((ConfigOptionEnum<WallDirection>, wall_direction))
)

PRINT_CONFIG_CLASS_DEFINE(
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "overhang_reverse"
|| opt_key == "overhang_reverse_internal_only"
|| opt_key == "overhang_reverse_threshold"
|| opt_key == "wall_direction"
//BBS
|| opt_key == "enable_overhang_speed"
|| opt_key == "detect_thin_wall"
Expand Down
7 changes: 6 additions & 1 deletion src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ 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::Default &&
config->opt_enum<TimelapseType>("timelapse_type") == TimelapseType::tlTraditional))
{
wxString msg_text = _(L("Spiral mode only works when wall loops is 1, support is disabled, top shell layers is 0, sparse infill density is 0 and timelapse type is traditional."));
Expand Down Expand Up @@ -306,6 +307,7 @@ 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::Default));
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
sparse_infill_density = 0;
timelapse_type = TimelapseType::tlTraditional;
Expand Down Expand Up @@ -554,6 +556,8 @@ 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 @@ -732,7 +736,8 @@ 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 allow_overhang_reverse = has_detect_overhang_wall && !has_spiral_vase;
bool force_wall_direction = config->opt_enum<WallDirection>("wall_direction") != WallDirection::Default;
bool allow_overhang_reverse = has_detect_overhang_wall && !has_spiral_vase && !force_wall_direction;
toggle_field("overhang_reverse", allow_overhang_reverse);
toggle_line("overhang_reverse_threshold", allow_overhang_reverse && has_overhang_reverse);
toggle_line("overhang_reverse_internal_only", allow_overhang_reverse && has_overhang_reverse);
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Walls and surfaces"), L"param_advanced");
optgroup->append_single_option_line("wall_sequence");
optgroup->append_single_option_line("is_infill_first");
optgroup->append_single_option_line("wall_direction");
optgroup->append_single_option_line("print_flow_ratio");
optgroup->append_single_option_line("top_solid_infill_flow_ratio");
optgroup->append_single_option_line("bottom_solid_infill_flow_ratio");
Expand Down
Loading