Skip to content
Merged
1 change: 1 addition & 0 deletions Cura.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ message PathSegment {
bytes line_width = 5; // The widths of the line segments as bytes of a float array of length 1 or N
bytes line_thickness = 6; // The thickness of the line segments as bytes of a float array of length 1 or N
bytes line_feedrate = 7; // The feedrate of the line segments as bytes of a float array of length 1 or N
repeated uint32 attributes = 8; // Print attributes of each segment, e.g. overhanging or bridging
}


Expand Down
4 changes: 3 additions & 1 deletion include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ class FffGcodeWriter : public NoCopy
* \param[out] added_something Whether this function added anything to the layer plan
* \param fan_speed fan speed override for this skin area
* \param forced_small_area_width A specific value to be used for small_area_width when generating the infill, or nullopt to use the normal value
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void processSkinPrintFeature(
const SliceDataStorage& storage,
Expand All @@ -616,7 +617,8 @@ class FffGcodeWriter : public NoCopy
const bool is_roofing_flooring,
bool& added_something,
double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
std::optional<coord_t> forced_small_area_width = std::nullopt) const;
std::optional<coord_t> forced_small_area_width = std::nullopt,
const PrintSegmentAttributes& print_attributes = {}) const;

/*!
* see if we can avoid printing a lines or zig zag style skin part in multiple segments by moving to
Expand Down
3 changes: 2 additions & 1 deletion include/InsetOrderOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <unordered_set>

#include "PrintSegmentAttributes.h"
#include "settings/ZSeamConfig.h"
#include "sliceDataStorage.h"

Expand Down Expand Up @@ -74,7 +75,7 @@ class InsetOrderOptimizer
* \param retract_before_outer_wall The retraction behavior to be applied when moving to outer walls
* \return Whether anything was added to the layer plan.
*/
bool addToLayer(const RetractBeforeOuterWall retract_before_outer_wall = RetractBeforeOuterWall::AUTOMATIC);
bool addToLayer(const RetractBeforeOuterWall retract_before_outer_wall = RetractBeforeOuterWall::AUTOMATIC, const PrintSegmentAttributes& print_attributes = {});

/*!
* Get the order constraints of the insets when printing walls per region / hole.
Expand Down
41 changes: 32 additions & 9 deletions include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class LayerPlan : public NoCopy
* \param spiralize Whether to gradually increase the z while printing. (Note that this path may be part of a sequence of spiralized paths, forming one polygon)
* \param speed_factor (optional) a factor which the speed will be multiplied by.
* \param travel_to_z Indicates whether we should add a Z travel before the initial move of this path
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
* \return A path with the given config which is now the last path in LayerPlan::paths
*/
GCodePath* getLatestPathWithConfig(
Expand All @@ -202,7 +203,8 @@ class LayerPlan : public NoCopy
const Ratio width_factor = 1.0_r,
const bool spiralize = false,
const Ratio speed_factor = 1.0_r,
const bool travel_to_z = true);
const bool travel_to_z = true,
const PrintSegmentAttributes print_attributes = {});

public:
/*!
Expand Down Expand Up @@ -446,6 +448,7 @@ class LayerPlan : public NoCopy
* (Note that this path may be part of a sequence of spiralized paths,
* forming one polygon.)
* \param fan_speed Fan speed override for this path.
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addExtrusionMove(
const Point3LL& p,
Expand All @@ -456,7 +459,8 @@ class LayerPlan : public NoCopy
const bool spiralize = false,
const Ratio speed_factor = 1.0_r,
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
const bool travel_to_z = true);
const bool travel_to_z = true,
const PrintSegmentAttributes& print_attributes = {});

void addExtrusionMoveWithGradualOverhang(
const Point3LL& p,
Expand All @@ -467,7 +471,8 @@ class LayerPlan : public NoCopy
const bool spiralize = false,
const Ratio speed_factor = 1.0_r,
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
const bool travel_to_z = true);
const bool travel_to_z = true,
const PrintSegmentAttributes& print_attributes = {});

/*!
* Adds an extrusion move that may go through a skin area
Expand All @@ -480,6 +485,7 @@ class LayerPlan : public NoCopy
* @param width_factor The width factor to be used to extruder
* @param spiralize Whether we are extruding using spiralize mode
* @param travel_to_z Whether we should add a Z travel before starting the segment if necessary
* @param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addSkinExtrusion(
const Point3LL& p0,
Expand All @@ -490,7 +496,8 @@ class LayerPlan : public NoCopy
const Ratio& flow,
const Ratio& width_factor,
const bool spiralize,
const bool travel_to_z);
const bool travel_to_z,
const PrintSegmentAttributes& print_attributes = {});

/*!
* Add polygon to the gcode starting at vertex \p startIdx
Expand All @@ -504,6 +511,7 @@ class LayerPlan : public NoCopy
* \param force_retract Whether to force a retraction when moving to the start of the polygon (used for outer walls)
* \param scarf_seam Indicates whether we may use a scarf seam for the path
* \param smooth_speed Indicates whether we may use a speed gradient for the path
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addPolygon(
const Polygon& polygon,
Expand All @@ -516,7 +524,8 @@ class LayerPlan : public NoCopy
const Ratio& flow_ratio = 1.0_r,
const ForceRetract force_retract = ForceRetract::AUTOMATIC,
bool scarf_seam = false,
bool smooth_speed = false);
bool smooth_speed = false,
const PrintSegmentAttributes& print_attributes = {});

/*!
* Add polygons to the gcode with optimized order.
Expand All @@ -532,6 +541,7 @@ class LayerPlan : public NoCopy
* \param polygons The polygons.
* \param config The config with which to print the polygon lines.
* for each given segment (optionally nullptr).
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
* \param z_seam_config Optional configuration for z-seam.
* \param wall_0_wipe_dist The distance to travel along each polygon after
* it has been laid down, in order to wipe the start and end of the wall
Expand All @@ -553,6 +563,7 @@ class LayerPlan : public NoCopy
const Shape& polygons,
const GCodePathConfig& config,
const Settings& settings,
const PrintSegmentAttributes& print_attributes = {},
const ZSeamConfig& z_seam_config = ZSeamConfig(),
coord_t wall_0_wipe_dist = 0,
bool spiralize = false,
Expand Down Expand Up @@ -614,6 +625,7 @@ class LayerPlan : public NoCopy
* a bridge line.
* \param distance_to_bridge_start The distance along the wall from p0 to
* the first bridge segment.
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addWallLine(
const PathAdapter<ExtrusionLine>& wall,
Expand All @@ -632,7 +644,8 @@ class LayerPlan : public NoCopy
double& non_bridge_line_volume,
Ratio speed_factor,
double distance_to_bridge_start,
const bool travel_to_z = true);
const bool travel_to_z = true,
const PrintSegmentAttributes& print_attributes = {});

/*!
* Add a wall to the g-code starting at vertex \p start_idx
Expand Down Expand Up @@ -687,6 +700,7 @@ class LayerPlan : public NoCopy
* \param is_linked_path Whether the path is a continuation off the previous path
* \param scarf_seam Indicates whether we may use a scarf seam for the path
* \param smooth_speed Indicates whether we may use a speed gradient for the path
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addWall(
const ExtrusionLine& wall,
Expand All @@ -703,7 +717,8 @@ class LayerPlan : public NoCopy
const bool is_reversed,
const bool is_linked_path,
const bool scarf_seam = false,
const bool smooth_speed = false);
const bool smooth_speed = false,
const PrintSegmentAttributes& print_attributes = {});

/*!
* Add an infill wall to the g-code
Expand Down Expand Up @@ -752,6 +767,7 @@ class LayerPlan : public NoCopy
* \param flow_ratio The ratio with which to multiply the extrusion amount
* \param near_start_location Optional: Location near where to add the first line. If not provided the last position is used.
* \param fan_speed optional fan speed override for this path
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
* \param reverse_print_direction Whether to reverse the optimized order and their printing direction.
* \param order_requirements Pairs where first needs to be printed before second. Pointers are pointing to elements of \p lines
* \param extra_inwards_start_move_length The length of the extra inwards moves to be added at the start of each infill line
Expand All @@ -768,6 +784,7 @@ class LayerPlan : public NoCopy
const Ratio flow_ratio = 1.0,
const std::optional<Point2LL> near_start_location = std::optional<Point2LL>(),
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
const PrintSegmentAttributes& print_attributes = {},
const bool reverse_print_direction = false,
const std::unordered_multimap<const Polyline*, const Polyline*>& order_requirements = PathOrderOptimizer<const Polyline*>::no_order_requirements_,
const coord_t extra_inwards_start_move_length = 0,
Expand Down Expand Up @@ -819,6 +836,7 @@ class LayerPlan : public NoCopy
* line.
* \param flow_ratio The ratio with which to multiply the extrusion amount.
* \param fan_speed Fan speed override for this path.
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addLinesMonotonic(
const Shape& area,
Expand All @@ -831,7 +849,8 @@ class LayerPlan : public NoCopy
const coord_t wipe_dist = 0,
const Ratio flow_ratio = 1.0_r,
const double fan_speed = GCodePathConfig::FAN_SPEED_DEFAULT,
const bool interlaced = false);
const bool interlaced = false,
const PrintSegmentAttributes& print_attributes = {});

/*!
* Add a spiralized slice of wall that is interpolated in X/Y between \p last_wall and \p wall.
Expand Down Expand Up @@ -956,6 +975,7 @@ class LayerPlan : public NoCopy
* \param wipe_dist (optional) the distance wiped without extruding after laying down a line.
* \param flow_ratio The ratio with which to multiply the extrusion amount
* \param fan_speed optional fan speed override for this path
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
* \param extra_inwards_start_move_length The length of the extra inwards moves to be added at the start of each infill line
* \param extra_inwards_end_move_length The length of the extra inwards moves to be added at the end of each infill line
* \param extra_inwards_move_contour The contour to be considered in order to add the inwards moves
Expand All @@ -967,6 +987,7 @@ class LayerPlan : public NoCopy
const coord_t wipe_dist,
const Ratio flow_ratio,
const double fan_speed,
const PrintSegmentAttributes& print_attributes = {},
const coord_t extra_inwards_start_move_length = 0,
const coord_t extra_inwards_end_move_length = 0,
const MendedShape& extra_inwards_move_contour = MendedShape());
Expand All @@ -992,6 +1013,7 @@ class LayerPlan : public NoCopy
* \param reverse_order Adds polygons in reverse order.
* \param scarf_seam Indicates whether we may use a scarf seam for the path
* \param smooth_speed Indicates whether we may use a speed gradient for the path
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void addPolygonsInGivenOrder(
const std::vector<PathOrdering<const Polygon*>>& polygons,
Expand All @@ -1004,7 +1026,8 @@ class LayerPlan : public NoCopy
const ForceRetract force_retract = ForceRetract::AUTOMATIC,
bool reverse_order = false,
bool scarf_seam = false,
bool smooth_speed = false);
bool smooth_speed = false,
const PrintSegmentAttributes& print_attributes = {});

/*!
* @brief Send a GCodePath line to the communication object, applying proper Z offsets
Expand Down
3 changes: 3 additions & 0 deletions include/PrintFeature.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) 2026 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef PRINT_FEATURE
#define PRINT_FEATURE

Expand Down
32 changes: 32 additions & 0 deletions include/PrintSegmentAttributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2026 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef PRINT_SEGMENT_FLAG
#define PRINT_SEGMENT_FLAG

#include <cstdint>

#include "utils/Flags.h"

namespace cura
{

/*!
* Print attributes are flags that can be added to some print segments to indicate that they have been processed a specific way,
* e.g. by using overhanging or bridging settings. They are used for display purposes.
* This enumeration has an equivalent in Cura/cura/PrintSegmentAttributes.py
*/
enum class PrintSegmentAttribute : uint8_t
{
// clang-format off
None = 0b00,
Overhanging = 0b01,
Bridging = 0b10,
// clang-format on
};

using PrintSegmentAttributes = Flags<PrintSegmentAttribute>;

} // namespace cura

#endif
11 changes: 9 additions & 2 deletions include/communication/ArcusCommunication.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,15 @@ class ArcusCommunication : public Communication
* \param line_width The width of the line.
* \param line_thickness The thickness (in the Z direction) of the line.
* \param velocity The velocity of printing this polygon.
*/
void sendLineTo(const PrintFeatureType& type, const Point3LL& to, const coord_t& line_width, const coord_t& line_thickness, const Velocity& velocity) override;
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
void sendLineTo(
const PrintFeatureType& type,
const Point3LL& to,
const coord_t& line_width,
const coord_t& line_thickness,
const Velocity& velocity,
const PrintSegmentAttributes& print_attributes) override;

/*
* \brief Send the sliced layer data to the front-end after the optimisation
Expand Down
2 changes: 1 addition & 1 deletion include/communication/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CommandLine : public Communication
*
* The command line doesn't show any layer view so this is ignored.
*/
void sendLineTo(const PrintFeatureType&, const Point3LL&, const coord_t&, const coord_t&, const Velocity&) override;
void sendLineTo(const PrintFeatureType&, const Point3LL&, const coord_t&, const coord_t&, const Velocity&, const PrintSegmentAttributes&) override;

/*
* \brief Complete a layer to show it in layer view.
Expand Down
11 changes: 10 additions & 1 deletion include/communication/Communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define COMMUNICATION_H

#include "PrintInformation.h"
#include "PrintSegmentAttributes.h"
#include "geometry/Point2LL.h"
#include "settings/types/LayerIndex.h"
#include "settings/types/Velocity.h"
Expand Down Expand Up @@ -65,8 +66,16 @@ class Communication
* \param line_width The width of the line.
* \param line_thickness The thickness (in the Z direction) of the line.
* \param velocity The velocity of printing this polygon.
* \param print_attributes Print attributes to be set for this segment, e.g. overhanging or bridging
*/
virtual void sendLineTo(const PrintFeatureType& type, const Point3LL& to, const coord_t& line_width, const coord_t& line_thickness, const Velocity& velocity) = 0;
virtual void sendLineTo(
const PrintFeatureType& type,
const Point3LL& to,
const coord_t& line_width,
const coord_t& line_thickness,
const Velocity& velocity,
const PrintSegmentAttributes& print_attributes = {})
= 0;

/*
* \brief Send the current position to visualise.
Expand Down
2 changes: 2 additions & 0 deletions include/pathPlanning/GCodePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>

#include "GCodePathConfig.h"
#include "PrintSegmentAttributes.h"
#include "SpaceFillType.h"
#include "TimeMaterialEstimates.h"
#include "geometry/Point2LL.h"
Expand Down Expand Up @@ -50,6 +51,7 @@ struct GCodePath
double fan_speed{ GCodePathConfig::FAN_SPEED_DEFAULT }; //!< fan speed override for this path, value should be within range 0-100 (inclusive) and ignored otherwise
TimeMaterialEstimates estimates{}; //!< Naive time and material estimates
bool travel_to_z{ true }; //! Indicates whether we should add a travel move to the Z height of the first point before processing the path
PrintSegmentAttributes print_attributes; //! Indicates if the line is processed with specific settings, e.g. overhanging or bridging

/*!
* Whether this config is the config of a travel path.
Expand Down
Loading
Loading