Raft layers cause SeamPlacer crash - fix

This commit is contained in:
PavelMikus 2022-02-16 14:27:33 +01:00
parent 132f4bb590
commit 356ed93ad7
3 changed files with 7 additions and 8 deletions

View File

@ -2586,7 +2586,7 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
loop.split_at(last_pos, false); loop.split_at(last_pos, false);
} }
else else
m_seam_placer.place_seam(m_layer->object(), loop, m_layer->slice_z, m_layer_index, m_config.external_perimeters_first); m_seam_placer.place_seam(m_layer, loop, m_config.external_perimeters_first);
// clip the path to avoid the extruder to get exactly on the first point of the loop; // clip the path to avoid the extruder to get exactly on the first point of the loop;
// if polyline was shorter than the clipping distance we'd get a null polyline, so // if polyline was shorter than the clipping distance we'd get a null polyline, so

View File

@ -703,12 +703,12 @@ void SeamPlacer::init(const Print &print) {
} }
} }
void SeamPlacer::place_seam(const PrintObject *po, ExtrusionLoop &loop, coordf_t unscaled_z, int layer_index, void SeamPlacer::place_seam(const Layer* layer, ExtrusionLoop &loop, bool external_first) {
bool external_first) { const PrintObject* po = layer->object();
assert(m_perimeter_points_trees_per_object.find(po) != nullptr); //NOTE this is necessary, since layer->id() is quite unreliable
assert(m_perimeter_points_per_object.find(po) != nullptr); size_t layer_index = std::max(0,int(layer->id()) - int(po->slicing_parameters().raft_layers()));
double unscaled_z = layer->slice_z;
assert(layer_index >= 0);
const auto &perimeter_points_tree = *m_perimeter_points_trees_per_object[po][layer_index]; const auto &perimeter_points_tree = *m_perimeter_points_trees_per_object[po][layer_index];
const auto &perimeter_points = m_perimeter_points_per_object[po][layer_index]; const auto &perimeter_points = m_perimeter_points_per_object[po][layer_index];

View File

@ -97,8 +97,7 @@ public:
void init(const Print &print); void init(const Print &print);
void place_seam(const PrintObject *po, ExtrusionLoop &loop, coordf_t unscaled_z, int layer_index, void place_seam(const Layer* layer, ExtrusionLoop &loop, bool external_first);
bool external_first);
private: private:
void gather_seam_candidates(const PrintObject* po, const SeamPlacerImpl::GlobalModelInfo& global_model_info); void gather_seam_candidates(const PrintObject* po, const SeamPlacerImpl::GlobalModelInfo& global_model_info);