mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-27 02:31:10 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_reload_from_disk
This commit is contained in:
commit
c0576a8770
18 changed files with 342 additions and 159 deletions
|
|
@ -11,7 +11,7 @@ ExtrusionEntityCollection::ExtrusionEntityCollection(const ExtrusionPaths &paths
|
|||
this->append(paths);
|
||||
}
|
||||
|
||||
ExtrusionEntityCollection& ExtrusionEntityCollection::operator= (const ExtrusionEntityCollection &other)
|
||||
ExtrusionEntityCollection& ExtrusionEntityCollection::operator=(const ExtrusionEntityCollection &other)
|
||||
{
|
||||
this->entities = other.entities;
|
||||
for (size_t i = 0; i < this->entities.size(); ++i)
|
||||
|
|
@ -175,20 +175,20 @@ size_t ExtrusionEntityCollection::items_count() const
|
|||
}
|
||||
|
||||
// Returns a single vector of pointers to all non-collection items contained in this one.
|
||||
void ExtrusionEntityCollection::flatten(ExtrusionEntityCollection* retval) const
|
||||
{
|
||||
for (const ExtrusionEntity *entity : this->entities)
|
||||
if (entity->is_collection())
|
||||
retval->append(static_cast<const ExtrusionEntityCollection*>(entity)->flatten().entities);
|
||||
else
|
||||
retval->append(*entity);
|
||||
}
|
||||
|
||||
ExtrusionEntityCollection ExtrusionEntityCollection::flatten() const
|
||||
{
|
||||
ExtrusionEntityCollection coll;
|
||||
this->flatten(&coll);
|
||||
return coll;
|
||||
struct Flatten {
|
||||
ExtrusionEntityCollection out;
|
||||
void recursive_do(const ExtrusionEntityCollection &collection) {
|
||||
for (const ExtrusionEntity* entity : collection.entities)
|
||||
if (entity->is_collection())
|
||||
this->recursive_do(*static_cast<const ExtrusionEntityCollection*>(entity));
|
||||
else
|
||||
out.append(*entity);
|
||||
}
|
||||
} flatten;
|
||||
flatten.recursive_do(*this);
|
||||
return flatten.out;
|
||||
}
|
||||
|
||||
double ExtrusionEntityCollection::min_mm3_per_mm() const
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ public:
|
|||
Polygons polygons_covered_by_spacing(const float scaled_epsilon = 0.f) const
|
||||
{ Polygons out; this->polygons_covered_by_spacing(out, scaled_epsilon); return out; }
|
||||
size_t items_count() const;
|
||||
void flatten(ExtrusionEntityCollection* retval) const;
|
||||
ExtrusionEntityCollection flatten() const;
|
||||
double min_mm3_per_mm() const;
|
||||
double total_volume() const override { double volume=0.; for (const auto& ent : entities) volume+=ent->total_volume(); return volume; }
|
||||
|
|
|
|||
|
|
@ -1236,7 +1236,8 @@ std::string Print::validate() const
|
|||
|
||||
// The comparison of the profiles is not just about element-wise equality, some layers may not be
|
||||
// explicitely included. Always remember z and height of last reference layer that in the vector
|
||||
// and compare to that.
|
||||
// and compare to that. In case some layers are in the vectors multiple times, only the last entry is
|
||||
// taken into account and compared.
|
||||
size_t i = 0; // index into tested profile
|
||||
size_t j = 0; // index into reference profile
|
||||
coordf_t ref_z = -1.;
|
||||
|
|
@ -1244,8 +1245,12 @@ std::string Print::validate() const
|
|||
coordf_t ref_height = -1.;
|
||||
while (i < layer_height_profile.size()) {
|
||||
coordf_t this_z = layer_height_profile[i];
|
||||
// find the last entry with this z
|
||||
while (i+2 < layer_height_profile.size() && layer_height_profile[i+2] == this_z)
|
||||
i += 2;
|
||||
|
||||
coordf_t this_height = layer_height_profile[i+1];
|
||||
if (next_ref_z < this_z + EPSILON) {
|
||||
if (ref_height < -1. || next_ref_z < this_z + EPSILON) {
|
||||
ref_z = next_ref_z;
|
||||
do { // one layer can be in the vector several times
|
||||
ref_height = layer_height_profile_tallest[j+1];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue