Skip to content

Commit dd74a65

Browse files
committed
Give priority to briding when both flooring and bridging are possible
CURA-12450 This is done be de-registering flooring areas once the briding mask has been calculated, and registering them as being classic skin areas.
1 parent 181c5d9 commit dd74a65

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

include/FffGcodeWriter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ class FffGcodeWriter : public NoCopy
377377
const SliceMeshStorage& mesh,
378378
const size_t extruder_nr,
379379
const MeshPathConfigs& mesh_config,
380-
const SliceLayerPart& part,
380+
SliceLayerPart& part,
381381
LayerPlan& gcode_layer) const;
382382

383383
/*!
@@ -448,7 +448,7 @@ class FffGcodeWriter : public NoCopy
448448
const SliceMeshStorage& mesh,
449449
const size_t extruder_nr,
450450
const MeshPathConfigs& mesh_config,
451-
const SliceLayerPart& part) const;
451+
SliceLayerPart& part) const;
452452

453453
/*!
454454
* Generate the a spiralized wall for a given layer part.

include/utils/SVG.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class SVG : NoCopy
147147

148148
void writePolygons(const Shape& polys, const ColorObject color = Color::BLACK, const double stroke_width = 1.0, const bool flush = true) const;
149149

150-
void writePolygon(Polygon poly, const ColorObject color = Color::BLACK, const double stroke_width = 1.0, const bool flush = true) const;
150+
void writePolygon(const Polygon& poly, const ColorObject color = Color::BLACK, const double stroke_width = 1.0, const bool flush = true) const;
151151

152152
void writePolylines(const Shape& polys, const ColorObject color = Color::BLACK, const double stroke_width = 1.0, const bool flush = true) const;
153153

src/FffGcodeWriter.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ void FffGcodeWriter::addMeshLayerToGCode(
17901790
const MeshPathConfigs& mesh_config,
17911791
LayerPlan& gcode_layer) const
17921792
{
1793-
const auto& mesh = *mesh_ptr;
1793+
auto& mesh = *mesh_ptr;
17941794
if (gcode_layer.getLayerNr() > mesh.layer_nr_max_filled_layer)
17951795
{
17961796
return;
@@ -1801,7 +1801,7 @@ void FffGcodeWriter::addMeshLayerToGCode(
18011801
return;
18021802
}
18031803

1804-
const SliceLayer& layer = mesh.layers[gcode_layer.getLayerNr()];
1804+
SliceLayer& layer = mesh.layers[gcode_layer.getLayerNr()];
18051805

18061806
if (layer.parts.empty())
18071807
{
@@ -1819,8 +1819,8 @@ void FffGcodeWriter::addMeshLayerToGCode(
18191819
mesh.settings.get<EZSeamCornerPrefType>("z_seam_corner"),
18201820
mesh.settings.get<coord_t>("wall_line_width_0") * 2);
18211821
}
1822-
PathOrderOptimizer<const SliceLayerPart*> part_order_optimizer(gcode_layer.getLastPlannedPositionOrStartingPosition(), z_seam_config);
1823-
for (const SliceLayerPart& part : layer.parts)
1822+
PathOrderOptimizer<SliceLayerPart*> part_order_optimizer(gcode_layer.getLastPlannedPositionOrStartingPosition(), z_seam_config);
1823+
for (SliceLayerPart& part : layer.parts)
18241824
{
18251825
if (part.outline.empty())
18261826
{
@@ -1831,7 +1831,7 @@ void FffGcodeWriter::addMeshLayerToGCode(
18311831

18321832
part_order_optimizer.optimize(false);
18331833

1834-
for (const PathOrdering<const SliceLayerPart*>& path : part_order_optimizer.paths_)
1834+
for (const PathOrdering<SliceLayerPart*>& path : part_order_optimizer.paths_)
18351835
{
18361836
addMeshPartToGCode(storage, mesh, extruder_nr, mesh_config, *path.vertices_, gcode_layer);
18371837
}
@@ -1853,7 +1853,7 @@ void FffGcodeWriter::addMeshPartToGCode(
18531853
const SliceMeshStorage& mesh,
18541854
const size_t extruder_nr,
18551855
const MeshPathConfigs& mesh_config,
1856-
const SliceLayerPart& part,
1856+
SliceLayerPart& part,
18571857
LayerPlan& gcode_layer) const
18581858
{
18591859
const Settings& mesh_group_settings = Application::getInstance().current_slice_->scene.current_mesh_group->settings;
@@ -2976,7 +2976,7 @@ bool FffGcodeWriter::processInsets(
29762976
const SliceMeshStorage& mesh,
29772977
const size_t extruder_nr,
29782978
const MeshPathConfigs& mesh_config,
2979-
const SliceLayerPart& part) const
2979+
SliceLayerPart& part) const
29802980
{
29812981
bool added_something = false;
29822982
if (extruder_nr != mesh.settings.get<ExtruderTrain&>("wall_0_extruder_nr").extruder_nr_ && extruder_nr != mesh.settings.get<ExtruderTrain&>("wall_x_extruder_nr").extruder_nr_)
@@ -3099,7 +3099,16 @@ bool FffGcodeWriter::processInsets(
30993099
// which is required because when the walls are being generated, the vertices do not fall on the part's outline
31003100
// but, instead, are 1/2 a line width inset from the outline
31013101

3102-
gcode_layer.setBridgeWallMask(compressed_air.offset(max_air_gap + half_outer_wall_width));
3102+
Shape bridge_mask = compressed_air.offset(max_air_gap + half_outer_wall_width);
3103+
gcode_layer.setBridgeWallMask(bridge_mask);
3104+
3105+
// Override flooring/skin areas to register bridging areas to be treated as normal skin
3106+
for (SkinPart& skin_part : part.skin_parts)
3107+
{
3108+
Shape moved_area = skin_part.flooring_fill.intersection(bridge_mask).offset(10);
3109+
skin_part.flooring_fill = skin_part.flooring_fill.difference(moved_area);
3110+
skin_part.skin_fill = skin_part.skin_fill.unionPolygons(moved_area);
3111+
}
31033112
}
31043113
else
31053114
{

src/path_ordering.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ const PointsSet& PathOrdering<const SliceLayerPart*>::getVertexData()
2828
return vertices_->outline.outerPolygon();
2929
}
3030

31+
template<>
32+
const PointsSet& PathOrdering<SliceLayerPart*>::getVertexData()
33+
{
34+
return vertices_->outline.outerPolygon();
35+
}
36+
3137
template<>
3238
const PointsSet& PathOrdering<const SupportInfillPart*>::getVertexData()
3339
{

src/utils/SVG.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ void SVG::writePolygons(const Shape& polys, const ColorObject color, const doubl
355355
handleFlush(flush);
356356
}
357357

358-
void SVG::writePolygon(const Polygon poly, const ColorObject color, const double stroke_width, const bool flush) const
358+
void SVG::writePolygon(const Polygon& poly, const ColorObject color, const double stroke_width, const bool flush) const
359359
{
360360
if (poly.size() == 0)
361361
{
@@ -364,7 +364,7 @@ void SVG::writePolygon(const Polygon poly, const ColorObject color, const double
364364
int size = static_cast<int>(poly.size());
365365
Point2LL p0 = poly.back();
366366
int i = 0;
367-
for (Point2LL p1 : poly)
367+
for (const Point2LL& p1 : poly)
368368
{
369369
if (color.color_ == Color::RAINBOW)
370370
{
@@ -382,7 +382,7 @@ void SVG::writePolygon(const Polygon poly, const ColorObject color, const double
382382
}
383383
else
384384
{
385-
writeLine(p0, p1, color, stroke_width);
385+
writeLine(p0, p1, color, stroke_width, false);
386386
}
387387
p0 = p1;
388388
i++;

0 commit comments

Comments
 (0)