mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fix of SPE-777
Added a flag to optimize the checking if the volume is splittable
This commit is contained in:
parent
fe8a149fb4
commit
5dafad3816
2 changed files with 13 additions and 0 deletions
|
@ -315,6 +315,9 @@ public:
|
||||||
// Extruder ID is only valid for FFF. Returns -1 for SLA or if the extruder ID is not applicable (support volumes).
|
// Extruder ID is only valid for FFF. Returns -1 for SLA or if the extruder ID is not applicable (support volumes).
|
||||||
int extruder_id() const;
|
int extruder_id() const;
|
||||||
|
|
||||||
|
void set_splittable(const int val) { m_is_splittable = val; }
|
||||||
|
int is_splittable() const { return m_is_splittable; }
|
||||||
|
|
||||||
// Split this volume, append the result to the object owning this volume.
|
// Split this volume, append the result to the object owning this volume.
|
||||||
// Return the number of volumes created from this one.
|
// Return the number of volumes created from this one.
|
||||||
// This is useful to assign different materials to different volumes of an object.
|
// This is useful to assign different materials to different volumes of an object.
|
||||||
|
@ -387,6 +390,12 @@ private:
|
||||||
TriangleMesh m_convex_hull;
|
TriangleMesh m_convex_hull;
|
||||||
Geometry::Transformation m_transformation;
|
Geometry::Transformation m_transformation;
|
||||||
|
|
||||||
|
// flag to optimize the checking if the volume is splittable
|
||||||
|
// -1 -> is unknown value (before first cheking)
|
||||||
|
// 0 -> is not splittable
|
||||||
|
// 1 -> is splittable
|
||||||
|
int m_is_splittable {-1};
|
||||||
|
|
||||||
ModelVolume(ModelObject *object, const TriangleMesh &mesh) : mesh(mesh), m_type(MODEL_PART), object(object)
|
ModelVolume(ModelObject *object, const TriangleMesh &mesh) : mesh(mesh), m_type(MODEL_PART), object(object)
|
||||||
{
|
{
|
||||||
if (mesh.stl.stats.number_of_facets > 1)
|
if (mesh.stl.stats.number_of_facets > 1)
|
||||||
|
|
|
@ -1105,10 +1105,14 @@ bool ObjectList::is_splittable()
|
||||||
if (!get_volume_by_item(item, volume) || !volume)
|
if (!get_volume_by_item(item, volume) || !volume)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (volume->is_splittable() != -1) // if is_splittable value is already known
|
||||||
|
return volume->is_splittable() == 0 ? false : true;
|
||||||
|
|
||||||
TriangleMeshPtrs meshptrs = volume->mesh.split();
|
TriangleMeshPtrs meshptrs = volume->mesh.split();
|
||||||
bool splittable = meshptrs.size() > 1;
|
bool splittable = meshptrs.size() > 1;
|
||||||
for (TriangleMesh* m : meshptrs) { delete m; }
|
for (TriangleMesh* m : meshptrs) { delete m; }
|
||||||
|
|
||||||
|
volume->set_splittable(splittable ? 1 : 0);
|
||||||
return splittable;
|
return splittable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue