Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions include/SupportInfillPart.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ struct SupportInfillPart
std::optional<Shape> base_inside_contour_; //!< If an inside base is generated, contains the inner contour
AABB outline_boundary_box_; //!< The boundary box for the infill area
coord_t support_line_width_; //!< The support line width
int inset_count_to_generate_; //!< The number of insets need to be generated from the outline. This is not the actual insets that will be generated.
coord_t inset_width_to_generate_; //!< The width of insets need to be generated from the outline. This is not the actual insets that will be generated.
std::vector<std::vector<Shape>> infill_area_per_combine_per_density_; //!< a list of separated sub-areas which requires different infill densities and combined thicknesses
// for infill_areas[x][n], x means the density level and n means the thickness
std::vector<VariableWidthLines> wall_toolpaths_; //!< Any walls go here, not in the areas, where they could be combined vertically (don't combine walls). Binned by inset_idx.

coord_t custom_line_distance_; //!< The distance between support infill lines. 0 means use the default line distance instead.
bool use_fractional_config_; //!< Request to use the configuration used to fill a partial layer height here, instead of the normal full layer height configuration.

SupportInfillPart(const SingleShape& outline, coord_t support_line_width, bool use_fractional_config, int inset_count_to_generate = 0, coord_t custom_line_distance = 0);
SupportInfillPart(const SingleShape& outline, coord_t support_line_width, bool use_fractional_config, coord_t inset_width_to_generate = 0, coord_t custom_line_distance = 0);

const Shape& getInfillArea() const;
};

} // namespace cura
Expand Down
7 changes: 6 additions & 1 deletion include/TreeSupport.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) 2021 Ultimaker B.V.
// Copyright (c) 2026 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher.

#ifndef TREESUPPORT_H
#define TREESUPPORT_H

#include <utility>

#include "TreeModelVolumes.h"
#include "TreeSupportBaseCircle.h"
#include "TreeSupportElement.h"
Expand All @@ -15,6 +17,7 @@
#include "settings/EnumSettings.h"
#include "sliceDataStorage.h"
#include "utils/Coord_t.h"
#include "utils/SparsePointGridInclusive.h"

