Skip to content

Commit a6445ea

Browse files
committed
Fix skin support with multiple meshes
CURA-12361
1 parent a17dbfa commit a6445ea

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

include/LayerPlan.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class LayerPlan : public NoCopy
167167

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

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

172172
const std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder_;
173173

@@ -419,9 +419,9 @@ class LayerPlan : public NoCopy
419419
*/
420420
void planPrime(double prime_blob_wipe_length = 10.0);
421421

422-
void setGeneratedInfillLines(const MixedLinesSet& infill_lines);
422+
void setGeneratedInfillLines(const SliceMeshStorage* mesh, const MixedLinesSet& infill_lines);
423423

424-
const MixedLinesSet& getGeneratedInfillLines() const;
424+
const MixedLinesSet getGeneratedInfillLines(const SliceMeshStorage* mesh) const;
425425

426426
/*!
427427
* Add an extrusion move to a certain point, optionally with a different flow than the one in the \p config.

src/FffGcodeWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,7 +2547,7 @@ bool FffGcodeWriter::processSingleLayerInfill(
25472547
MixedLinesSet all_infill_lines;
25482548
all_infill_lines.push_back(std::move(infill_lines));
25492549
all_infill_lines.push_back(std::move(infill_polygons));
2550-
gcode_layer.setGeneratedInfillLines(all_infill_lines);
2550+
gcode_layer.setGeneratedInfillLines(&mesh, all_infill_lines);
25512551
}
25522552

25532553
return added_something;

src/LayerPlan.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,19 @@ void LayerPlan::planPrime(double prime_blob_wipe_length)
541541
forceNewPathStart();
542542
}
543543

544-
void LayerPlan::setGeneratedInfillLines(const MixedLinesSet& infill_lines)
544+
void LayerPlan::setGeneratedInfillLines(const SliceMeshStorage* mesh, const MixedLinesSet& infill_lines)
545545
{
546-
infill_lines_ = infill_lines;
546+
infill_lines_[mesh].push_back(infill_lines);
547547
}
548548

549-
const MixedLinesSet& LayerPlan::getGeneratedInfillLines() const
549+
const MixedLinesSet LayerPlan::getGeneratedInfillLines(const SliceMeshStorage* mesh) const
550550
{
551-
return infill_lines_;
551+
auto iterator = infill_lines_.find(mesh);
552+
if (iterator != infill_lines_.end())
553+
{
554+
return iterator->second;
555+
}
556+
return MixedLinesSet();
552557
}
553558

554559
void LayerPlan::addExtrusionMove(

src/bridge.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ std::tuple<Shape, AngleDegrees> makeBridgeOverInfillPrintable(
926926

927927
// We will expand the bridging area following the lines direction
928928
const AngleDegrees expansion_angle = bridge_angle + 90;
929-
const MixedLinesSet& infill_lines_below = completed_layer_plan_below->getGeneratedInfillLines();
929+
const MixedLinesSet infill_lines_below = completed_layer_plan_below->getGeneratedInfillLines(&mesh);
930930
TransformedShape filtered_infill_lines_below;
931931

932932
// Rotate all the infill lines below so that they are in a space where the under skin area should be expanded horizontally
@@ -978,6 +978,11 @@ std::tuple<Shape, AngleDegrees> makeBridgeOverInfillPrintable(
978978
// Perform a morphological closing to remove overlapping lines
979979
transformed_expanded_infill_below_skin_area = transformed_expanded_infill_below_skin_area.offset(EPSILON).offset(-EPSILON).intersection(infill_contour);
980980

981+
SVG svg(fmt::format("/tmp/skin_support.svg"), AABB(transformed_expanded_infill_below_skin_area));
982+
svg.write(infill_below_skin_area, { .surface = { SVG::Color::BLUE } });
983+
svg.write(infill_lines_below, { .line = { SVG::Color::MAGENTA, 0.4 } });
984+
svg.write(transformed_expanded_infill_below_skin_area, { .surface = { SVG::Color::RED, 0.3 } });
985+
981986
return { transformed_expanded_infill_below_skin_area, bridge_angle };
982987
}
983988

0 commit comments

Comments
 (0)