OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::sla::SupportTree Class Referenceabstract

The class containing mesh data for the generated supports. More...

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/SLA/SupportTree.hpp>

Inheritance diagram for Slic3r::sla::SupportTree:
Collaboration diagram for Slic3r::sla::SupportTree:

Public Types

using UPtr = std::unique_ptr<SupportTree>

Public Member Functions

virtual ~SupportTree ()=default
virtual const indexed_triangle_set & retrieve_mesh (MeshType meshtype) const =0
virtual const indexed_triangle_set & add_pad (const ExPolygons &modelbase, const PadConfig &pcfg)=0
 Adding the "pad" under the supports. modelbase will be used according to the embed_object flag in PoolConfig. If set, the plate will be interpreted as the model's intrinsic pad. Otherwise, the modelbase will be unified with the base plate calculated from the supports.
virtual void remove_pad ()=0
std::vector< ExPolygons > slice (const std::vector< float > &, float closing_radius) const
void retrieve_full_mesh (indexed_triangle_set &outmesh) const
const JobController & ctl () const

Static Public Member Functions

static UPtr create (const SupportableMesh &input, const JobController &ctl={})

Private Attributes

JobController m_ctl

Detailed Description

The class containing mesh data for the generated supports.

Member Typedef Documentation

◆ UPtr

using Slic3r::sla::SupportTree::UPtr = std::unique_ptr<SupportTree>

Constructor & Destructor Documentation

◆ ~SupportTree()

virtual Slic3r::sla::SupportTree::~SupportTree ( )
virtualdefault

Member Function Documentation

◆ add_pad()

virtual const indexed_triangle_set & Slic3r::sla::SupportTree::add_pad ( const ExPolygons & modelbase,
const PadConfig & pcfg )
pure virtual

Adding the "pad" under the supports. modelbase will be used according to the embed_object flag in PoolConfig. If set, the plate will be interpreted as the model's intrinsic pad. Otherwise, the modelbase will be unified with the base plate calculated from the supports.

Implemented in Slic3r::sla::SupportTreeBuilder.

◆ create()

SupportTree::UPtr Slic3r::sla::SupportTree::create ( const SupportableMesh & input,
const JobController & ctl = {} )
static
89{
90 auto builder = make_unique<SupportTreeBuilder>();
91 builder->m_ctl = ctl;
92
93 if (sm.cfg.enabled) {
94 // Execute takes care about the ground_level
96 builder->merge_and_cleanup(); // clean metadata, leave only the meshes.
97 } else {
98 // If a pad gets added later, it will be in the right Z level
99 builder->ground_level = sm.emesh.ground_level();
100 }
101
102 return std::move(builder);
103}
static bool execute(SupportTreeBuilder &builder, const SupportableMesh &sm)
Definition SupportTreeBuildsteps.cpp:80
const JobController & ctl() const
Definition SupportTree.hpp:168
std::unique_ptr< T > make_unique(Args &&... args)
Definition libslic3r.h:239

References Slic3r::sla::SupportableMesh::cfg, ctl(), Slic3r::sla::SupportableMesh::emesh, Slic3r::sla::SupportTreeConfig::enabled, Slic3r::sla::SupportTreeBuildsteps::execute(), Slic3r::sla::IndexedMesh::ground_level(), and Slic3r::make_unique().

Referenced by Slic3r::SLAPrintObject::SupportData::create_support_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl()

const JobController & Slic3r::sla::SupportTree::ctl ( ) const
inline
168{ return m_ctl; }
JobController m_ctl
Definition SupportTree.hpp:142

References m_ctl.

Referenced by Slic3r::sla::SupportTreeBuilder::add_pad(), create(), Slic3r::sla::SupportTreeBuildsteps::execute(), Slic3r::sla::SupportTreeBuilder::merged_mesh(), and slice().

Here is the caller graph for this function:

◆ remove_pad()

virtual void Slic3r::sla::SupportTree::remove_pad ( )
pure virtual

◆ retrieve_full_mesh()

void Slic3r::sla::SupportTree::retrieve_full_mesh ( indexed_triangle_set & outmesh) const
36 {
39}
virtual const indexed_triangle_set & retrieve_mesh(MeshType meshtype) const =0
@ Support
Definition SupportTree.hpp:117
@ Pad
Definition SupportTree.hpp:117
void its_merge(indexed_triangle_set &A, const indexed_triangle_set &B)
Definition TriangleMesh.cpp:1448

References Slic3r::its_merge(), Slic3r::sla::Pad, retrieve_mesh(), and Slic3r::sla::Support.

Here is the call graph for this function:

◆ retrieve_mesh()

virtual const indexed_triangle_set & Slic3r::sla::SupportTree::retrieve_mesh ( MeshType meshtype) const
pure virtual

Implemented in Slic3r::sla::SupportTreeBuilder.

Referenced by retrieve_full_mesh(), and slice().

Here is the caller graph for this function:

◆ slice()

std::vector< ExPolygons > Slic3r::sla::SupportTree::slice ( const std::vector< float > & grid,
float closing_radius ) const
43{
44 const indexed_triangle_set &sup_mesh = retrieve_mesh(MeshType::Support);
45 const indexed_triangle_set &pad_mesh = retrieve_mesh(MeshType::Pad);
46
47 using Slices = std::vector<ExPolygons>;
48 auto slices = reserve_vector<Slices>(2);
49
50 if (!sup_mesh.empty()) {
51 slices.emplace_back();
52 slices.back() = slice_mesh_ex(sup_mesh, grid, cr, ctl().cancelfn);
53 }
54
55 if (!pad_mesh.empty()) {
56 slices.emplace_back();
57
58 auto bb = bounding_box(pad_mesh);
59 auto maxzit = std::upper_bound(grid.begin(), grid.end(), bb.max.z());
60
61 auto cap = grid.end() - maxzit;
62 auto padgrid = reserve_vector<float>(size_t(cap > 0 ? cap : 0));
63 std::copy(grid.begin(), maxzit, std::back_inserter(padgrid));
64
65 slices.back() = slice_mesh_ex(pad_mesh, padgrid, cr, ctl().cancelfn);
66 }
67
68 size_t len = grid.size();
69 for (const Slices &slv : slices) { len = std::min(len, slv.size()); }
70
71 // Either the support or the pad or both has to be non empty
72 if (slices.empty()) return {};
73
74 Slices &mrg = slices.front();
75
76 for (auto it = std::next(slices.begin()); it != slices.end(); ++it) {
77 for (size_t i = 0; i < len; ++i) {
78 Slices &slv = *it;
79 std::copy(slv[i].begin(), slv[i].end(), std::back_inserter(mrg[i]));
80 slv[i] = {}; // clear and delete
81 }
82 }
83
84 return mrg;
85}
T * begin(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:838
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:841
BoundingBoxf3 bounding_box(const TriangleMesh &m)
Definition TriangleMesh.hpp:391
IntegerOnly< I, std::vector< T, Args... > > reserve_vector(I capacity)
Definition libslic3r.h:370
std::vector< ArithmeticOnly< T > > grid(const T &start, const T &stop, const T &stride)
A set of equidistant values starting from 'start' (inclusive), ending in the closest multiple of 'str...
Definition MTUtils.hpp:127
std::vector< ExPolygons > slice_mesh_ex(const indexed_triangle_set &mesh, const std::vector< float > &zs, const MeshSlicingParamsEx &params, std::function< void()> throw_on_cancel)
Definition TriangleMeshSlicer.cpp:2142

References Slic3r::bounding_box(), ctl(), Slic3r::grid(), Slic3r::sla::Pad, Slic3r::reserve_vector(), retrieve_mesh(), Slic3r::slice_mesh_ex(), and Slic3r::sla::Support.

Here is the call graph for this function:

Member Data Documentation

◆ m_ctl

JobController Slic3r::sla::SupportTree::m_ctl
private

Referenced by ctl().


The documentation for this class was generated from the following files: