Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/CURA-12250_refactor-the-post-pro…
Browse files Browse the repository at this point in the history
…cessing-like-algorithms' into CURA-12250_refactor-the-post-processing-like-algorithms
  • Loading branch information
wawanbreton committed Dec 9, 2024
2 parents 5d3d530 + 32a2be2 commit d5b56d5
Showing 1 changed file with 59 additions and 67 deletions.
126 changes: 59 additions & 67 deletions src/settings/PathConfigStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,50 +43,45 @@ PathConfigStorage::PathConfigStorage(const SliceDataStorage& storage, const Laye
, support_roof_train(Application::getInstance().current_slice_->scene.extruders[support_roof_extruder_nr])
, support_bottom_train(Application::getInstance().current_slice_->scene.extruders[support_bottom_extruder_nr])
, line_width_factor_per_extruder(PathConfigStorage::getLineWidthFactorPerExtruder(layer_nr))
, raft_base_config(
GCodePathConfig{ .type = PrintFeatureType::SupportInterface,
.line_width = raft_base_train.settings_.get<coord_t>("raft_base_line_width"),
.layer_thickness = raft_base_train.settings_.get<coord_t>("raft_base_thickness"),
.flow = raft_base_train.settings_.get<Ratio>("raft_base_flow"),
.speed_derivatives = SpeedDerivatives{ .speed = raft_base_train.settings_.get<Velocity>("raft_base_speed"),
.acceleration = raft_base_train.settings_.get<Acceleration>("raft_base_acceleration"),
.jerk = raft_base_train.settings_.get<Velocity>("raft_base_jerk") } })
, raft_interface_config(
GCodePathConfig{ .type = PrintFeatureType::Support,
.line_width = raft_interface_train.settings_.get<coord_t>("raft_interface_line_width"),
.layer_thickness = raft_interface_train.settings_.get<coord_t>("raft_interface_thickness"),
.flow = raft_base_train.settings_.get<Ratio>("raft_interface_flow"),
.speed_derivatives = SpeedDerivatives{ .speed = raft_interface_train.settings_.get<Velocity>("raft_interface_speed"),
.acceleration = raft_interface_train.settings_.get<Acceleration>("raft_interface_acceleration"),
.jerk = raft_interface_train.settings_.get<Velocity>("raft_interface_jerk") } })
, raft_surface_config(
GCodePathConfig{ .type = PrintFeatureType::SupportInterface,
.line_width = raft_surface_train.settings_.get<coord_t>("raft_surface_line_width"),
.layer_thickness = raft_surface_train.settings_.get<coord_t>("raft_surface_thickness"),
.flow = raft_base_train.settings_.get<Ratio>("raft_surface_flow"),
.speed_derivatives = SpeedDerivatives{ .speed = raft_surface_train.settings_.get<Velocity>("raft_surface_speed"),
.acceleration = raft_surface_train.settings_.get<Acceleration>("raft_surface_acceleration"),
.jerk = raft_surface_train.settings_.get<Velocity>("raft_surface_jerk") } })
, support_roof_config(
GCodePathConfig{ .type = PrintFeatureType::SupportInterface,
.line_width
= static_cast<coord_t>(support_roof_train.settings_.get<coord_t>("support_roof_line_width") * line_width_factor_per_extruder[support_roof_extruder_nr]),
.layer_thickness = layer_thickness,
.flow = support_roof_train.settings_.get<Ratio>("support_roof_material_flow")
* ((layer_nr == 0) ? support_roof_train.settings_.get<Ratio>("material_flow_layer_0") : Ratio(1.0)),
.speed_derivatives = { .speed = support_roof_train.settings_.get<Velocity>("speed_support_roof"),
.acceleration = support_roof_train.settings_.get<Acceleration>("acceleration_support_roof"),
.jerk = support_roof_train.settings_.get<Velocity>("jerk_support_roof") } })
, support_bottom_config(
GCodePathConfig{ .type = PrintFeatureType::SupportInterface,
.line_width = static_cast<coord_t>(
support_bottom_train.settings_.get<coord_t>("support_bottom_line_width") * line_width_factor_per_extruder[support_bottom_extruder_nr]),
.layer_thickness = layer_thickness,
.flow = support_roof_train.settings_.get<Ratio>("support_bottom_material_flow")
* ((layer_nr == 0) ? support_roof_train.settings_.get<Ratio>("material_flow_layer_0") : Ratio(1.0)),
.speed_derivatives = SpeedDerivatives{ .speed = support_bottom_train.settings_.get<Velocity>("speed_support_bottom"),
.acceleration = support_bottom_train.settings_.get<Acceleration>("acceleration_support_bottom"),
.jerk = support_bottom_train.settings_.get<Velocity>("jerk_support_bottom") } })
, raft_base_config(GCodePathConfig{ .type = PrintFeatureType::SupportInterface,
.line_width = raft_base_train.settings_.get<coord_t>("raft_base_line_width"),
.layer_thickness = raft_base_train.settings_.get<coord_t>("raft_base_thickness"),
.flow = raft_base_train.settings_.get<Ratio>("raft_base_flow"),
.speed_derivatives = SpeedDerivatives{ .speed = raft_base_train.settings_.get<Velocity>("raft_base_speed"),
.acceleration = raft_base_train.settings_.get<Acceleration>("raft_base_acceleration"),
.jerk = raft_base_train.settings_.get<Velocity>("raft_base_jerk") } })
, raft_interface_config(GCodePathConfig{ .type = PrintFeatureType::Support,
.line_width = raft_interface_train.settings_.get<coord_t>("raft_interface_line_width"),
.layer_thickness = raft_interface_train.settings_.get<coord_t>("raft_interface_thickness"),
.flow = raft_base_train.settings_.get<Ratio>("raft_interface_flow"),
.speed_derivatives = SpeedDerivatives{ .speed = raft_interface_train.settings_.get<Velocity>("raft_interface_speed"),
.acceleration = raft_interface_train.settings_.get<Acceleration>("raft_interface_acceleration"),
.jerk = raft_interface_train.settings_.get<Velocity>("raft_interface_jerk") } })
, raft_surface_config(GCodePathConfig{ .type = PrintFeatureType::SupportInterface,
.line_width = raft_surface_train.settings_.get<coord_t>("raft_surface_line_width"),
.layer_thickness = raft_surface_train.settings_.get<coord_t>("raft_surface_thickness"),
.flow = raft_base_train.settings_.get<Ratio>("raft_surface_flow"),
.speed_derivatives = SpeedDerivatives{ .speed = raft_surface_train.settings_.get<Velocity>("raft_surface_speed"),
.acceleration = raft_surface_train.settings_.get<Acceleration>("raft_surface_acceleration"),
.jerk = raft_surface_train.settings_.get<Velocity>("raft_surface_jerk") } })
, support_roof_config(GCodePathConfig{
.type = PrintFeatureType::SupportInterface,
.line_width = static_cast<coord_t>(support_roof_train.settings_.get<coord_t>("support_roof_line_width") * line_width_factor_per_extruder[support_roof_extruder_nr]),
.layer_thickness = layer_thickness,
.flow = support_roof_train.settings_.get<Ratio>("support_roof_material_flow")
* ((layer_nr == 0) ? support_roof_train.settings_.get<Ratio>("material_flow_layer_0") : Ratio(1.0)),
.speed_derivatives = { .speed = support_roof_train.settings_.get<Velocity>("speed_support_roof"),
.acceleration = support_roof_train.settings_.get<Acceleration>("acceleration_support_roof"),
.jerk = support_roof_train.settings_.get<Velocity>("jerk_support_roof") } })
, support_bottom_config(GCodePathConfig{
.type = PrintFeatureType::SupportInterface,
.line_width = static_cast<coord_t>(support_bottom_train.settings_.get<coord_t>("support_bottom_line_width") * line_width_factor_per_extruder[support_bottom_extruder_nr]),
.layer_thickness = layer_thickness,
.flow = support_roof_train.settings_.get<Ratio>("support_bottom_material_flow")
* ((layer_nr == 0) ? support_roof_train.settings_.get<Ratio>("material_flow_layer_0") : Ratio(1.0)),
.speed_derivatives = SpeedDerivatives{ .speed = support_bottom_train.settings_.get<Velocity>("speed_support_bottom"),
.acceleration = support_bottom_train.settings_.get<Acceleration>("acceleration_support_bottom"),
.jerk = support_bottom_train.settings_.get<Velocity>("jerk_support_bottom") } })
{
const size_t extruder_count = Application::getInstance().current_slice_->scene.extruders.size();
travel_config_per_extruder.reserve(extruder_count);
Expand All @@ -96,14 +91,13 @@ PathConfigStorage::PathConfigStorage(const SliceDataStorage& storage, const Laye
for (size_t extruder_nr = 0; extruder_nr < extruder_count; extruder_nr++)
{
const ExtruderTrain& train = Application::getInstance().current_slice_->scene.extruders[extruder_nr];
travel_config_per_extruder.emplace_back(
GCodePathConfig{ .type = PrintFeatureType::MoveCombing,
.line_width = 0,
.layer_thickness = 0,
.flow = 0.0,
.speed_derivatives = SpeedDerivatives{ .speed = train.settings_.get<Velocity>("speed_travel"),
.acceleration = train.settings_.get<Acceleration>("acceleration_travel"),
.jerk = train.settings_.get<Velocity>("jerk_travel") } });
travel_config_per_extruder.emplace_back(GCodePathConfig{ .type = PrintFeatureType::MoveCombing,
.line_width = 0,
.layer_thickness = 0,
.flow = 0.0,
.speed_derivatives = SpeedDerivatives{ .speed = train.settings_.get<Velocity>("speed_travel"),
.acceleration = train.settings_.get<Acceleration>("acceleration_travel"),
.jerk = train.settings_.get<Velocity>("jerk_travel") } });
skirt_brim_config_per_extruder.emplace_back(
GCodePathConfig{ .type = PrintFeatureType::SkirtBrim,
.line_width = static_cast<coord_t>(
Expand All @@ -117,17 +111,16 @@ PathConfigStorage::PathConfigStorage(const SliceDataStorage& storage, const Laye
.speed_derivatives = SpeedDerivatives{ .speed = train.settings_.get<Velocity>("skirt_brim_speed"),
.acceleration = train.settings_.get<Acceleration>("acceleration_skirt_brim"),
.jerk = train.settings_.get<Velocity>("jerk_skirt_brim") } });
prime_tower_config_per_extruder.emplace_back(
GCodePathConfig{
.type = PrintFeatureType::PrimeTower,
.line_width = static_cast<coord_t>(
train.settings_.get<coord_t>("prime_tower_line_width")
* ((mesh_group_settings.get<EPlatformAdhesion>("adhesion_type") == EPlatformAdhesion::RAFT) ? 1.0_r : line_width_factor_per_extruder[extruder_nr])),
.layer_thickness = layer_thickness,
.flow = train.settings_.get<Ratio>("prime_tower_flow") * ((layer_nr == 0) ? train.settings_.get<Ratio>("material_flow_layer_0") : Ratio(1.0)),
.speed_derivatives = SpeedDerivatives{ .speed = train.settings_.get<Velocity>("speed_prime_tower"),
.acceleration = train.settings_.get<Acceleration>("acceleration_prime_tower"),
.jerk = train.settings_.get<Velocity>("jerk_prime_tower") } });
prime_tower_config_per_extruder.emplace_back(GCodePathConfig{
.type = PrintFeatureType::PrimeTower,
.line_width = static_cast<coord_t>(
train.settings_.get<coord_t>("prime_tower_line_width")
* ((mesh_group_settings.get<EPlatformAdhesion>("adhesion_type") == EPlatformAdhesion::RAFT) ? 1.0_r : line_width_factor_per_extruder[extruder_nr])),
.layer_thickness = layer_thickness,
.flow = train.settings_.get<Ratio>("prime_tower_flow") * ((layer_nr == 0) ? train.settings_.get<Ratio>("material_flow_layer_0") : Ratio(1.0)),
.speed_derivatives = SpeedDerivatives{ .speed = train.settings_.get<Velocity>("speed_prime_tower"),
.acceleration = train.settings_.get<Acceleration>("acceleration_prime_tower"),
.jerk = train.settings_.get<Velocity>("jerk_prime_tower") } });
}

mesh_configs.reserve(storage.meshes.size());
Expand Down Expand Up @@ -193,10 +186,9 @@ void PathConfigStorage::handleInitialLayerSpeedup(const SliceDataStorage& storag
global_first_layer_config_per_extruder.reserve(Application::getInstance().current_slice_->scene.extruders.size());
for (const ExtruderTrain& extruder : Application::getInstance().current_slice_->scene.extruders)
{
global_first_layer_config_per_extruder.emplace_back(
SpeedDerivatives{ .speed = extruder.settings_.get<Velocity>("speed_print_layer_0"),
.acceleration = extruder.settings_.get<Acceleration>("acceleration_print_layer_0"),
.jerk = extruder.settings_.get<Velocity>("jerk_print_layer_0") });
global_first_layer_config_per_extruder.emplace_back(SpeedDerivatives{ .speed = extruder.settings_.get<Velocity>("speed_print_layer_0"),
.acceleration = extruder.settings_.get<Acceleration>("acceleration_print_layer_0"),
.jerk = extruder.settings_.get<Velocity>("jerk_print_layer_0") });
}

{ // support
Expand Down

0 comments on commit d5b56d5

Please sign in to comment.