Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
570dee1
Basically replace skin edge support by basic bridging
wawanbreton Nov 28, 2025
52f6fe7
Basically working bridging skin support
wawanbreton Dec 3, 2025
ea7b3c1
Apply clang-format
wawanbreton Dec 3, 2025
8f3c7b3
Fix some non-working skin support cases
wawanbreton Dec 3, 2025
895978e
Fix last cases of unexpected skin support
wawanbreton Dec 4, 2025
f599050
Optimized skin support calculation
wawanbreton Dec 8, 2025
be69c8a
Clean and document code
wawanbreton Dec 9, 2025
4948ff4
Basically working new skin support calculation
wawanbreton Dec 10, 2025
de05a89
Fix edge case and remove first version
wawanbreton Dec 10, 2025
1414a37
Simplify output polygon
wawanbreton Dec 10, 2025
bea0980
Optimize skin support calculation
wawanbreton Dec 11, 2025
a17dbfa
Remove bridging over infill
wawanbreton Dec 11, 2025
a6445ea
Fix skin support with multiple meshes
wawanbreton Dec 11, 2025
c6bb31a
Apply clang-format
wawanbreton Dec 11, 2025
aac4365
Remove extra infill lines data
wawanbreton Dec 11, 2025
e181857
Fix skin support when whole infill area is bridging
wawanbreton Dec 11, 2025
6727810
Finalize code cleaning and documentation
wawanbreton Dec 11, 2025
e73ff2b
Simplify dead code
wawanbreton Dec 11, 2025
a3faf58
Add unit test
wawanbreton Dec 11, 2025
b557589
Fix and disable unit tests
wawanbreton Dec 11, 2025
17f4221
Apply code suggestions
wawanbreton Dec 16, 2025
baf8a1c
Move structures to their own files and convert to classes
wawanbreton Dec 17, 2025
57cd44e
Merge remote-tracking branch 'origin/CURA-12833_improve-bridge-lines-…
wawanbreton Dec 17, 2025
b072037
Merge branch 'main' into CURA-12361_add-skin-support
HellAholic Dec 17, 2025
97b1ed0
Remove constexpr constructors
wawanbreton Dec 18, 2025
dffbbf0
Fix incorrect forward-declaration
wawanbreton Dec 18, 2025
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
139 changes: 139 additions & 0 deletions doc/bridging_skin_support.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion include/ExtruderPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ExtruderPlan
FRIEND_TEST(ExtruderPlanPathsParameterizedTest, BackPressureCompensationFull);
FRIEND_TEST(ExtruderPlanPathsParameterizedTest, BackPressureCompensationHalf);
FRIEND_TEST(ExtruderPlanTest, BackPressureCompensationEmptyPlan);
friend class FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
friend class DISABLED_FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
#endif
public:
size_t extruder_nr_{ 0 }; //!< The extruder used for this paths in the current plan.
Expand Down
5 changes: 2 additions & 3 deletions include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct MeshPathConfigs;
class FffGcodeWriter : public NoCopy
{
friend class FffProcessor; // Because FffProcessor exposes finalize (TODO)
friend class FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
friend class DISABLED_FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;

private:
coord_t max_object_height; //!< The maximal height of all previously sliced meshgroups, used to avoid collision when moving to the next meshgroup to print.
Expand Down Expand Up @@ -747,9 +747,8 @@ class FffGcodeWriter : public NoCopy
* \param mesh the mesh containing the layer of interest
* \param part \param part The part for which to create gcode
* \param infill_line_width line width of the infill
* \return true if there needs to be a skin edge support wall in this layer, otherwise false
*/
static bool partitionInfillBySkinAbove(
static void partitionInfillBySkinAbove(
Shape& infill_below_skin,
Shape& infill_not_below_skin,
const LayerPlan& gcode_layer,
Expand Down
8 changes: 7 additions & 1 deletion include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LayerPlan : public NoCopy
friend class LayerPlanBuffer;
#ifdef BUILD_TESTS
friend class AddTravelTest;
friend class FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
friend class DISABLED_FffGcodeWriterTest_SurfaceGetsExtraInfillLinesUnderIt_Test;
friend class AntiOozeAmountsTest;
FRIEND_TEST(AntiOozeAmountsTest, ComputeAntiOozeAmounts);
#endif
Expand Down Expand Up @@ -167,6 +167,8 @@ class LayerPlan : public NoCopy

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

std::map<const SliceMeshStorage*, MixedLinesSet> infill_lines_; //!< Infill lines generated for this layer

const std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder_;

enum CombBoundary
Expand Down Expand Up @@ -417,6 +419,10 @@ class LayerPlan : public NoCopy
*/
void planPrime(double prime_blob_wipe_length = 10.0);

void setGeneratedInfillLines(const SliceMeshStorage* mesh, const MixedLinesSet& infill_lines);

const MixedLinesSet getGeneratedInfillLines(const SliceMeshStorage* mesh) const;

/*!
* Add an extrusion move to a certain point, optionally with a different flow than the one in the \p config.
*
Expand Down
19 changes: 14 additions & 5 deletions include/LayerPlanBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef LAYER_PLAN_BUFFER_H
#define LAYER_PLAN_BUFFER_H

#include <condition_variable>
#include <list>
#include <vector>

Expand All @@ -17,6 +18,7 @@ namespace cura
class LayerPlan;
class ExtruderPlan;
class GCodeExport;
class LayerIndex;

/*!
* Class for buffering multiple layer plans (\ref LayerPlan) / extruder plans within those layer plans, so that temperature commands can be inserted in earlier layer plans.
Expand Down Expand Up @@ -57,6 +59,9 @@ class LayerPlanBuffer
*/
std::list<LayerPlan*> buffer_;

std::mutex buffer_mutex_;
std::condition_variable buffer_condition_variable_;

public:
LayerPlanBuffer(GCodeExport& gcode)
: gcode_(gcode)
Expand All @@ -66,11 +71,6 @@ class LayerPlanBuffer

void setPreheatConfig();

/*!
* Push a new layer plan into the buffer
*/
void push(LayerPlan& layer_plan);

/*!
* Push a new layer onto the buffer and handle the buffer.
* Write a layer to gcode if it is popped out of the buffer.
Expand All @@ -85,6 +85,15 @@ class LayerPlanBuffer
*/
void flush();

/*!
* Gets the layer plan for the given layer, once it has been completed. It will wait for completion if necessary
* @param layer_nr The layer number to get the plan for
* @return The completed layer plan
* @warning Make sure you always ask for a layer plan below the one that is being processed. Since the layers processing is started bottom to top and the engine can be run
* mono-threaded, asking for a layer above could lead to a deadlock because the processing of this layer will never start.
*/
const LayerPlan* getCompletedLayerPlan(const LayerIndex& layer_nr) const;

private:
/*!
* Process all layers in the buffer
Expand Down
1 change: 0 additions & 1 deletion include/TreeModelVolumes.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

namespace cura
{
constexpr coord_t EPSILON = 5;
constexpr coord_t FUDGE_LENGTH = 50;

class SliceDataStorage;
Expand Down
21 changes: 21 additions & 0 deletions include/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#define BRIDGE_H

#include <optional>
#include <tuple>

#include "utils/Coord_t.h"

namespace cura
{
Expand All @@ -14,6 +17,7 @@ class SliceMeshStorage;
class SliceDataStorage;
class SupportLayer;
class AngleDegrees;
class LayerPlan;

/*!
* \brief Computes the angle that lines have to take to bridge a certain shape
Expand All @@ -39,6 +43,23 @@ std::optional<AngleDegrees> bridgeAngle(
const SupportLayer* support_layer,
Shape& supported_regions);

/*!
* @brief Make sure the bridging above infill (below skin) is properly printable by expanding the area below the skin so that the bridging would always provide anchoring points
* from the infill lines below
* @param infill_contour The complete outer contour of the infill
* @param infill_below_skin_area The infill area that should be printed as bridging
* @param mesh The mesh being printed
* @param completed_layer_plan_below The plan of the layer just below that has been completed by now
* @param layer_nr The current layer number
* @return A new shape containing the expanded infill below skin area, and the angle to be used to generate bridging in this area
*/
std::tuple<Shape, AngleDegrees> makeBridgeOverInfillPrintable(
const Shape& infill_contour,
const Shape& infill_below_skin_area,
const SliceMeshStorage& mesh,
const LayerPlan* completed_layer_plan_below,
const unsigned layer_nr);

} // namespace cura

#endif // BRIDGE_H
11 changes: 7 additions & 4 deletions include/geometry/MixedLinesSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ class MixedLinesSet : public std::vector<PolylinePtr>
/*! @brief Adds the given shared pointer to the set. The pointer reference count will be incremeted but no data is actually copied. */
void push_back(const PolylinePtr& line);

/*! @brief Adds a copy of all the polygons contained in the shape */
void push_back(const Shape& shape);

/*! @brief Adds a copy of all the polygons contained in the set */
void push_back(const LinesSet<Polygon>& lines_set);

void push_back(LinesSet<Polygon>&& lines_set);

/*! @brief Adds a copy of all the polylines contained in the set */
void push_back(const OpenLinesSet& lines_set);

Expand All @@ -71,7 +70,11 @@ class MixedLinesSet : public std::vector<PolylinePtr>
/*! @brief Adds a copy of all the polylines contained in the set */
void push_back(ClosedLinesSet&& lines_set);

/*! \brief Computes the total lenght of all the polylines in the set */
void push_back(const MixedLinesSet& lines_set);

void push_back(MixedLinesSet&& lines_set);

/*! \brief Computes the total length of all the polylines in the set */
[[nodiscard]] coord_t length() const;
};

Expand Down
16 changes: 6 additions & 10 deletions include/geometry/Point2LL.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,6 @@ INLINE coord_t cross(const Point2LL& p0, const Point2LL& p1)
return p0.X * p1.Y - p0.Y * p1.X;
}

INLINE double angle(const Point2LL& p)
{
double angle = std::atan2(p.X, p.Y) / std::numbers::pi * 180.0;
if (angle < 0.0)
{
angle += 360.0;
}
return angle;
}

// Identity function, used to be able to make templated algorithms where the input is sometimes points, sometimes things that contain or can be converted to points.
INLINE const Point2LL& make_point(const Point2LL& p)
{
Expand All @@ -227,6 +217,12 @@ inline Point2LL lerp(const Point2LL& a, const Point2LL& b, const double t)
return Point2LL(lerp(a.X, b.X, t), lerp(a.Y, b.Y, t));
}

/*! Returns true if the points are equal or close enough to each other to be considered equal */
inline bool fuzzy_equal(const Point2LL& a, const Point2LL& b)
{
return fuzzy_equal(a.X, b.X) && fuzzy_equal(a.Y, b.Y);
}

} // namespace cura

namespace std
Expand Down
5 changes: 5 additions & 0 deletions include/geometry/PointsSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ class PointsSet
push_back(other.points_.begin(), other.points_.end());
}

void push_back(PointsSet&& other)
{
points_.insert(points_.end(), std::make_move_iterator(other.points_.begin()), std::make_move_iterator(other.points_.end()));
}

void push_back(const const_iterator& begin, const const_iterator& end)
{
points_.insert(points_.end(), begin, end);
Expand Down
4 changes: 4 additions & 0 deletions include/geometry/Polygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class AngleDegrees;
class Polygon : public ClosedPolyline
{
public:
/*!
* \brief Builds an empty polygon
* \warning By default, the polygon is tagged as non explicitly closed
*/
Polygon() = default;

/*!
Expand Down
Loading
Loading