Skip to content

Commit

Permalink
CURA-12335 Handle flooring settings on the same basis as roofing (#2202)
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAholic authored Feb 14, 2025
2 parents f387023 + 6984670 commit eb0d2d7
Show file tree
Hide file tree
Showing 15 changed files with 336 additions and 104 deletions.
20 changes: 16 additions & 4 deletions include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ class FffGcodeWriter : public NoCopy
TimeKeeper::RegisteredTimes stages_times;
};

struct RoofingFlooringSettingsNames
{
std::string extruder_nr;
std::string pattern;
std::string monotonic;
};

static const RoofingFlooringSettingsNames roofing_settings_names;
static const RoofingFlooringSettingsNames flooring_settings_names;

/*!
* \brief Set the FffGcodeWriter::fan_speed_layer_time_settings by
* retrieving all settings from the global/per-meshgroup settings.
Expand Down Expand Up @@ -501,7 +511,7 @@ class FffGcodeWriter : public NoCopy
const SkinPart& skin_part) const;

/*!
* Add the roofing which is the area inside the innermost skin inset which has air 'directly' above
* Add the roofing/flooring which is the area inside the innermost skin inset which has air 'directly' above or below
*
* \param[in] storage where the slice data is stored.
* \param gcode_layer The initial planning of the gcode of the layer.
Expand All @@ -511,13 +521,15 @@ class FffGcodeWriter : public NoCopy
* \param skin_part The skin part for which to create gcode
* \param[out] added_something Whether this function added anything to the layer plan
*/
void processRoofing(
void processRoofingFlooring(
const SliceDataStorage& storage,
LayerPlan& gcode_layer,
const SliceMeshStorage& mesh,
const size_t extruder_nr,
const MeshPathConfigs& mesh_config,
const SkinPart& skin_part,
const RoofingFlooringSettingsNames& settings_names,
const Shape& fill,
const GCodePathConfig& config,
const std::vector<AngleDegrees>& angles,
bool& added_something) const;

/*!
Expand Down
4 changes: 4 additions & 0 deletions include/InsetOrderOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class InsetOrderOptimizer
const GCodePathConfig& inset_X_default_config,
const GCodePathConfig& inset_0_roofing_config,
const GCodePathConfig& inset_X_roofing_config,
const GCodePathConfig& inset_0_flooring_config,
const GCodePathConfig& inset_X_flooring_config,
const GCodePathConfig& inset_0_bridge_config,
const GCodePathConfig& inset_X_bridge_config,
const bool retract_before_outer_wall,
Expand Down Expand Up @@ -101,6 +103,8 @@ class InsetOrderOptimizer
const GCodePathConfig& inset_X_default_config_;
const GCodePathConfig& inset_0_roofing_config_;
const GCodePathConfig& inset_X_roofing_config_;
const GCodePathConfig& inset_0_flooring_config_;
const GCodePathConfig& inset_X_flooring_config_;
const GCodePathConfig& inset_0_bridge_config_;
const GCodePathConfig& inset_X_bridge_config_;
const bool retract_before_outer_wall_;
Expand Down
27 changes: 24 additions & 3 deletions include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ class LayerPlan : public NoCopy
std::vector<OverhangMask> overhang_masks_; //!< The regions of a layer part where the walls overhang, calculated for multiple overhang angles. The latter is the most
//!< overhanging. For a visual explanation of the result, see doc/gradual_overhang_speed.svg
Shape seam_overhang_mask_; //!< The regions of a layer part where the walls overhang, specifically as defined for the seam

Shape roofing_mask_; //!< The regions of a layer part where the walls are exposed to the air above
Shape flooring_mask_; //!< The regions of a layer part where the walls are exposed to the air below

bool currently_overhanging_{ false }; //!< Indicates whether the last extrusion move was overhanging
coord_t current_overhang_length_{ 0 }; //!< When doing consecutive overhanging moves, this is the current accumulated overhanging length
coord_t max_overhang_length_{ 0 }; //!< From all consecutive overhanging moves in the layer, this is the longest one

Shape roofing_mask_; //!< The regions of a layer part where the walls are exposed to the air

bool min_layer_time_used = false; //!< Wether or not the minimum layer time (cool_min_layer_time) was actually used in this layerplan.

const std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder_;
Expand Down Expand Up @@ -331,6 +333,13 @@ class LayerPlan : public NoCopy
*/
void setRoofingMask(const Shape& polys);

/*!
* Set flooring_mask.
*
* \param shape The areas of the part currently being processed that will require flooring.
*/
void setFlooringMask(const Shape& shape);

/*!
* Travel to a certain point, with all of the procedures necessary to do so.
*
Expand Down Expand Up @@ -495,6 +504,8 @@ class LayerPlan : public NoCopy
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param flooring_config The config with which to print the wall lines
* that are exposed to air below.
* \param bridge_config The config with which to print the wall lines that
* are spanning a bridge.
* \param flow The ratio with which to multiply the extrusion amount.
Expand All @@ -513,6 +524,7 @@ class LayerPlan : public NoCopy
const Settings& settings,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& flooring_config,
const GCodePathConfig& bridge_config,
double flow,
const Ratio width_factor,
Expand All @@ -530,6 +542,8 @@ class LayerPlan : public NoCopy
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param flooring_config The config with which to print the wall lines
* that are exposed to air below.
* \param wall_0_wipe_dist The distance to travel along the wall after it
* has been laid down, in order to wipe the start and end of the wall
* \param flow_ratio The ratio with which to multiply the extrusion amount.
Expand All @@ -542,6 +556,7 @@ class LayerPlan : public NoCopy
const Settings& settings,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& flooring_config,
const GCodePathConfig& bridge_config,
coord_t wall_0_wipe_dist,
double flow_ratio,
Expand All @@ -556,6 +571,8 @@ class LayerPlan : public NoCopy
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* \param flooring_config The config with which to print the wall lines
* that are exposed to air below.
* \param bridge_config The config with which to print the wall lines that
* are spanning a bridge
* \param wall_0_wipe_dist The distance to travel along the wall after it
Expand All @@ -576,6 +593,7 @@ class LayerPlan : public NoCopy
const Settings& settings,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& flooring_config,
const GCodePathConfig& bridge_config,
coord_t wall_0_wipe_dist,
double flow_ratio,
Expand All @@ -601,7 +619,9 @@ class LayerPlan : public NoCopy
* \param default_config The config with which to print the wall lines
* that are not spanning a bridge or are exposed to air.
* \param roofing_config The config with which to print the wall lines
* that are exposed to air.
* that are exposed to air above.
* \param flooring_config The config with which to print the wall lines
* that are exposed to air below.
* \param bridge_config The config with which to print the wall lines that are spanning a bridge
* \param z_seam_config Optional configuration for z-seam
* \param wall_0_wipe_dist The distance to travel along each wall after it has been laid down, in order to wipe the start and end of the wall together
Expand All @@ -614,6 +634,7 @@ class LayerPlan : public NoCopy
const Settings& settings,
const GCodePathConfig& default_config,
const GCodePathConfig& roofing_config,
const GCodePathConfig& flooring_config,
const GCodePathConfig& bridge_config,
const ZSeamConfig& z_seam_config = ZSeamConfig(),
coord_t wall_0_wipe_dist = 0,
Expand Down
3 changes: 3 additions & 0 deletions include/settings/MeshPathConfigs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ struct MeshPathConfigs
GCodePathConfig insetX_config{};
GCodePathConfig inset0_roofing_config{};
GCodePathConfig insetX_roofing_config{};
GCodePathConfig inset0_flooring_config{};
GCodePathConfig insetX_flooring_config{};
GCodePathConfig bridge_inset0_config{};
GCodePathConfig bridge_insetX_config{};
GCodePathConfig skin_config{};
GCodePathConfig bridge_skin_config{}; // used for first bridge layer
GCodePathConfig bridge_skin_config2{}; // used for second bridge layer
GCodePathConfig bridge_skin_config3{}; // used for third bridge layer
GCodePathConfig roofing_config{};
GCodePathConfig flooring_config{};
std::vector<GCodePathConfig> infill_config{};
GCodePathConfig ironing_config{};

Expand Down
13 changes: 8 additions & 5 deletions include/skin.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#ifndef SKIN_H
#define SKIN_H

#include <optional>

#include "settings/types/LayerIndex.h"
#include "utils/Coord_t.h"

Expand Down Expand Up @@ -127,12 +129,12 @@ class SkinInfillAreaComputation
void generateInfill(SliceLayerPart& part);

/*!
* Remove the areas which are 'directly' under air from the \ref SkinPart::inner_infill and
* save them in the \ref SkinPart::roofing_fill of the \p part.
* Remove the areas which are 'directly' under/over air from the \ref SkinPart::inner_infill and
* save them in the \ref SkinPart::roofing_fill and \ref SkinPart::flooring_fill of the \p part.
*
* \param[in,out] part Where to get the SkinParts to get the outline info from and to store the roofing areas
* \param[in,out] part Where to get the SkinParts to get the outline info from and to store the roofing/flooring areas
*/
void generateRoofingFillAndSkinFill(SliceLayerPart& part);
void generateSkinRoofingFlooringFill(SliceLayerPart& part);

/*!
* Generate the top and bottom-most surfaces of the given \p part, i.e. the surfaces that have nothing above or below
Expand All @@ -152,8 +154,9 @@ class SkinInfillAreaComputation
*
* \param part Where to get the SkinParts to get the outline info from
* \param flooring_layer_count The number of layers below the layer which we are looking into
* \return The area that contains mesh parts below, or nullopt if the build plate is below, which actually means everything is considered supported
*/
Shape generateFilledAreaBelow(SliceLayerPart& part, size_t flooring_layer_count);
std::optional<Shape> generateFilledAreaBelow(SliceLayerPart& part, size_t flooring_layer_count);

protected:
LayerIndex layer_nr_; //!< The index of the layer for which to generate the skins and infill.
Expand Down
2 changes: 2 additions & 0 deletions include/sliceDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SkinPart
//!< roofing and non-roofing.
Shape skin_fill; //!< The part of the skin which is not roofing.
Shape roofing_fill; //!< The inner infill which has air directly above
Shape flooring_fill; //!< The inner infill which has air directly below
};

/*!
Expand Down Expand Up @@ -309,6 +310,7 @@ class SliceMeshStorage

std::vector<AngleDegrees> infill_angles; //!< a list of angle values which is cycled through to determine the infill angle of each layer
std::vector<AngleDegrees> roofing_angles; //!< a list of angle values which is cycled through to determine the roofing angle of each layer
std::vector<AngleDegrees> flooring_angles; //!< a list of angle values which is cycled through to determine the flooring angle of each layer
std::vector<AngleDegrees> skin_angles; //!< a list of angle values which is cycled through to determine the skin angle of each layer
std::vector<Shape> overhang_areas; //!< For each layer the areas that are classified as overhang on this mesh.
std::vector<Shape> full_overhang_areas; //!< For each layer the full overhang without the tangent of the overhang angle removed, such that the overhang area adjoins the
Expand Down
Loading

0 comments on commit eb0d2d7

Please sign in to comment.