Export interface for csgparts in SLAPrintObject

This commit is contained in:
tamasmeszaros 2023-01-10 16:13:13 +01:00
parent 0989a6f5df
commit 897e5673c9
2 changed files with 14 additions and 12 deletions

View File

@ -88,6 +88,7 @@ class SLAPrintObject : public _SLAPrintObjectBase
{ {
private: // Prevents erroneous use by other classes. private: // Prevents erroneous use by other classes.
using Inherited = _SLAPrintObjectBase; using Inherited = _SLAPrintObjectBase;
using CSGContainer = std::multiset<CSGPartForStep>;
public: public:
@ -122,6 +123,17 @@ public:
// like hollowing and drilled holes. // like hollowing and drilled holes.
const TriangleMesh & get_mesh_to_print() const; const TriangleMesh & get_mesh_to_print() const;
const Range<CSGContainer::const_iterator> get_parts_to_slice() const
{
return range(m_mesh_to_slice);
}
const Range<CSGContainer::const_iterator> get_parts_to_slice(SLAPrintObjectStep step) const
{
auto r = m_mesh_to_slice.equal_range(step);
return {r.first, r.second};
}
sla::SupportPoints transformed_support_points() const; sla::SupportPoints transformed_support_points() const;
sla::DrainHoles transformed_drainhole_points() const; sla::DrainHoles transformed_drainhole_points() const;
@ -331,9 +343,6 @@ private:
std::vector<float> m_model_height_levels; std::vector<float> m_model_height_levels;
// Caching the transformed (m_trafo) raw mesh of the object
// TriangleMesh m_transformed_rmesh;
struct SupportData struct SupportData
{ {
sla::SupportableMesh input; // the input sla::SupportableMesh input; // the input
@ -362,7 +371,7 @@ private:
std::unique_ptr<SupportData> m_supportdata; std::unique_ptr<SupportData> m_supportdata;
// Holds CSG operations for the printed object, prioritized by print steps. // Holds CSG operations for the printed object, prioritized by print steps.
std::multiset<CSGPartForStep> m_mesh_to_slice; CSGContainer m_mesh_to_slice;
// Holds the preview of the object to be printed (as it will look like with // Holds the preview of the object to be printed (as it will look like with
// all its holes and cavities, negatives and positive volumes unified. // all its holes and cavities, negatives and positive volumes unified.

View File

@ -186,13 +186,6 @@ indexed_triangle_set SLAPrint::Steps::generate_preview_vdb(
return m; return m;
} }
inline auto parts_to_slice(const std::multiset<CSGPartForStep> &parts,
SLAPrintObjectStep step)
{
auto r = parts.equal_range(step);
return Range{r.first, r.second};
}
void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep step) void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep step)
{ {
Benchmark bench; Benchmark bench;
@ -219,7 +212,7 @@ void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep st
// If that fails for any of the drillholes, the voxelization fallback is // If that fails for any of the drillholes, the voxelization fallback is
// used. // used.
bool is_pure_model = is_all_positive(parts_to_slice(po.m_mesh_to_slice, slaposAssembly)); bool is_pure_model = is_all_positive(po.get_parts_to_slice(slaposAssembly));
bool can_hollow = po.m_hollowing_data && po.m_hollowing_data->interior && bool can_hollow = po.m_hollowing_data && po.m_hollowing_data->interior &&
!sla::get_mesh(*po.m_hollowing_data->interior).empty(); !sla::get_mesh(*po.m_hollowing_data->interior).empty();