namespace cura
{
Expand Down Expand Up @@ -291,6 +294,7 @@ class TreeSupport

void filterFloatingLines(std::vector<Shape>& support_layer_storage);

using CenterGrid = std::vector<std::unique_ptr<SparsePointGridInclusive<std::pair<coord_t, float>>>>;
/*!
* \brief Generates Support Floor, ensures Support Roof can not cut of branches, and saves the branches as support to storage
*
Expand All @@ -302,6 +306,7 @@ class TreeSupport
std::vector<Shape>& support_layer_storage,
std::vector<Shape>& support_roof_storage,
std::vector<Shape>& support_layer_storage_fractional,
const CenterGrid& center_locator_per_layer,
SliceDataStorage& storage);

/*!
Expand Down
37 changes: 31 additions & 6 deletions include/TreeSupportSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ struct TreeSupportSettings
, support_roof_line_width(mesh_group_settings.get<coord_t>("support_roof_line_width"))
, support_line_distance(mesh_group_settings.get<coord_t>("support_line_distance"))
, support_bottom_offset(mesh_group_settings.get<coord_t>("support_bottom_offset"))
, support_wall_count(mesh_group_settings.get<int>("support_wall_count"))
, support_wall_thickness(mesh_group_settings.get<coord_t>("support_wall_thickness"))
, support_enlarged_wall_thickness(mesh_group_settings.get<coord_t>("support_enlarged_wall_thickness"))
, support_roof_wall_count(mesh_group_settings.get<int>("support_roof_wall_count"))
, zig_zaggify_support(mesh_group_settings.get<bool>("zig_zaggify_support"))
, maximum_deviation(mesh_group_settings.get<coord_t>("meshfix_maximum_deviation"))
Expand All @@ -82,6 +83,9 @@ struct TreeSupportSettings
, min_feature_size(mesh_group_settings.get<coord_t>("min_feature_size"))
, min_wall_line_width(settings.get<coord_t>("min_wall_line_width"))
, fill_outline_gaps(settings.get<bool>("fill_outline_gaps"))
, support_wall_thickness_bottom_layers(settings.get<int>("support_wall_thickness_bottom_layers"))
, support_wall_thickness_top_layers(settings.get<int>("support_wall_thickness_top_layers"))
, support_wall_thickness_layer_smooth(settings.get<int>("support_wall_thickness_layer_smooth"))
, simplifier(Simplify(mesh_group_settings))
{
layer_start_bp_radius = (bp_radius - branch_radius) / (branch_radius * diameter_scale_bp_radius);
Expand Down Expand Up @@ -313,9 +317,14 @@ struct TreeSupportSettings
coord_t support_bottom_offset;

/*!
* \brief Amount of walls the support area will have.
* \brief Nominal width of walls the support area will have (see also below).
*/
int support_wall_count;
coord_t support_wall_thickness;

/*!
* \brief Width of walls the support areas that need to be sturdier will have.
*/
coord_t support_enlarged_wall_thickness;

/*!
* \brief Amount of walls the support roof area will have.
Expand Down Expand Up @@ -383,6 +392,21 @@ struct TreeSupportSettings
*/
bool fill_outline_gaps;

/*!
* \brief The number of lines from the build-plate at which the nominal line-width switches to the enlarged line-width. (But see also support_line_width_layer_smooth.)
*/
coord_t support_wall_thickness_bottom_layers;

/*!
* \brief The number of lines from the top of the support at which the nominal line-width switches to the enlarged line-width. (But see also support_line_width_layer_smooth.)
*/
coord_t support_wall_thickness_top_layers;

/*!
* \brief The number of lines that can be used to smooth out the transition from the nominal line-width to the enlarged line-width.
*/
coord_t support_wall_thickness_layer_smooth;

/*!
* \brief Simplifier to simplify polygons.
*/
Expand All @@ -402,8 +426,8 @@ struct TreeSupportSettings
&& support_line_width == other.support_line_width && support_overrides == other.support_overrides && support_line_distance == other.support_line_distance
&& support_roof_line_width == other.support_roof_line_width
&& // can not be set on a per-mesh basis currently, so code to enable processing different roof line width in the same iteration seems useless.
support_bottom_offset == other.support_bottom_offset && support_wall_count == other.support_wall_count && support_pattern == other.support_pattern
&& roof_pattern == other.roof_pattern
support_bottom_offset == other.support_bottom_offset && support_wall_thickness == other.support_wall_thickness
&& support_enlarged_wall_thickness == other.support_enlarged_wall_thickness && support_pattern == other.support_pattern && roof_pattern == other.roof_pattern
&& // can not be set on a per-mesh basis currently, so code to enable processing different roof patterns in the same iteration seems useless.
support_roof_angles == other.support_roof_angles && support_infill_angles == other.support_infill_angles
&& increase_radius_until_radius == other.increase_radius_until_radius && support_bottom_layers == other.support_bottom_layers && layer_height == other.layer_height
Expand All @@ -412,7 +436,8 @@ struct TreeSupportSettings
&& zag_skip_count == other.zag_skip_count && connect_zigzags == other.connect_zigzags && interface_preference == other.interface_preference
&& min_feature_size == other.min_feature_size && // interface_preference should be identical to ensure the tree will correctly interact with the roof.
support_rest_preference == other.support_rest_preference && max_radius == other.max_radius && min_wall_line_width == other.min_wall_line_width
&& fill_outline_gaps == other.fill_outline_gaps &&
&& fill_outline_gaps == other.fill_outline_gaps && support_wall_thickness_bottom_layers == other.support_wall_thickness_bottom_layers
&& support_wall_thickness_top_layers == other.support_wall_thickness_top_layers && support_wall_thickness_layer_smooth == other.support_wall_thickness_layer_smooth &&
// The infill class now wants the settings object and reads a lot of settings, and as the infill class is used to calculate support roof lines for
// interface-preference. Not all of these may be required to be identical, but as I am not sure, better safe than sorry
(interface_preference == InterfacePreference::INTERFACE_AREA_OVERWRITES_SUPPORT || interface_preference == InterfacePreference::SUPPORT_AREA_OVERWRITES_INTERFACE
Expand Down
2 changes: 1 addition & 1 deletion include/TreeSupportUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class TreeSupportUtils
constexpr coord_t support_roof_overlap = 0;
constexpr size_t infill_multiplier = 1;
const int support_shift = roof ? 0 : support_infill_distance / 2;
const size_t wall_line_count = include_walls ? (! roof ? config.support_wall_count : config.support_roof_wall_count) : 0;
const size_t wall_line_count = include_walls ? (! roof ? config.support_wall_thickness : config.support_roof_wall_count) : 0;
constexpr coord_t narrow_area_width = 0;
const Point2LL infill_origin;
constexpr bool skip_stitching = false;
Expand Down
14 changes: 7 additions & 7 deletions include/infill.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Infill
coord_t shift_{}; //!< shift of the scanlines in the direction perpendicular to the fill_angle
coord_t max_resolution_{}; //!< Min feature size of the output
coord_t max_deviation_{}; //!< Max deviation fro the original poly when enforcing max_resolution
size_t wall_line_count_{}; //!< Number of walls to generate at the boundary of the infill region, spaced \ref infill_line_width apart
coord_t wall_thickness_{}; //!< Thickness of walls to generate at the boundary of the infill region
coord_t small_area_width_{}; //!< Maximum width of a small infill region to be filled with walls
Point2LL infill_origin_{}; //!< origin of the infill pattern
bool skip_line_stitching_{ false }; //!< Whether to bypass the line stitching normally performed for polyline type infills
Expand Down Expand Up @@ -116,7 +116,7 @@ class Infill
coord_t shift,
coord_t max_resolution,
coord_t max_deviation,
size_t wall_line_count,
std::variant<size_t, coord_t> walls,
coord_t small_area_width,
Point2LL infill_origin,
bool skip_line_stitching) noexcept
Expand All @@ -133,7 +133,7 @@ class Infill
, shift_{ shift }
, max_resolution_{ max_resolution }
, max_deviation_{ max_deviation }
, wall_line_count_{ wall_line_count }
, wall_thickness_{ std::holds_alternative<coord_t>(walls) ? std::get<coord_t>(walls) : static_cast<coord_t>(std::get<size_t>(walls) * infill_line_width) }
, small_area_width_{ small_area_width }
, infill_origin_{ infill_origin }
, skip_line_stitching_{ skip_line_stitching }
Expand All @@ -154,7 +154,7 @@ class Infill
coord_t shift,
coord_t max_resolution,
coord_t max_deviation,
size_t wall_line_count,
std::variant<size_t, coord_t> walls,
coord_t small_area_width,
Point2LL infill_origin,
bool skip_line_stitching,
Expand All @@ -177,7 +177,7 @@ class Infill
, shift_{ shift }
, max_resolution_{ max_resolution }
, max_deviation_{ max_deviation }
, wall_line_count_{ wall_line_count }
, wall_thickness_{ std::holds_alternative<coord_t>(walls) ? std::get<coord_t>(walls) : static_cast<coord_t>(std::get<size_t>(walls) * infill_line_width) }
, small_area_width_{ small_area_width }
, infill_origin_{ infill_origin }
, skip_line_stitching_{ skip_line_stitching }
Expand Down Expand Up @@ -229,7 +229,7 @@ class Infill
*
* \param toolpaths [out] The generated toolpaths. Binned by inset_idx.
* \param outer_contour [in] the outer contour
* \param wall_line_count [in] The number of walls that needs to be generated
* \param wall_thickness [in] The thickness of walls that needs to be generated
* \param line_width [in] The optimum wall line width of the walls
* \param settings [in] A settings storage to use for generating variable-width walls.
* \param generator The generator to use for outer "walls"
Expand All @@ -238,7 +238,7 @@ class Infill
static Shape generateWallToolPaths(
std::vector<VariableWidthLines>& toolpaths,
const Shape& outer_contour,
const size_t wall_line_count,
const coord_t wall_thickness,
const coord_t line_width,
const Settings& settings,
int layer_idx,
Expand Down
8 changes: 4 additions & 4 deletions include/infill/LightningGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LightningGenerator // "Just like Nicola used to make!"
* Generate the lightning infill for the given areas with the given settings
* @param layer_thickness The actual layer thickness
* @param line_width The extrusion line width
* @param wall_line_count The number of external walls in the infill areas
* @param wall_thickness The thickness of external walls in the infill areas
* @param line_distance The base "line distance", which represents the density of the infill
* @param overhang_angle The angle at which we consider overhanging areas
* @param prune_angle The angle of the generated lines overhang
Expand All @@ -82,7 +82,7 @@ class LightningGenerator // "Just like Nicola used to make!"
void generate(
const coord_t layer_thickness,
const coord_t line_width,
const coord_t wall_line_count,
const coord_t wall_thickness,
const coord_t line_distance,
const AngleRadians& overhang_angle,
const AngleRadians& prune_angle,
Expand All @@ -97,12 +97,12 @@ class LightningGenerator // "Just like Nicola used to make!"
* only when support is generated. For this pattern, we also need to
* generate overhang areas for the inside of the model.
*/
void generateInitialInternalOverhangs(const coord_t infill_line_width, const coord_t infill_wall_line_count, const std::vector<Shape>& areas_per_layer);
void generateInitialInternalOverhangs(const coord_t infill_wall_thickness, const std::vector<Shape>& areas_per_layer);

/*!
* Calculate the tree structure of all layers.
*/
void generateTrees(const coord_t infill_line_width, const coord_t infill_wall_line_count, const std::vector<Shape>& areas_per_layer);
void generateTrees(const coord_t infill_wall_thickness, const std::vector<Shape>& areas_per_layer);

/*!
* How far each piece of infill can support skin in the layer above.
Expand Down
10 changes: 5 additions & 5 deletions include/sliceDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,22 @@ class SupportLayer
* \param area The support polygon to fill up with infill parts.
* \param support_fill_per_layer The support polygons to fill up with infill parts.
* \param support_line_width Line width of the support extrusions.
* \param wall_line_count Wall-line count around the fill.
* \param wall_thickness Wall-line thickness around the fill.
* \param use_fractional_config (optional, default to false) If the area should be added as fractional support.
* \param unionAll (optional, default to false) Wether to 'union all' for the split into parts bit.
* \param custom_line_distance (optional, default to 0) Distance between lines of the infill pattern. custom_line_distance of 0 means use the default instead.
*/
void fillInfillParts(
const Shape& area,
const coord_t support_line_width,
const coord_t wall_line_count,
const coord_t wall_thickness,
const bool use_fractional_config = false,
const bool unionAll = false,
const coord_t custom_line_distance = 0)
{
for (const SingleShape& island_outline : area.splitIntoParts(unionAll))
{
support_infill_parts.emplace_back(island_outline, support_line_width, use_fractional_config, wall_line_count, custom_line_distance);
support_infill_parts.emplace_back(island_outline, support_line_width, use_fractional_config, wall_thickness, custom_line_distance);
}
}

Expand All @@ -263,7 +263,7 @@ class SupportLayer
* \param infill_layer_height The layer height of the support-fill.
* \param meshes The model meshes to be supported, needed here to handle fractional support layer height.
* \param support_line_width Line width of the support extrusions.
* \param wall_line_count Wall-line count around the fill.
* \param wall_thickness Wall-line thickness around the fill.
* \param grow_layer_above (optional, default to 0) In cases where support shrinks per layer up, an appropriate offset may be nescesary.
* \param unionAll (optional, default to false) Wether to 'union all' for the split into parts bit.
* \param custom_line_distance (optional, default to 0) Distance between lines of the infill pattern. custom_line_distance of 0 means use the default instead.
Expand All @@ -274,7 +274,7 @@ class SupportLayer
const coord_t infill_layer_height,
const std::vector<std::shared_ptr<SliceMeshStorage>>& meshes,
const coord_t support_line_width,
const coord_t wall_line_count,
const coord_t wall_thickness,
const coord_t grow_layer_above = 0,
const bool unionAll = false,
const coord_t custom_line_distance = 0);
Expand Down
8 changes: 4 additions & 4 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3629,7 +3629,7 @@ bool FffGcodeWriter::processSupportInfill(const SliceDataStorage& storage, Layer
infill_density_multiplier = infill_extruder.settings_.get<size_t>("support_infill_density_multiplier_initial_layer");
}

const size_t wall_line_count = infill_extruder.settings_.get<size_t>("support_wall_count");
const size_t wall_thickness = infill_extruder.settings_.get<size_t>("support_wall_thickness");
const coord_t max_resolution = infill_extruder.settings_.get<coord_t>("meshfix_maximum_resolution");
const coord_t max_deviation = infill_extruder.settings_.get<coord_t>("meshfix_maximum_deviation");
coord_t default_support_line_width = infill_extruder.settings_.get<coord_t>("support_line_width");
Expand Down Expand Up @@ -3679,7 +3679,7 @@ bool FffGcodeWriter::processSupportInfill(const SliceDataStorage& storage, Layer
const auto& configs = part.use_fractional_config_ ? gcode_layer.configs_storage_.support_fractional_infill_config : gcode_layer.configs_storage_.support_infill_config;

// always process the wall overlap if walls are generated
const int current_support_infill_overlap = (part.inset_count_to_generate_ > 0) ? default_support_infill_overlap : 0;
const int current_support_infill_overlap = (part.inset_width_to_generate_ > 0) ? default_support_infill_overlap : 0;

// The support infill walls were generated separately, first. Always add them, regardless of how many densities we have.
std::vector<VariableWidthLines> wall_toolpaths = part.wall_toolpaths_;
Expand Down Expand Up @@ -3787,7 +3787,7 @@ bool FffGcodeWriter::processSupportInfill(const SliceDataStorage& storage, Layer
area,
support_line_width,
support_line_distance_here,
current_support_infill_overlap - (density_idx == max_density_idx ? 0 : wall_line_count * support_line_width),
current_support_infill_overlap - (density_idx == max_density_idx ? 0 : wall_thickness),
infill_multiplier,
support_infill_angle,
gcode_layer.z_ + configs[combine_idx].z_offset,
Expand Down Expand Up @@ -3890,7 +3890,7 @@ bool FffGcodeWriter::processSupportInfill(const SliceDataStorage& storage, Layer

// If we're printing with a support wall, that support wall generates gap filling as well.
// If not, the pattern may still generate gap filling (if it's connected infill or zigzag). We still want to print those.
if (wall_line_count == 0 || ! wall_toolpaths_here.empty())
if (wall_thickness == 0 || ! wall_toolpaths_here.empty())
{
const GCodePathConfig& config = configs[0];
constexpr coord_t wipe_dist = 0;
Expand Down
Loading
Loading