Skip to content

Commit

Permalink
clean unsued/harmful code for EEC::chained_path_from
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jan 23, 2024
1 parent b2be98a commit 16d322a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 44 deletions.
37 changes: 4 additions & 33 deletions src/libslic3r/ExtrusionEntityCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,40 +81,11 @@ void ExtrusionEntityCollection::remove(size_t i)
this->m_entities.erase(this->m_entities.begin() + i);
}

ExtrusionEntityCollection ExtrusionEntityCollection::chained_path_from(const ExtrusionEntitiesPtr& extrusion_entities, const Point &start_near, ExtrusionRole role)
//ExtrusionEntityCollection ExtrusionEntityCollection::chained_path_from(const Point &start_near, ExtrusionRole role)
void ExtrusionEntityCollection::chained_path_from(const Point &start_near)
{
//ExtrusionEntityCollection out;
//if (this->no_sort) {
// out = *this;
//} else {
// if (role == erMixed)
// out = *this;
// else {
// for (const ExtrusionEntity *ee : this->entities()) {
// if (role != erMixed) {
// // The caller wants only paths with a specific extrusion role.
// auto role2 = ee->role();
// if (role != role2) {
// // This extrusion entity does not match the role asked.
// assert(role2 != erMixed);
// continue;
// }
// }
// out.entities().emplace_back(ee->clone());
// }
// }
// chain_and_reorder_extrusion_entities(out.entities(), &start_near);
//}
//return out;
// Return a filtered copy of the collection.
ExtrusionEntityCollection out;
out.m_entities = filter_by_extrusion_role(extrusion_entities, role);
// Clone the extrusion entities.
for (ExtrusionEntity* &ptr : out.m_entities)
ptr = ptr->clone();
chain_and_reorder_extrusion_entities(out.m_entities, &start_near);
return out;
if (this->m_no_sort)
return;
chain_and_reorder_extrusion_entities(this->m_entities, &start_near);
}

void ExtrusionEntityCollection::polygons_covered_by_width(Polygons &out, const float scaled_epsilon) const
Expand Down
9 changes: 1 addition & 8 deletions src/libslic3r/ExtrusionEntityCollection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,7 @@ class ExtrusionEntityCollection : public ExtrusionEntity
}
void replace(size_t i, const ExtrusionEntity &entity);
void remove(size_t i);
static ExtrusionEntityCollection chained_path_from(const ExtrusionEntitiesPtr &extrusion_entities, const Point &start_near, ExtrusionRole role = erMixed);
ExtrusionEntityCollection chained_path_from(const Point &start_near, ExtrusionRole role = erNone) const {
if (role == erNone) role = this->role();
if( this->m_no_sort || (role == erMixed) )
return *this;
else
return chained_path_from(this->m_entities, start_near, role);
}
void chained_path_from(const Point &start_near);
void reverse() override;
const Point& first_point() const override { return this->entities().front()->first_point(); }
const Point& last_point() const override { return this->entities().back()->last_point(); }
Expand Down
14 changes: 11 additions & 3 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3423,9 +3423,16 @@ LayerResult GCode::process_layer(
gcode += m_writer.set_temperature(m_config.first_layer_temperature.get_at(m_writer.tool()->id()), false, m_writer.tool()->id());
else if (m_config.temperature.get_at(m_writer.tool()->id()) > 0) // don't set it if disabled
gcode += m_writer.set_temperature(m_config.temperature.get_at(m_writer.tool()->id()), false, m_writer.tool()->id());
gcode += this->extrude_support(
//create support-only collection (by copy)
ExtrusionEntityCollection only_support;
// support_extrusion_role is erSupportMaterial, erSupportMaterialInterface or erMixed for all extrusion paths.
instance_to_print.object_by_extruder.support->chained_path_from(m_last_pos, instance_to_print.object_by_extruder.support_extrusion_role));
only_support.set_can_sort_reverse(instance_to_print.object_by_extruder.support->can_sort(), instance_to_print.object_by_extruder.support->can_reverse());
only_support.append(
filter_by_extrusion_role(instance_to_print.object_by_extruder.support->entities(),
instance_to_print.object_by_extruder.support_extrusion_role));
only_support.chained_path_from(m_last_pos);
//it's reaordered, now extrude.
gcode += this->extrude_support(only_support);
m_layer = layer_to_print.layer();
m_object_layer_over_raft = object_layer_over_raft;
}
Expand Down Expand Up @@ -4887,7 +4894,8 @@ void GCode::use(const ExtrusionEntityCollection &collection) {
next_entity->visit(*this);
}
} else {
ExtrusionEntityCollection chained = collection.chained_path_from(m_last_pos);
ExtrusionEntityCollection chained = collection; // TODO: 2.7 maybe we can visit a modifiable colelction, so we don't copy it at every step?
chained.chained_path_from(m_last_pos);
for (const ExtrusionEntity* next_entity : chained.entities()) {
next_entity->visit(*this);
}
Expand Down

0 comments on commit 16d322a

Please sign in to comment.