Infill direction enhancements (#5267)

* infill direction wip

* rotate solid infill dir
This commit is contained in:
SoftFever 2024-05-05 13:36:54 +08:00 committed by GitHub
parent c2e19b65a8
commit c2f5660afd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 47 additions and 10 deletions

View file

@ -18,6 +18,7 @@
#include "../PrintConfig.hpp" #include "../PrintConfig.hpp"
#include "../Surface.hpp" #include "../Surface.hpp"
#include "ExtrusionEntity.hpp"
#include "FillBase.hpp" #include "FillBase.hpp"
#include "FillRectilinear.hpp" #include "FillRectilinear.hpp"
#include "FillLightning.hpp" #include "FillLightning.hpp"
@ -40,6 +41,7 @@ struct SurfaceFillParams
coordf_t overlap = 0.; coordf_t overlap = 0.;
// Angle as provided by the region config, in radians. // Angle as provided by the region config, in radians.
float angle = 0.f; float angle = 0.f;
bool rotate_angle = true;
// Is bridging used for this fill? Bridging parameters may be used even if this->flow.bridge() is not set. // Is bridging used for this fill? Bridging parameters may be used even if this->flow.bridge() is not set.
bool bridge; bool bridge;
// Non-negative for a bridge. // Non-negative for a bridge.
@ -83,6 +85,7 @@ struct SurfaceFillParams
RETURN_COMPARE_NON_EQUAL(spacing); RETURN_COMPARE_NON_EQUAL(spacing);
RETURN_COMPARE_NON_EQUAL(overlap); RETURN_COMPARE_NON_EQUAL(overlap);
RETURN_COMPARE_NON_EQUAL(angle); RETURN_COMPARE_NON_EQUAL(angle);
RETURN_COMPARE_NON_EQUAL(rotate_angle);
RETURN_COMPARE_NON_EQUAL(density); RETURN_COMPARE_NON_EQUAL(density);
// RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, dont_adjust); // RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, dont_adjust);
RETURN_COMPARE_NON_EQUAL(anchor_length); RETURN_COMPARE_NON_EQUAL(anchor_length);
@ -105,6 +108,7 @@ struct SurfaceFillParams
this->spacing == rhs.spacing && this->spacing == rhs.spacing &&
this->overlap == rhs.overlap && this->overlap == rhs.overlap &&
this->angle == rhs.angle && this->angle == rhs.angle &&
this->rotate_angle == rhs.rotate_angle &&
this->bridge == rhs.bridge && this->bridge == rhs.bridge &&
this->bridge_angle == rhs.bridge_angle && this->bridge_angle == rhs.bridge_angle &&
this->density == rhs.density && this->density == rhs.density &&
@ -491,7 +495,10 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
} }
} }
params.bridge_angle = float(surface.bridge_angle); params.bridge_angle = float(surface.bridge_angle);
params.angle = float(Geometry::deg2rad(region_config.infill_direction.value)); params.angle = float(Geometry::deg2rad(params.extrusion_role == erInternalInfill ?
region_config.infill_direction :
region_config.solid_infill_direction.value));
params.rotate_angle = (params.extrusion_role != erInternalInfill) && region_config.rotate_solid_infill_direction;
// Calculate the actual flow we'll be using for this infill. // Calculate the actual flow we'll be using for this infill.
params.bridge = is_bridge || Fill::use_bridge_flow(params.pattern); params.bridge = is_bridge || Fill::use_bridge_flow(params.pattern);
@ -647,8 +654,9 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
else else
params.pattern = ipRectilinear; params.pattern = ipRectilinear;
params.density = 100.f; params.density = 100.f;
params.extrusion_role = erInternalInfill; params.extrusion_role = erSolidInfill;
params.angle = float(Geometry::deg2rad(layerm.region().config().infill_direction.value)); params.angle = float(Geometry::deg2rad(layerm.region().config().solid_infill_direction.value));
params.rotate_angle = layerm.region().config().rotate_solid_infill_direction;
// calculate the actual flow we'll be using for this infill // calculate the actual flow we'll be using for this infill
params.flow = layerm.flow(frSolidInfill); params.flow = layerm.flow(frSolidInfill);
params.spacing = params.flow.spacing(); params.spacing = params.flow.spacing();
@ -752,6 +760,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
f->layer_id = this->id(); f->layer_id = this->id();
f->z = this->print_z; f->z = this->print_z;
f->angle = surface_fill.params.angle; f->angle = surface_fill.params.angle;
f->rotate_angle = surface_fill.params.rotate_angle;
f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree; f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree;
f->print_config = &this->object()->print()->config(); f->print_config = &this->object()->print()->config();
f->print_object_config = &this->object()->config(); f->print_object_config = &this->object()->config();

View file

@ -94,6 +94,8 @@ public:
coordf_t overlap; coordf_t overlap;
// in radians, ccw, 0 = East // in radians, ccw, 0 = East
float angle; float angle;
// Orca: enable angle shifting for layer change
bool rotate_angle{ true };
// In scaled coordinates. Maximum lenght of a perimeter segment connecting two infill lines. // In scaled coordinates. Maximum lenght of a perimeter segment connecting two infill lines.
// Used by the FillRectilinear2, FillGrid2, FillTriangles, FillStars and FillCubic. // Used by the FillRectilinear2, FillGrid2, FillTriangles, FillStars and FillCubic.
// If left to zero, the links will not be limited. // If left to zero, the links will not be limited.
@ -150,6 +152,7 @@ protected:
overlap(0.), overlap(0.),
// Initial angle is undefined. // Initial angle is undefined.
angle(FLT_MAX), angle(FLT_MAX),
rotate_angle(true),
link_max_length(0), link_max_length(0),
loop_clipping(0), loop_clipping(0),
// The initial bounding box is empty, therefore undefined. // The initial bounding box is empty, therefore undefined.
@ -171,7 +174,7 @@ protected:
ExPolygon expolygon, ExPolygon expolygon,
ThickPolylines& thick_polylines_out) {} ThickPolylines& thick_polylines_out) {}
virtual float _layer_angle(size_t idx) const { return (idx & 1) ? float(M_PI/2.) : 0; } virtual float _layer_angle(size_t idx) const { return (rotate_angle && (idx & 1)) ? float(M_PI/2.) : 0; }
virtual std::pair<float, Point> _infill_direction(const Surface *surface) const; virtual std::pair<float, Point> _infill_direction(const Surface *surface) const;

View file

@ -772,7 +772,7 @@ static std::vector<std::string> s_Preset_print_options {
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", "top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness",
"extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "wall_direction", "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "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", "seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
"infill_direction", "counterbore_hole_bridging", "infill_direction", "solid_infill_direction", "rotate_solid_infill_direction", "counterbore_hole_bridging",
"minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","gap_fill_target", "minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","gap_fill_target",
"ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_angle", "ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_angle",
"max_travel_detour_distance", "max_travel_detour_distance",

View file

@ -2009,7 +2009,7 @@ def = this->add("filament_loading_speed", coFloats);
def->cli = ConfigOptionDef::nocli; def->cli = ConfigOptionDef::nocli;
def = this->add("infill_direction", coFloat); def = this->add("infill_direction", coFloat);
def->label = L("Infill direction"); def->label = L("Sparse infill direction");
def->category = L("Strength"); def->category = L("Strength");
def->tooltip = L("Angle for sparse infill pattern, which controls the start or main direction of line"); def->tooltip = L("Angle for sparse infill pattern, which controls the start or main direction of line");
def->sidetext = L("°"); def->sidetext = L("°");
@ -2018,6 +2018,23 @@ def = this->add("filament_loading_speed", coFloats);
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(45)); def->set_default_value(new ConfigOptionFloat(45));
def = this->add("solid_infill_direction", coFloat);
def->label = L("Solid infill direction");
def->category = L("Strength");
def->tooltip = L("Angle for solid infill pattern, which controls the start or main direction of line");
def->sidetext = L("°");
def->min = 0;
def->max = 360;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(45));
def = this->add("rotate_solid_infill_direction", coBool);
def->label = L("Rotate solid infill direction");
def->category = L("Strength");
def->tooltip = L("Rotate the solid infill direction by 90° for each layer.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
def = this->add("sparse_infill_density", coPercent); def = this->add("sparse_infill_density", coPercent);
def->label = L("Sparse infill density"); def->label = L("Sparse infill density");
def->category = L("Strength"); def->category = L("Strength");

View file

@ -882,6 +882,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatOrPercent, outer_wall_line_width)) ((ConfigOptionFloatOrPercent, outer_wall_line_width))
((ConfigOptionFloat, outer_wall_speed)) ((ConfigOptionFloat, outer_wall_speed))
((ConfigOptionFloat, infill_direction)) ((ConfigOptionFloat, infill_direction))
((ConfigOptionFloat, solid_infill_direction))
((ConfigOptionBool, rotate_solid_infill_direction))
((ConfigOptionPercent, sparse_infill_density)) ((ConfigOptionPercent, sparse_infill_density))
((ConfigOptionEnum<InfillPattern>, sparse_infill_pattern)) ((ConfigOptionEnum<InfillPattern>, sparse_infill_pattern))
((ConfigOptionEnum<FuzzySkinType>, fuzzy_skin)) ((ConfigOptionEnum<FuzzySkinType>, fuzzy_skin))

View file

@ -1072,6 +1072,8 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "solid_infill_filament" || opt_key == "solid_infill_filament"
|| opt_key == "sparse_infill_line_width" || opt_key == "sparse_infill_line_width"
|| opt_key == "infill_direction" || opt_key == "infill_direction"
|| opt_key == "solid_infill_direction"
|| opt_key == "rotate_solid_infill_direction"
|| opt_key == "ensure_vertical_shell_thickness" || opt_key == "ensure_vertical_shell_thickness"
|| opt_key == "bridge_angle" || opt_key == "bridge_angle"
//BBS //BBS

View file

@ -550,7 +550,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_field(el, has_solid_infill); toggle_field(el, has_solid_infill);
for (auto el : { "infill_direction", "sparse_infill_line_width", for (auto el : { "infill_direction", "sparse_infill_line_width",
"sparse_infill_speed", "bridge_speed", "internal_bridge_speed", "bridge_angle" }) "sparse_infill_speed", "bridge_speed", "internal_bridge_speed", "bridge_angle","solid_infill_direction", "rotate_solid_infill_direction" })
toggle_field(el, have_infill || has_solid_infill); toggle_field(el, have_infill || has_solid_infill);
toggle_field("top_shell_thickness", ! has_spiral_vase && has_top_solid_infill); toggle_field("top_shell_thickness", ! has_spiral_vase && has_top_solid_infill);

View file

@ -110,7 +110,7 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::PART_CAT
{ L("Strength"), {{"wall_loops", "",1},{"top_shell_layers", L("Top Solid Layers"),1},{"top_shell_thickness", L("Top Minimum Shell Thickness"),1}, { L("Strength"), {{"wall_loops", "",1},{"top_shell_layers", L("Top Solid Layers"),1},{"top_shell_thickness", L("Top Minimum Shell Thickness"),1},
{"bottom_shell_layers", L("Bottom Solid Layers"),1}, {"bottom_shell_thickness", L("Bottom Minimum Shell Thickness"),1}, {"bottom_shell_layers", L("Bottom Solid Layers"),1}, {"bottom_shell_thickness", L("Bottom Minimum Shell Thickness"),1},
{"sparse_infill_density", "",1},{"sparse_infill_pattern", "",1},{"infill_anchor", "",1},{"infill_anchor_max", "",1},{"top_surface_pattern", "",1},{"bottom_surface_pattern", "",1}, {"internal_solid_infill_pattern", "",1}, {"sparse_infill_density", "",1},{"sparse_infill_pattern", "",1},{"infill_anchor", "",1},{"infill_anchor_max", "",1},{"top_surface_pattern", "",1},{"bottom_surface_pattern", "",1}, {"internal_solid_infill_pattern", "",1},
{"infill_combination", "",1}, {"infill_wall_overlap", "",1}, {"infill_direction", "",1}, {"bridge_angle", "",1}, {"minimum_sparse_infill_area", "",1} {"infill_combination", "",1}, {"infill_wall_overlap", "",1}, {"solid_infill_direction", "",1}, {"rotate_solid_infill_direction", "",1}, {"infill_direction", "",1}, {"bridge_angle", "",1}, {"minimum_sparse_infill_area", "",1}
}}, }},
{ L("Speed"), {{"outer_wall_speed", "",1},{"inner_wall_speed", "",2},{"sparse_infill_speed", "",3},{"top_surface_speed", "",4}, {"internal_solid_infill_speed", "",5}, { L("Speed"), {{"outer_wall_speed", "",1},{"inner_wall_speed", "",2},{"sparse_infill_speed", "",3},{"top_surface_speed", "",4}, {"internal_solid_infill_speed", "",5},
{"enable_overhang_speed", "",6}, {"overhang_speed_classic", "",6}, {"overhang_1_4_speed", "",7}, {"overhang_2_4_speed", "",8}, {"overhang_3_4_speed", "",9}, {"overhang_4_4_speed", "",10}, {"enable_overhang_speed", "",6}, {"overhang_speed_classic", "",6}, {"overhang_1_4_speed", "",7}, {"overhang_2_4_speed", "",8}, {"overhang_3_4_speed", "",9}, {"overhang_4_4_speed", "",10},

View file

@ -9533,6 +9533,8 @@ void Plater::calib_flowrate(int pass) {
_obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipMonotonic)); _obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipMonotonic));
_obj->config.set_key_value("top_solid_infill_flow_ratio", new ConfigOptionFloat(1.0f)); _obj->config.set_key_value("top_solid_infill_flow_ratio", new ConfigOptionFloat(1.0f));
_obj->config.set_key_value("infill_direction", new ConfigOptionFloat(45)); _obj->config.set_key_value("infill_direction", new ConfigOptionFloat(45));
_obj->config.set_key_value("solid_infill_direction", new ConfigOptionFloat(135));
_obj->config.set_key_value("rotate_solid_infill_direction", new ConfigOptionBool(true));
_obj->config.set_key_value("ironing_type", new ConfigOptionEnum<IroningType>(IroningType::NoIroning)); _obj->config.set_key_value("ironing_type", new ConfigOptionEnum<IroningType>(IroningType::NoIroning));
_obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloat(internal_solid_speed)); _obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloat(internal_solid_speed));
_obj->config.set_key_value("top_surface_speed", new ConfigOptionFloat(top_surface_speed)); _obj->config.set_key_value("top_surface_speed", new ConfigOptionFloat(top_surface_speed));

View file

@ -2129,6 +2129,8 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); optgroup = page->new_optgroup(L("Advanced"), L"param_advanced");
optgroup->append_single_option_line("infill_wall_overlap"); optgroup->append_single_option_line("infill_wall_overlap");
optgroup->append_single_option_line("infill_direction"); optgroup->append_single_option_line("infill_direction");
optgroup->append_single_option_line("solid_infill_direction");
optgroup->append_single_option_line("rotate_solid_infill_direction");
optgroup->append_single_option_line("bridge_angle"); optgroup->append_single_option_line("bridge_angle");
optgroup->append_single_option_line("minimum_sparse_infill_area"); optgroup->append_single_option_line("minimum_sparse_infill_area");
optgroup->append_single_option_line("infill_combination"); optgroup->append_single_option_line("infill_combination");