add new option for shifted inner seams

This commit is contained in:
PavelMikus 2022-08-18 13:10:40 +02:00
parent 3a132c0cb8
commit 1c2c9fd5d9
6 changed files with 16 additions and 8 deletions

View File

@ -1605,16 +1605,16 @@ void SeamPlacer::place_seam(const Layer *layer, ExtrusionLoop &loop, bool extern
Vec2f final_pos = perimeter_point.position.head<2>() + depth * dir_to_middle;
projected_point = loop.get_closest_path_and_point(Point::new_scale(final_pos.x(), final_pos.y()), false);
} else { // not concave angle, in that case the nearest point is the good candidate
// but for staggering, we also need to recompute depth of the inner perimter, because in convex corners, the distance is larger than layer width
// but for shifting, we also need to recompute depth of the inner perimter, because in convex corners, the distance is larger than layer width
// we want the perpendicular depth, not distance to nearest point
depth = depth * beta_angle / 1.4142;
}
seam_point = projected_point.foot_pt;
//lastly, for internal perimeters, do the staggering if needed
if (po->config().seam_position == spRandom || po->config().seam_position == spAligned) {
//Staggering
//lastly, for internal perimeters, do the shifting if needed
if (po->config().shifted_inner_seams) {
//shifting
//fix depth, it is sometimes strongly underestimated
depth = std::max(loop.paths[projected_point.path_idx].width, depth)+ 0.3*loop.paths[projected_point.path_idx].width;
Vec2f current_pos = unscale(seam_point).cast<float>();
@ -1632,8 +1632,8 @@ void SeamPlacer::place_seam(const Layer *layer, ExtrusionLoop &loop, bool extern
next_pos = unscale(loop.paths[projected_point.path_idx].polyline.points[projected_point.segment_idx]).cast<float>();
dir_to_next = (next_pos - current_pos).normalized();
}
Vec2f staggered_pos = current_pos + depth * dir_to_next;
seam_point = Point::new_scale(staggered_pos.x(), staggered_pos.y());
Vec2f shifted_pos = current_pos + depth * dir_to_next;
seam_point = Point::new_scale(shifted_pos.x(), shifted_pos.y());
}
}

View File

@ -421,7 +421,7 @@ static std::vector<std::string> s_Preset_print_options {
"layer_height", "first_layer_height", "perimeters", "spiral_vase", "slice_closing_radius", "slicing_mode",
"top_solid_layers", "top_solid_min_thickness", "bottom_solid_layers", "bottom_solid_min_thickness",
"extra_perimeters", "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","shifted_inner_seams", "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",
"ironing", "ironing_type", "ironing_flowrate", "ironing_speed", "ironing_spacing",

View File

@ -2243,6 +2243,12 @@ void PrintConfigDef::init_fff_params()
def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<SeamPosition>(spAligned));
def = this->add("shifted_inner_seams", coBool);
def->label = L("Shifted inner seams");
def->tooltip = L("This option causes the inner seams to be shifted based on their depth, forming a zigzag pattern.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
#if 0
def = this->add("seam_preferred_direction", coFloat);
// def->gui_type = ConfigOptionDef::GUIType::slider;

View File

@ -486,6 +486,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, raft_first_layer_expansion))
((ConfigOptionInt, raft_layers))
((ConfigOptionEnum<SeamPosition>, seam_position))
((ConfigOptionBool, shifted_inner_seams))
// ((ConfigOptionFloat, seam_preferred_direction))
// ((ConfigOptionFloat, seam_preferred_direction_jitter))
((ConfigOptionFloat, slice_closing_radius))

View File

@ -219,7 +219,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
{
bool have_perimeters = config->opt_int("perimeters") > 0;
for (auto el : { "extra_perimeters", "ensure_vertical_shell_thickness", "thin_walls", "overhangs",
"seam_position", "external_perimeters_first", "external_perimeter_extrusion_width",
"seam_position","shifted_inner_seams", "external_perimeters_first", "external_perimeter_extrusion_width",
"perimeter_speed", "small_perimeter_speed", "external_perimeter_speed" })
toggle_field(el, have_perimeters);

View File

@ -1490,6 +1490,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("seam_position", category_path + "seam-position");
optgroup->append_single_option_line("shifted_inner_seams", category_path + "shifted-inner-seams");
optgroup->append_single_option_line("external_perimeters_first", category_path + "external-perimeters-first");
optgroup->append_single_option_line("gap_fill_enabled", category_path + "fill-gaps");
optgroup->append_single_option_line("perimeter_generator");