mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Check if object's size appears to be zero, when loading the model file.
This commit is contained in:
parent
7340488aaf
commit
c15be26bff
3 changed files with 25 additions and 0 deletions
|
@ -513,6 +513,22 @@ void Model::convert_from_meters(bool only_small_volumes)
|
|||
}
|
||||
}
|
||||
|
||||
static constexpr const double zero_volume = 0.0000000001;
|
||||
|
||||
int Model::removed_objects_with_zero_volume()
|
||||
{
|
||||
if (objects.size() == 0)
|
||||
return 0;
|
||||
|
||||
int removed = 0;
|
||||
for (int i = int(objects.size()) - 1; i >= 0; i--)
|
||||
if (objects[i]->get_object_stl_stats().volume < zero_volume) {
|
||||
delete_object(size_t(i));
|
||||
removed++;
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
void Model::adjust_min_z()
|
||||
{
|
||||
if (objects.empty())
|
||||
|
|
|
@ -1124,6 +1124,7 @@ public:
|
|||
void convert_from_imperial_units(bool only_small_volumes);
|
||||
bool looks_like_saved_in_meters() const;
|
||||
void convert_from_meters(bool only_small_volumes);
|
||||
int removed_objects_with_zero_volume();
|
||||
|
||||
// Ensures that the min z of the model is not negative
|
||||
void adjust_min_z();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue