Skip to content

Commit 7ae0531

Browse files
authored
CURA-12450 Flooring settings override bridging settings (#2208)
2 parents 181c5d9 + 348ec2d commit 7ae0531

File tree

5 files changed

+36
-22
lines changed

5 files changed

+36
-22
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: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ void SVG::handleFlush(const bool flush) const
6969

7070

7171
SVG::SVG(std::string filename, AABB aabb, Point2LL canvas_size, ColorObject background)
72-
: SVG(
73-
filename,
74-
aabb,
75-
std::min(
76-
static_cast<double>(canvas_size.X - canvas_size.X / 5 * 2) / static_cast<double>(aabb.max_.X - aabb.min_.X),
77-
static_cast<double>(canvas_size.Y - canvas_size.Y / 5) / static_cast<double>(aabb.max_.Y - aabb.min_.Y)),
78-
canvas_size,
79-
background)
72+
: SVG(filename,
73+
aabb,
74+
std::min(
75+
static_cast<double>(canvas_size.X - canvas_size.X / 5 * 2) / static_cast<double>(aabb.max_.X - aabb.min_.X),
76+
static_cast<double>(canvas_size.Y - canvas_size.Y / 5) / static_cast<double>(aabb.max_.Y - aabb.min_.Y)),
77+
canvas_size,
78+
background)
8079
{
8180
}
8281

@@ -355,7 +354,7 @@ void SVG::writePolygons(const Shape& polys, const ColorObject color, const doubl
355354
handleFlush(flush);
356355
}
357356

358-
void SVG::writePolygon(const Polygon poly, const ColorObject color, const double stroke_width, const bool flush) const
357+
void SVG::writePolygon(const Polygon& poly, const ColorObject color, const double stroke_width, const bool flush) const
359358
{
360359
if (poly.size() == 0)
361360
{
@@ -364,7 +363,7 @@ void SVG::writePolygon(const Polygon poly, const ColorObject color, const double
364363
int size = static_cast<int>(poly.size());
365364
Point2LL p0 = poly.back();
366365
int i = 0;
367-
for (Point2LL p1 : poly)
366+
for (const Point2LL& p1 : poly)
368367
{
369368
if (color.color_ == Color::RAINBOW)
370369
{
@@ -382,7 +381,7 @@ void SVG::writePolygon(const Polygon poly, const ColorObject color, const double
382381
}
383382
else
384383
{
385-
writeLine(p0, p1, color, stroke_width);
384+
writeLine(p0, p1, color, stroke_width, false);
386385
}
387386
p0 = p1;
388387
i++;

0 commit comments

Comments
 (0)