Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ModelVolume Class Referencefinal

#include <src/libslic3r/Model.hpp>

+ Inheritance diagram for Slic3r::ModelVolume:
+ Collaboration diagram for Slic3r::ModelVolume:

Classes

struct  CutInfo
 
struct  Source
 

Public Types

using Timestamp = uint64_t
 

Public Member Functions

bool is_cut_connector () const
 
void invalidate_cut_info ()
 
const TriangleMeshmesh () const
 
std::shared_ptr< const TriangleMeshmesh_ptr () const
 
void set_mesh (const TriangleMesh &mesh)
 
void set_mesh (TriangleMesh &&mesh)
 
void set_mesh (const indexed_triangle_set &mesh)
 
void set_mesh (indexed_triangle_set &&mesh)
 
void set_mesh (std::shared_ptr< const TriangleMesh > &mesh)
 
void set_mesh (std::unique_ptr< const TriangleMesh > &&mesh)
 
void reset_mesh ()
 
const std::shared_ptr< const TriangleMesh > & get_mesh_shared_ptr () const
 
ModelObjectget_object () const
 
ModelVolumeType type () const
 
void set_type (const ModelVolumeType t)
 
bool is_model_part () const
 
bool is_negative_volume () const
 
bool is_modifier () const
 
bool is_support_enforcer () const
 
bool is_support_blocker () const
 
bool is_support_modifier () const
 
bool is_text () const
 
bool is_the_only_one_part () const
 
t_model_material_id material_id () const
 
void reset_extra_facets ()
 
void apply_tolerance ()
 
void set_material_id (t_model_material_id material_id)
 
ModelMaterialmaterial () const
 
void set_material (t_model_material_id material_id, const ModelMaterial &material)
 
int extruder_id () const
 
bool is_splittable () const
 
size_t split (unsigned int max_extruders)
 
void translate (double x, double y, double z)
 
void translate (const Vec3d &displacement)
 
void scale (const Vec3d &scaling_factors)
 
void scale (double x, double y, double z)
 
void scale (double s)
 
void rotate (double angle, Axis axis)
 
void rotate (double angle, const Vec3d &axis)
 
void mirror (Axis axis)
 
void scale_geometry_after_creation (const Vec3f &versor)
 
void scale_geometry_after_creation (const float scale)
 
void center_geometry_after_creation (bool update_source_offset=true)
 
void calculate_convex_hull ()
 
const TriangleMeshget_convex_hull () const
 
const std::shared_ptr< const TriangleMesh > & get_convex_hull_shared_ptr () const
 
int get_repaired_errors_count () const
 
const Geometry::Transformationget_transformation () const
 
void set_transformation (const Geometry::Transformation &transformation)
 
void set_transformation (const Transform3d &trafo)
 
Vec3d get_offset () const
 
double get_offset (Axis axis) const
 
void set_offset (const Vec3d &offset)
 
void set_offset (Axis axis, double offset)
 
Vec3d get_rotation () const
 
double get_rotation (Axis axis) const
 
void set_rotation (const Vec3d &rotation)
 
void set_rotation (Axis axis, double rotation)
 
Vec3d get_scaling_factor () const
 
double get_scaling_factor (Axis axis) const
 
void set_scaling_factor (const Vec3d &scaling_factor)
 
void set_scaling_factor (Axis axis, double scaling_factor)
 
Vec3d get_mirror () const
 
double get_mirror (Axis axis) const
 
bool is_left_handed () const
 
void set_mirror (const Vec3d &mirror)
 
void set_mirror (Axis axis, double mirror)
 
void convert_from_imperial_units ()
 
void convert_from_meters ()
 
const Transform3dget_matrix () const
 
Transform3d get_matrix_no_offset () const
 
void set_new_unique_id ()
 
bool is_fdm_support_painted () const
 
bool is_seam_painted () const
 
bool is_mm_painted () const
 
ObjectID id () const
 
virtual Timestamp timestamp () const
 

Static Public Member Functions

static ModelVolumeType type_from_string (const std::string &s)
 
static std::string type_to_string (const ModelVolumeType t)
 

Public Attributes

std::string name
 
Source source
 
CutInfo cut_info
 
ModelConfigObject config
 
FacetsAnnotation supported_facets
 
FacetsAnnotation seam_facets
 
FacetsAnnotation mmu_segmentation_facets
 
std::optional< TextConfigurationtext_configuration
 

Protected Member Functions

 ModelVolume (const ModelVolume &rhs)=default
 
void set_model_object (ModelObject *model_object)
 
void assign_new_unique_ids_recursive () override
 
void transform_this_mesh (const Transform3d &t, bool fix_left_handed)
 
void transform_this_mesh (const Matrix3d &m, bool fix_left_handed)
 
void set_invalid_id ()
 
void copy_id (const ObjectBase &rhs)
 

Private Member Functions

bool check ()
 
 ModelVolume (ModelObject *object, const TriangleMesh &mesh, ModelVolumeType type=ModelVolumeType::MODEL_PART)
 
 ModelVolume (ModelObject *object, TriangleMesh &&mesh, ModelVolumeType type=ModelVolumeType::MODEL_PART)
 
 ModelVolume (ModelObject *object, TriangleMesh &&mesh, TriangleMesh &&convex_hull, ModelVolumeType type=ModelVolumeType::MODEL_PART)
 
 ModelVolume (ModelObject *object, const ModelVolume &other)
 
 ModelVolume (ModelObject *object, const ModelVolume &other, TriangleMesh &&mesh)
 
ModelVolumeoperator= (ModelVolume &rhs)=delete
 
 ModelVolume ()
 
template<class Archive >
void load (Archive &ar)
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void serialize (Archive &ar)
 

Static Private Member Functions

static ObjectID generate_new_id ()
 
template<class Archive >
static void load_and_construct (Archive &ar, cereal::construct< ObjectBase > &construct)
 

Private Attributes

ModelObjectobject
 
std::shared_ptr< const TriangleMeshm_mesh
 
ModelVolumeType m_type
 
t_model_material_id m_material_id
 
std::shared_ptr< const TriangleMeshm_convex_hull
 
Geometry::Transformation m_transformation
 
int m_is_splittable { -1 }
 
ObjectID m_id
 

Static Private Attributes

static size_t s_last_id = 0
 

Friends

class Print
 
class SLAPrint
 
class Model
 
class ModelObject
 
class cereal::access
 
class UndoRedo::StackImpl
 
void model_volume_list_update_supports (ModelObject &model_object_dst, const ModelObject &model_object_new)
 

Detailed Description

Member Typedef Documentation

◆ Timestamp

Constructor & Destructor Documentation

◆ ModelVolume() [1/7]

Slic3r::ModelVolume::ModelVolume ( const ModelVolume rhs)
explicitprotecteddefault

◆ ModelVolume() [2/7]

Slic3r::ModelVolume::ModelVolume ( ModelObject object,
const TriangleMesh mesh,
ModelVolumeType  type = ModelVolumeType::MODEL_PART 
)
inlineprivate
982 :
983 m_mesh(new TriangleMesh(mesh)), m_type(type), object(object)
984 {
985 assert(check());
986 if (m_mesh->facets_count() > 1) calculate_convex_hull();
987 }
void calculate_convex_hull()
Definition Model.cpp:2098
const TriangleMesh & mesh() const
Definition Model.hpp:808
std::shared_ptr< const TriangleMesh > m_mesh
Definition Model.hpp:955
bool check()
Definition Model.hpp:969
ModelVolumeType type() const
Definition Model.hpp:837
ModelObject * object
Definition Model.hpp:953
ModelVolumeType m_type
Definition Model.hpp:957

References calculate_convex_hull(), check(), and m_mesh.

+ Here is the call graph for this function:

◆ ModelVolume() [3/7]

Slic3r::ModelVolume::ModelVolume ( ModelObject object,
TriangleMesh &&  mesh,
ModelVolumeType  type = ModelVolumeType::MODEL_PART 
)
inlineprivate
989 : m_mesh(new TriangleMesh(std::move(mesh))), m_type(type), object(object)
990 {
991 assert(check());
992 if (m_mesh->facets_count() > 1) calculate_convex_hull();
993 }

References calculate_convex_hull(), check(), and m_mesh.

+ Here is the call graph for this function:

◆ ModelVolume() [4/7]

Slic3r::ModelVolume::ModelVolume ( ModelObject object,
TriangleMesh &&  mesh,
TriangleMesh &&  convex_hull,
ModelVolumeType  type = ModelVolumeType::MODEL_PART 
)
inlineprivate
994 :
995 m_mesh(new TriangleMesh(std::move(mesh))), m_convex_hull(new TriangleMesh(std::move(convex_hull))), m_type(type), object(object) {
996 assert(check());
997 }
std::shared_ptr< const TriangleMesh > m_convex_hull
Definition Model.hpp:960

References check().

+ Here is the call graph for this function:

◆ ModelVolume() [5/7]

Slic3r::ModelVolume::ModelVolume ( ModelObject object,
const ModelVolume other 
)
inlineprivate
1000 :
1001 ObjectBase(other),
1002 name(other.name), source(other.source), m_mesh(other.m_mesh), m_convex_hull(other.m_convex_hull),
1003 config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation),
1004 supported_facets(other.supported_facets), seam_facets(other.seam_facets), mmu_segmentation_facets(other.mmu_segmentation_facets),
1005 cut_info(other.cut_info),
1006 text_configuration(other.text_configuration)
1007 {
1008 assert(this->id().valid());
1009 assert(this->config.id().valid());
1010 assert(this->supported_facets.id().valid());
1011 assert(this->seam_facets.id().valid());
1012 assert(this->mmu_segmentation_facets.id().valid());
1013 assert(this->id() != this->config.id());
1014 assert(this->id() != this->supported_facets.id());
1015 assert(this->id() != this->seam_facets.id());
1016 assert(this->id() != this->mmu_segmentation_facets.id());
1017 assert(this->id() == other.id());
1018 assert(this->config.id() == other.config.id());
1019 assert(this->supported_facets.id() == other.supported_facets.id());
1020 assert(this->seam_facets.id() == other.seam_facets.id());
1021 assert(this->mmu_segmentation_facets.id() == other.mmu_segmentation_facets.id());
1022 this->set_material_id(other.material_id());
1023 }
Geometry::Transformation m_transformation
Definition Model.hpp:961
FacetsAnnotation mmu_segmentation_facets
Definition Model.hpp:829
CutInfo cut_info
Definition Model.hpp:802
void set_material_id(t_model_material_id material_id)
Definition Model.cpp:2040
FacetsAnnotation supported_facets
Definition Model.hpp:823
FacetsAnnotation seam_facets
Definition Model.hpp:826
ModelConfigObject config
Definition Model.hpp:820
std::string name
Definition Model.hpp:755
Source source
Definition Model.hpp:774
std::optional< TextConfiguration > text_configuration
Definition Model.hpp:833
ObjectBase()
Definition ObjectID.hpp:65
ObjectID id() const
Definition ObjectID.hpp:55
bool valid() const
Definition ObjectID.hpp:34
size_t id
Definition ObjectID.hpp:37

References config, Slic3r::ObjectBase::id(), material_id(), mmu_segmentation_facets, seam_facets, set_material_id(), supported_facets, and Slic3r::ObjectID::valid().

+ Here is the call graph for this function:

◆ ModelVolume() [6/7]

Slic3r::ModelVolume::ModelVolume ( ModelObject object,
const ModelVolume other,
TriangleMesh &&  mesh 
)
inlineprivate
1025 :
1026 name(other.name), source(other.source), config(other.config), object(object), m_mesh(new TriangleMesh(std::move(mesh))), m_type(other.m_type), m_transformation(other.m_transformation),
1027 cut_info(other.cut_info),
1028 text_configuration(other.text_configuration)
1029 {
1030 assert(this->id().valid());
1031 assert(this->config.id().valid());
1032 assert(this->supported_facets.id().valid());
1033 assert(this->seam_facets.id().valid());
1034 assert(this->mmu_segmentation_facets.id().valid());
1035 assert(this->id() != this->config.id());
1036 assert(this->id() != this->supported_facets.id());
1037 assert(this->id() != this->seam_facets.id());
1038 assert(this->id() != this->mmu_segmentation_facets.id());
1039 assert(this->id() != other.id());
1040 assert(this->config.id() == other.config.id());
1041 this->set_material_id(other.material_id());
1042 this->config.set_new_unique_id();
1043 if (m_mesh->facets_count() > 1)
1045 assert(this->config.id().valid());
1046 assert(this->config.id() != other.config.id());
1047 assert(this->supported_facets.id() != other.supported_facets.id());
1048 assert(this->seam_facets.id() != other.seam_facets.id());
1049 assert(this->mmu_segmentation_facets.id() != other.mmu_segmentation_facets.id());
1050 assert(this->id() != this->config.id());
1051 assert(this->supported_facets.empty());
1052 assert(this->seam_facets.empty());
1053 assert(this->mmu_segmentation_facets.empty());
1054 }
bool empty() const
Definition Model.hpp:704
void set_new_unique_id()
Definition ObjectID.hpp:73

References calculate_convex_hull(), config, Slic3r::FacetsAnnotation::empty(), Slic3r::ObjectBase::id(), m_mesh, material_id(), mmu_segmentation_facets, seam_facets, set_material_id(), Slic3r::ObjectBase::set_new_unique_id(), supported_facets, and Slic3r::ObjectID::valid().

+ Here is the call graph for this function:

◆ ModelVolume() [7/7]

Slic3r::ModelVolume::ModelVolume ( )
inlineprivate
1061 : ObjectBase(-1), config(-1), supported_facets(-1), seam_facets(-1), mmu_segmentation_facets(-1), object(nullptr) {
1062 assert(this->id().invalid());
1063 assert(this->config.id().invalid());
1064 assert(this->supported_facets.id().invalid());
1065 assert(this->seam_facets.id().invalid());
1066 assert(this->mmu_segmentation_facets.id().invalid());
1067 }
bool invalid() const
Definition ObjectID.hpp:35

References Slic3r::ObjectBase::id(), and Slic3r::ObjectID::invalid().

+ Here is the call graph for this function:

Member Function Documentation

◆ apply_tolerance()

void Slic3r::ModelVolume::apply_tolerance ( )
1394{
1395 assert(cut_info.is_connector);
1397 return;
1398
1400
1401 // make a "hole" wider
1402 sf[X] += double(cut_info.radius_tolerance);
1403 sf[Y] += double(cut_info.radius_tolerance);
1404
1405 // make a "hole" dipper
1406 sf[Z] += double(cut_info.height_tolerance);
1407
1409
1410 // correct offset in respect to the new depth
1411 Vec3d rot_norm = Geometry::rotation_transform(get_rotation()) * Vec3d::UnitZ();
1412 if (rot_norm.norm() != 0.0)
1413 rot_norm.normalize();
1414
1415 double z_offset = 0.5 * static_cast<double>(cut_info.height_tolerance);
1417 z_offset -= 0.05; // add small Z offset to better preview
1418
1419 set_offset(get_offset() + rot_norm * z_offset);
1420}
Vec3d get_offset() const
Definition Model.hpp:894
Vec3d get_scaling_factor() const
Definition Model.hpp:907
void set_offset(const Vec3d &offset)
Definition Model.hpp:898
void set_scaling_factor(const Vec3d &scaling_factor)
Definition Model.hpp:910
Vec3d get_rotation() const
Definition Model.hpp:901
void rotation_transform(Transform3d &transform, const Vec3d &rotation)
Definition Geometry.cpp:341
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:52
@ Y
Definition libslic3r.h:99
@ Z
Definition libslic3r.h:100
@ X
Definition libslic3r.h:98
bool is_connector
Definition Model.hpp:780
CutConnectorType connector_type
Definition Model.hpp:782
float radius_tolerance
Definition Model.hpp:783
float height_tolerance
Definition Model.hpp:784
bool is_processed
Definition Model.hpp:781

References Slic3r::X, Slic3r::Y, and Slic3r::Z.

Referenced by Slic3r::ModelObject::process_connector_cut().

+ Here is the caller graph for this function:

◆ assign_new_unique_ids_recursive()

void Slic3r::ModelVolume::assign_new_unique_ids_recursive ( )
overrideprotectedvirtual

◆ calculate_convex_hull()

void Slic3r::ModelVolume::calculate_convex_hull ( )
2099{
2100 m_convex_hull = std::make_shared<TriangleMesh>(this->mesh().convex_hull_3d());
2101 assert(m_convex_hull.get());
2102}

Referenced by ModelVolume(), ModelVolume(), ModelVolume(), Slic3r::AMFParserContext::endElement(), and load().

+ Here is the caller graph for this function:

◆ center_geometry_after_creation()

void Slic3r::ModelVolume::center_geometry_after_creation ( bool  update_source_offset = true)
2083{
2084 Vec3d shift = this->mesh().bounding_box().center();
2085 if (!shift.isApprox(Vec3d::Zero()))
2086 {
2087 if (m_mesh)
2088 const_cast<TriangleMesh*>(m_mesh.get())->translate(-(float)shift(0), -(float)shift(1), -(float)shift(2));
2089 if (m_convex_hull)
2090 const_cast<TriangleMesh*>(m_convex_hull.get())->translate(-(float)shift(0), -(float)shift(1), -(float)shift(2));
2091 translate(shift);
2092 }
2093
2094 if (update_source_offset)
2095 source.mesh_offset = shift;
2096}
PointType center() const
Definition BoundingBox.cpp:203
void translate(double x, double y, double z)
Definition Model.hpp:863
BoundingBoxf3 bounding_box() const
Definition TriangleMesh.cpp:432
Vec3d mesh_offset
Definition Model.hpp:762

References Slic3r::TriangleMesh::bounding_box(), and Slic3r::BoundingBox3Base< PointType >::center().

Referenced by Slic3r::ModelObject::add_volume(), Slic3r::ModelObject::add_volume(), Slic3r::ModelObject::add_volume(), and Slic3r::AMFParserContext::endElement().

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

◆ check()

bool Slic3r::ModelVolume::check ( )
inlineprivate
969 {
970 assert(this->id().valid());
971 assert(this->config.id().valid());
972 assert(this->supported_facets.id().valid());
973 assert(this->seam_facets.id().valid());
974 assert(this->mmu_segmentation_facets.id().valid());
975 assert(this->id() != this->config.id());
976 assert(this->id() != this->supported_facets.id());
977 assert(this->id() != this->seam_facets.id());
978 assert(this->id() != this->mmu_segmentation_facets.id());
979 return true;
980 }

References Slic3r::ObjectBase::id(), and Slic3r::ObjectID::valid().

Referenced by ModelVolume(), ModelVolume(), and ModelVolume().

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

◆ convert_from_imperial_units()

void Slic3r::ModelVolume::convert_from_imperial_units ( )
2307{
2308 assert(! this->source.is_converted_from_meters);
2309 this->scale_geometry_after_creation(25.4f);
2310 this->set_offset(Vec3d(0, 0, 0));
2311 this->source.is_converted_from_inches = true;
2312}
void scale_geometry_after_creation(const Vec3f &versor)
Definition Model.cpp:2276
bool is_converted_from_inches
Definition Model.hpp:764
bool is_converted_from_meters
Definition Model.hpp:765

Referenced by Slic3r::GUI::Plater::priv::reload_from_disk(), and Slic3r::GUI::Plater::priv::replace_volume_with_stl().

+ Here is the caller graph for this function:

◆ convert_from_meters()

void Slic3r::ModelVolume::convert_from_meters ( )
2315{
2316 assert(! this->source.is_converted_from_inches);
2317 this->scale_geometry_after_creation(1000.f);
2318 this->set_offset(Vec3d(0, 0, 0));
2319 this->source.is_converted_from_meters = true;
2320}

Referenced by Slic3r::GUI::Plater::priv::reload_from_disk(), and Slic3r::GUI::Plater::priv::replace_volume_with_stl().

+ Here is the caller graph for this function:

◆ copy_id()

void Slic3r::ObjectBase::copy_id ( const ObjectBase rhs)
inlineprotectedinherited
76{ m_id = rhs.id(); }
ObjectID m_id
Definition ObjectID.hpp:82

References Slic3r::ObjectBase::id(), and Slic3r::ObjectBase::m_id.

Referenced by Slic3r::CutObjectBase::copy().

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

◆ extruder_id()

int Slic3r::ModelVolume::extruder_id ( ) const
2062{
2063 int extruder_id = -1;
2064 if (this->is_model_part()) {
2065 const ConfigOption *opt = this->config.option("extruder");
2066 if ((opt == nullptr) || (opt->getInt() == 0))
2067 opt = this->object->config.option("extruder");
2068 extruder_id = (opt == nullptr) ? 0 : opt->getInt();
2069 }
2070 return extruder_id;
2071}
const ConfigOption * option(const t_config_option_key &opt_key) const
Definition PrintConfig.hpp:1275
int extruder_id() const
Definition Model.cpp:2061
bool is_model_part() const
Definition Model.hpp:839

References Slic3r::ConfigOption::getInt().

Referenced by Slic3r::GLVolumeCollection::load_object_volume().

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

◆ generate_new_id()

static ObjectID Slic3r::ObjectBase::generate_new_id ( )
inlinestaticprivateinherited
84{ return ObjectID(++ s_last_id); }
static size_t s_last_id
Definition ObjectID.hpp:85

References Slic3r::ObjectBase::s_last_id.

Referenced by Slic3r::ObjectBase::set_new_unique_id().

+ Here is the caller graph for this function:

◆ get_convex_hull()

const TriangleMesh & Slic3r::ModelVolume::get_convex_hull ( ) const
2113{
2114 return *m_convex_hull.get();
2115}

◆ get_convex_hull_shared_ptr()

const std::shared_ptr< const TriangleMesh > & Slic3r::ModelVolume::get_convex_hull_shared_ptr ( ) const
inline
882{ return m_convex_hull; }

References m_convex_hull.

Referenced by Slic3r::GLVolumeCollection::load_object_volume().

+ Here is the caller graph for this function:

◆ get_matrix()

const Transform3d & Slic3r::ModelVolume::get_matrix ( ) const
inline
922{ return m_transformation.get_matrix(); }
const Transform3d & get_matrix() const
Definition Geometry.hpp:437

References Slic3r::Geometry::Transformation::get_matrix(), and m_transformation.

Referenced by Slic3r::GUI::ObjectList::merge(), Slic3r::model_volume_list_changed(), Slic3r::GUI::GLGizmoCut3D::perform_cut(), Slic3r::GUI::GLGizmoEmboss::process(), and Slic3r::GUI::Sidebar::show_info_sizer().

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

◆ get_matrix_no_offset()

Transform3d Slic3r::ModelVolume::get_matrix_no_offset ( ) const
inline
Transform3d get_matrix_no_offset() const
Definition Geometry.cpp:612

References Slic3r::Geometry::Transformation::get_matrix_no_offset(), and m_transformation.

+ Here is the call graph for this function:

◆ get_mesh_shared_ptr()

const std::shared_ptr< const TriangleMesh > & Slic3r::ModelVolume::get_mesh_shared_ptr ( ) const
inline
817{ return m_mesh; }

References m_mesh.

◆ get_mirror() [1/2]

Vec3d Slic3r::ModelVolume::get_mirror ( ) const
inline
913{ return m_transformation.get_mirror(); }
Vec3d get_mirror() const
Definition Geometry.cpp:522

References Slic3r::Geometry::Transformation::get_mirror(), and m_transformation.

+ Here is the call graph for this function:

◆ get_mirror() [2/2]

double Slic3r::ModelVolume::get_mirror ( Axis  axis) const
inline
914{ return m_transformation.get_mirror(axis); }

References Slic3r::Geometry::Transformation::get_mirror(), and m_transformation.

+ Here is the call graph for this function:

◆ get_object()

ModelObject * Slic3r::ModelVolume::get_object ( ) const
inline
836{ return this->object; }

References object.

Referenced by Slic3r::GUI::Emboss::create_volume_sources(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_window(), Slic3r::GUI::GLGizmoEmboss::get_minimal_window_size(), Slic3r::GUI::GLGizmoEmboss::process(), and Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection().

+ Here is the caller graph for this function:

◆ get_offset() [1/2]

Vec3d Slic3r::ModelVolume::get_offset ( ) const
inline
894{ return m_transformation.get_offset(); }
Vec3d get_offset() const
Definition Geometry.hpp:387

References Slic3r::Geometry::Transformation::get_offset(), and m_transformation.

Referenced by Slic3r::ModelObject::split().

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

◆ get_offset() [2/2]

double Slic3r::ModelVolume::get_offset ( Axis  axis) const
inline
896{ return m_transformation.get_offset(axis); }

References Slic3r::Geometry::Transformation::get_offset(), and m_transformation.

+ Here is the call graph for this function:

◆ get_repaired_errors_count()

int Slic3r::ModelVolume::get_repaired_errors_count ( ) const
2105{
2106 const RepairedMeshErrors &stats = this->mesh().stats().repaired_errors;
2107
2108 return stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
2109 stats.facets_reversed + stats.backwards_edges;
2110}
const TriangleMeshStats & stats() const
Definition TriangleMesh.hpp:153
int degenerate_facets
Definition TriangleMesh.hpp:23
RepairedMeshErrors repaired_errors
Definition TriangleMesh.hpp:60

References Slic3r::RepairedMeshErrors::backwards_edges, Slic3r::RepairedMeshErrors::degenerate_facets, Slic3r::RepairedMeshErrors::edges_fixed, Slic3r::RepairedMeshErrors::facets_removed, Slic3r::RepairedMeshErrors::facets_reversed, Slic3r::TriangleMeshStats::repaired_errors, and Slic3r::TriangleMesh::stats().

+ Here is the call graph for this function:

◆ get_rotation() [1/2]

Vec3d Slic3r::ModelVolume::get_rotation ( ) const
inline
901{ return m_transformation.get_rotation(); }
Vec3d get_rotation() const
Definition Geometry.cpp:454

References Slic3r::Geometry::Transformation::get_rotation(), and m_transformation.

+ Here is the call graph for this function:

◆ get_rotation() [2/2]

double Slic3r::ModelVolume::get_rotation ( Axis  axis) const
inline
902{ return m_transformation.get_rotation(axis); }

References Slic3r::Geometry::Transformation::get_rotation(), and m_transformation.

+ Here is the call graph for this function:

◆ get_scaling_factor() [1/2]

Vec3d Slic3r::ModelVolume::get_scaling_factor ( ) const
inline
Vec3d get_scaling_factor() const
Definition Geometry.cpp:486

References Slic3r::Geometry::Transformation::get_scaling_factor(), and m_transformation.

+ Here is the call graph for this function:

◆ get_scaling_factor() [2/2]

double Slic3r::ModelVolume::get_scaling_factor ( Axis  axis) const
inline
908{ return m_transformation.get_scaling_factor(axis); }

References Slic3r::Geometry::Transformation::get_scaling_factor(), and m_transformation.

+ Here is the call graph for this function:

◆ get_transformation()

const Geometry::Transformation & Slic3r::ModelVolume::get_transformation ( ) const
inline
890{ return m_transformation; }

References m_transformation.

Referenced by Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::ModelObject::delete_volume(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::GUI::Plater::priv::reload_from_disk(), and Slic3r::GUI::Plater::priv::replace_volume_with_stl().

+ Here is the caller graph for this function:

◆ id()

ObjectID Slic3r::ObjectBase::id ( ) const
inlineinherited
55{ return m_id; }

References Slic3r::ObjectBase::m_id.

Referenced by Slic3r::Model::Model(), Slic3r::ModelInstance::ModelInstance(), Slic3r::ModelMaterial::ModelMaterial(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), ModelVolume(), ModelVolume(), ModelVolume(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::GUI::Plater::priv::actualize_slicing_warnings(), Slic3r::ModelObjectStatusDB::add(), Slic3r::ModelObjectStatusDB::add_if_new(), Slic3r::Print::apply(), Slic3r::SLAPrint::apply(), Slic3r::GUI::GLGizmoFdmSupports::apply_data_from_backend(), check(), Slic3r::check_model_ids_equal(), Slic3r::ModelObject::convert_units(), Slic3r::ObjectBase::copy_id(), Slic3r::PrintObjectStatusDB::count(), anonymous_namespace{RaycastManager.cpp}::create_key(), priv::create_volume(), Slic3r::GUI::Emboss::create_volume_sources(), Slic3r::GUI::GLGizmoHollow::data_changed(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GUI::GLGizmoSlaSupports::data_changed(), Slic3r::Model::delete_object(), Slic3r::GUI::Plater::export_stl_obj(), Slic3r::ModelObjectStatusDB::get(), Slic3r::GUI::get_arrange_poly(), Slic3r::GUI::GLGizmoSlaSupports::get_data_from_backend(), Slic3r::PrintObjectStatusDB::get_range(), Slic3r::GUI::GLGizmoFdmSupports::has_backend_supports(), Slic3r::GUI::GLGizmoSlaSupports::has_backend_supports(), Slic3r::CutObjectBase::has_same_id(), Slic3r::UndoRedo::StackImpl::immutable_object_id_impl(), Slic3r::GUI::GLGizmoSimplify::init_model(), Slic3r::inner_brim_area(), Slic3r::ModelObject::is_cut(), Slic3r::CutObjectBase::is_equal(), Slic3r::ObjectBase::load_and_construct(), Slic3r::UndoRedo::StackImpl::load_snapshot(), Slic3r::GUI::ObjectList::merge(), Slic3r::model_property_changed(), Slic3r::model_volume_list_changed(), Slic3r::model_volume_list_copy_configs(), Slic3r::ModelConfigObject::object_id_and_timestamp_match(), Slic3r::ObjectWithTimestamp::object_id_and_timestamp_match(), Slic3r::GUI::GLGizmoEmboss::on_mouse_change_selection(), Slic3r::GUI::CommonGizmosDataObjects::SelectionInfo::on_update(), Slic3r::CutObjectBase::operator<(), Slic3r::Model::operator=(), Slic3r::ModelObject::operator=(), Slic3r::ModelObject::operator=(), Slic3r::CutObjectBase::operator==(), Slic3r::GUI::GLGizmoCut3D::perform_cut(), Slic3r::GUI::GLGizmoEmboss::process(), Slic3r::GUI::processed_objects_idxs(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::GLCanvas3D::LayersEditing::select_object(), Slic3r::ModelMaterial::serialize(), Slic3r::SLAPrintObject::SliceRecord::set_model_slice_idx(), Slic3r::SLAPrintObject::SliceRecord::set_support_slice_idx(), Slic3r::slices_to_regions(), Slic3r::ModelObject::split(), Slic3r::UndoRedo::StackImpl::take_snapshot(), Slic3r::top_level_outer_brim_area(), Slic3r::GUI::update_object_cut_id(), and anonymous_namespace{EmbossJob.cpp}::update_volume_name().

◆ invalidate_cut_info()

void Slic3r::ModelVolume::invalidate_cut_info ( )
inline
805{ cut_info.invalidate(); }
void invalidate()
Definition Model.hpp:796

References cut_info, and Slic3r::ModelVolume::CutInfo::invalidate().

+ Here is the call graph for this function:

◆ is_cut_connector()

bool Slic3r::ModelVolume::is_cut_connector ( ) const
inline

References cut_info, Slic3r::ModelVolume::CutInfo::is_connector, and Slic3r::ModelVolume::CutInfo::is_processed.

Referenced by Slic3r::GUI::GLGizmoCut3D::perform_cut().

+ Here is the caller graph for this function:

◆ is_fdm_support_painted()

bool Slic3r::ModelVolume::is_fdm_support_painted ( ) const
inline
933{ return !this->supported_facets.empty(); }

References Slic3r::FacetsAnnotation::empty().

+ Here is the call graph for this function:

◆ is_left_handed()

bool Slic3r::ModelVolume::is_left_handed ( ) const
inline
bool is_left_handed() const
Definition Geometry.hpp:421

References Slic3r::Geometry::Transformation::is_left_handed(), and m_transformation.

+ Here is the call graph for this function:

◆ is_mm_painted()

bool Slic3r::ModelVolume::is_mm_painted ( ) const
inline
935{ return !this->mmu_segmentation_facets.empty(); }

References Slic3r::FacetsAnnotation::empty().

+ Here is the call graph for this function:

◆ is_model_part()

bool Slic3r::ModelVolume::is_model_part ( ) const
inline

◆ is_modifier()

bool Slic3r::ModelVolume::is_modifier ( ) const
inline

References m_type, and Slic3r::PARAMETER_MODIFIER.

Referenced by Slic3r::color_from_model_volume(), Slic3r::GUI::GLGizmoEmboss::process(), Slic3r::slices_to_regions(), and Slic3r::verify_update_print_object_regions().

+ Here is the caller graph for this function:

◆ is_negative_volume()

bool Slic3r::ModelVolume::is_negative_volume ( ) const
inline

References m_type, and Slic3r::NEGATIVE_VOLUME.

Referenced by Slic3r::color_from_model_volume(), Slic3r::GUI::GLGizmoEmboss::process(), and Slic3r::slices_to_regions().

+ Here is the caller graph for this function:

◆ is_seam_painted()

bool Slic3r::ModelVolume::is_seam_painted ( ) const
inline
934{ return !this->seam_facets.empty(); }

References Slic3r::FacetsAnnotation::empty().

+ Here is the call graph for this function:

◆ is_splittable()

bool Slic3r::ModelVolume::is_splittable ( ) const
2074{
2075 // the call mesh.is_splittable() is expensive, so cache the value to calculate it only once
2076 if (m_is_splittable == -1)
2077 m_is_splittable = its_is_splittable(this->mesh().its);
2078
2079 return m_is_splittable == 1;
2080}
int m_is_splittable
Definition Model.hpp:967
bool its_is_splittable(const Its &m)
Definition MeshSplitImpl.hpp:188

References Slic3r::its_is_splittable().

+ Here is the call graph for this function:

◆ is_support_blocker()

bool Slic3r::ModelVolume::is_support_blocker ( ) const
inline

References m_type, and Slic3r::SUPPORT_BLOCKER.

Referenced by Slic3r::color_from_model_volume().

+ Here is the caller graph for this function:

◆ is_support_enforcer()

bool Slic3r::ModelVolume::is_support_enforcer ( ) const
inline

References m_type, and Slic3r::SUPPORT_ENFORCER.

Referenced by Slic3r::color_from_model_volume().

+ Here is the caller graph for this function:

◆ is_support_modifier()

bool Slic3r::ModelVolume::is_support_modifier ( ) const
inline

◆ is_text()

bool Slic3r::ModelVolume::is_text ( ) const
inline
845{ return text_configuration.has_value(); }

References text_configuration.

◆ is_the_only_one_part()

bool Slic3r::ModelVolume::is_the_only_one_part ( ) const
1368{
1370 return false;
1371 if (object == nullptr)
1372 return false;
1373 for (const ModelVolume *v : object->volumes) {
1374 if (v == nullptr)
1375 continue;
1376 // is this volume?
1377 if (v->id() == this->id())
1378 continue;
1379 // exist another model part in object?
1380 if (v->type() == ModelVolumeType::MODEL_PART)
1381 return false;
1382 }
1383 return true;
1384}
ModelVolume()
Definition Model.hpp:1061

Referenced by Slic3r::GUI::GLGizmoEmboss::close(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), and Slic3r::GUI::GLGizmoEmboss::draw_model_type().

+ Here is the caller graph for this function:

◆ load()

template<class Archive >
void Slic3r::ModelVolume::load ( Archive &  ar)
inlineprivate
1068 {
1069 bool has_convex_hull;
1076 assert(m_mesh);
1077 if (has_convex_hull) {
1079 if (! m_convex_hull && ! m_mesh->empty())
1080 // The convex hull was released from the Undo / Redo stack to conserve memory. Recalculate it.
1081 this->calculate_convex_hull();
1082 } else
1083 m_convex_hull.reset();
1084 }
t_model_material_id m_material_id
Definition Model.hpp:958
void load_by_value(BinaryInputArchive &ar, T &obj)
Definition UndoRedo.cpp:762
void load(Archive &archive, Slic3r::DynamicPrintConfig &config)
Definition PrintConfig.hpp:1307
void load_optional(BinaryInputArchive &ar, std::shared_ptr< const T > &ptr)
Definition UndoRedo.cpp:790

References calculate_convex_hull(), config, cut_info, cereal::load(), cereal::load_by_value(), cereal::load_optional(), m_convex_hull, m_is_splittable, m_material_id, m_mesh, m_transformation, m_type, mmu_segmentation_facets, name, seam_facets, source, supported_facets, and text_configuration.

+ Here is the call graph for this function:

◆ load_and_construct()

template<class Archive >
static void Slic3r::ObjectBase::load_and_construct ( Archive &  ar,
cereal::construct< ObjectBase > &  construct 
)
inlinestaticprivateinherited
96{ ObjectID id; ar(id); construct(id); }

References Slic3r::ObjectBase::id().

+ Here is the call graph for this function:

◆ material()

ModelMaterial * Slic3r::ModelVolume::material ( ) const
2049{
2050 return this->object->get_model()->get_material(m_material_id);
2051}

References Slic3r::Model::get_material(), and Slic3r::ModelMaterial::get_model().

+ Here is the call graph for this function:

◆ material_id()

t_model_material_id Slic3r::ModelVolume::material_id ( ) const
inline
847{ return m_material_id; }

References m_material_id.

Referenced by ModelVolume(), ModelVolume(), Slic3r::GUI::Plater::priv::reload_from_disk(), and Slic3r::GUI::Plater::priv::replace_volume_with_stl().

+ Here is the caller graph for this function:

◆ mesh()

◆ mesh_ptr()

std::shared_ptr< const TriangleMesh > Slic3r::ModelVolume::mesh_ptr ( ) const
inline
809{ return m_mesh; }

References m_mesh.

Referenced by Slic3r::GLVolumeCollection::load_object_volume().

+ Here is the caller graph for this function:

◆ mirror()

void Slic3r::ModelVolume::mirror ( Axis  axis)
2263{
2265 switch (axis)
2266 {
2267 case X: { mirror(0) *= -1.0; break; }
2268 case Y: { mirror(1) *= -1.0; break; }
2269 case Z: { mirror(2) *= -1.0; break; }
2270 default: break;
2271 }
2273}
Vec3d get_mirror() const
Definition Model.hpp:913
void set_mirror(const Vec3d &mirror)
Definition Model.hpp:917
void mirror(Axis axis)
Definition Model.cpp:2262

References Slic3r::X, Slic3r::Y, and Slic3r::Z.

Referenced by set_mirror(), and set_mirror().

+ Here is the caller graph for this function:

◆ operator=()

ModelVolume & Slic3r::ModelVolume::operator= ( ModelVolume rhs)
privatedelete

◆ reset_extra_facets()

void Slic3r::ModelVolume::reset_extra_facets ( )
1387{
1388 this->supported_facets.reset();
1389 this->seam_facets.reset();
1391}
void reset()
Definition Model.cpp:2409

◆ reset_mesh()

void Slic3r::ModelVolume::reset_mesh ( )
inline
816{ m_mesh = std::make_shared<const TriangleMesh>(); }

References m_mesh.

◆ rotate() [1/2]

void Slic3r::ModelVolume::rotate ( double  angle,
Axis  axis 
)
2247{
2248 switch (axis)
2249 {
2250 case X: { rotate(angle, Vec3d::UnitX()); break; }
2251 case Y: { rotate(angle, Vec3d::UnitY()); break; }
2252 case Z: { rotate(angle, Vec3d::UnitZ()); break; }
2253 default: break;
2254 }
2255}
void rotate(double angle, Axis axis)
Definition Model.cpp:2246
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:112

References Slic3r::angle(), Slic3r::X, Slic3r::Y, and Slic3r::Z.

+ Here is the call graph for this function:

◆ rotate() [2/2]

void Slic3r::ModelVolume::rotate ( double  angle,
const Vec3d axis 
)
2258{
2260}
void set_rotation(const Vec3d &rotation)
Definition Model.hpp:904
The quaternion class used to represent 3D orientations and rotations.
Definition Quaternion.h:233
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
Definition AngleAxis.h:50
Vec3d extract_rotation(const Eigen::Matrix< double, 3, 3, Eigen::DontAlign > &rotation_matrix)
Definition Geometry.cpp:377

References Slic3r::angle().

+ Here is the call graph for this function:

◆ save()

template<class Archive >
void Slic3r::ModelVolume::save ( Archive &  ar) const
inlineprivate
1085 {
1086 bool has_convex_hull = m_convex_hull.get() != nullptr;
1093 if (has_convex_hull)
1095 }
void save_by_value(BinaryOutputArchive &ar, const T &obj)
Definition UndoRedo.cpp:756
void save_optional(BinaryOutputArchive &ar, const std::shared_ptr< const T > &ptr)
Definition UndoRedo.cpp:776
void save(Archive &archive, const Slic3r::DynamicPrintConfig &config)
Definition PrintConfig.hpp:1322

References config, cut_info, m_convex_hull, m_is_splittable, m_material_id, m_mesh, m_transformation, m_type, mmu_segmentation_facets, name, cereal::save(), cereal::save_by_value(), cereal::save_optional(), seam_facets, source, supported_facets, and text_configuration.

+ Here is the call graph for this function:

◆ scale() [1/3]

void Slic3r::ModelVolume::scale ( const Vec3d scaling_factors)
2220{
2221 set_scaling_factor(get_scaling_factor().cwiseProduct(scaling_factors));
2222}

Referenced by scale_geometry_after_creation().

+ Here is the caller graph for this function:

◆ scale() [2/3]

void Slic3r::ModelVolume::scale ( double  s)
inline
867{ scale(Vec3d(s, s, s)); }
void scale(const Vec3d &scaling_factors)
Definition Model.cpp:2219

References scale().

Referenced by scale().

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

◆ scale() [3/3]

void Slic3r::ModelVolume::scale ( double  x,
double  y,
double  z 
)
inline
866{ scale(Vec3d(x, y, z)); }

References scale().

Referenced by scale().

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

◆ scale_geometry_after_creation() [1/2]

void Slic3r::ModelVolume::scale_geometry_after_creation ( const float  scale)
inline
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:49

References scale(), and scale_geometry_after_creation().

Referenced by scale_geometry_after_creation().

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

◆ scale_geometry_after_creation() [2/2]

void Slic3r::ModelVolume::scale_geometry_after_creation ( const Vec3f versor)
2277{
2278 const_cast<TriangleMesh*>(m_mesh.get())->scale(versor);
2279 const_cast<TriangleMesh*>(m_convex_hull.get())->scale(versor);
2280}

References scale().

Referenced by Slic3r::ModelObject::convert_units().

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

◆ serialize()

template<class Archive >
void Slic3r::ObjectBase::serialize ( Archive &  ar)
inlineprivateinherited
92{ ar(m_id); }

References Slic3r::ObjectBase::m_id.

◆ set_invalid_id()

void Slic3r::ObjectBase::set_invalid_id ( )
inlineprotectedinherited
74{ m_id = 0; }

References Slic3r::ObjectBase::m_id.

Referenced by Slic3r::CutObjectBase::invalidate().

+ Here is the caller graph for this function:

◆ set_material()

void Slic3r::ModelVolume::set_material ( t_model_material_id  material_id,
const ModelMaterial material 
)
2054{
2056 if (! material_id.empty())
2057 this->object->get_model()->add_material(material_id, material);
2058}
t_model_material_id material_id() const
Definition Model.hpp:847
ModelMaterial * material() const
Definition Model.cpp:2048

References Slic3r::Model::add_material(), and Slic3r::ModelMaterial::get_model().

Referenced by Slic3r::ModelObject::convert_units().

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

◆ set_material_id()

void Slic3r::ModelVolume::set_material_id ( t_model_material_id  material_id)
2041{
2043 // ensure m_material_id references an existing material
2044 if (! material_id.empty())
2045 this->object->get_model()->add_material(material_id);
2046}

Referenced by ModelVolume(), ModelVolume(), Slic3r::GUI::Plater::priv::reload_from_disk(), and Slic3r::GUI::Plater::priv::replace_volume_with_stl().

+ Here is the caller graph for this function:

◆ set_mesh() [1/6]

void Slic3r::ModelVolume::set_mesh ( const indexed_triangle_set mesh)
inline
812{ m_mesh = std::make_shared<const TriangleMesh>(mesh); }

References m_mesh, and mesh().

+ Here is the call graph for this function:

◆ set_mesh() [2/6]

void Slic3r::ModelVolume::set_mesh ( const TriangleMesh mesh)
inline
810{ m_mesh = std::make_shared<const TriangleMesh>(mesh); }

References m_mesh, and mesh().

Referenced by Slic3r::AMFParserContext::endElement().

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

◆ set_mesh() [3/6]

void Slic3r::ModelVolume::set_mesh ( indexed_triangle_set &&  mesh)
inline
813{ m_mesh = std::make_shared<const TriangleMesh>(std::move(mesh)); }

References m_mesh, and mesh().

+ Here is the call graph for this function:

◆ set_mesh() [4/6]

void Slic3r::ModelVolume::set_mesh ( std::shared_ptr< const TriangleMesh > &  mesh)
inline
814{ m_mesh = mesh; }

References m_mesh, and mesh().

+ Here is the call graph for this function:

◆ set_mesh() [5/6]

void Slic3r::ModelVolume::set_mesh ( std::unique_ptr< const TriangleMesh > &&  mesh)
inline
815{ m_mesh = std::move(mesh); }

References m_mesh, and mesh().

+ Here is the call graph for this function:

◆ set_mesh() [6/6]

void Slic3r::ModelVolume::set_mesh ( TriangleMesh &&  mesh)
inline
811{ m_mesh = std::make_shared<const TriangleMesh>(std::move(mesh)); }

References m_mesh, and mesh().

+ Here is the call graph for this function:

◆ set_mirror() [1/2]

void Slic3r::ModelVolume::set_mirror ( Axis  axis,
double  mirror 
)
inline
void set_mirror(const Vec3d &mirror)
Definition Geometry.cpp:537

References m_transformation, mirror(), and Slic3r::Geometry::Transformation::set_mirror().

+ Here is the call graph for this function:

◆ set_mirror() [2/2]

void Slic3r::ModelVolume::set_mirror ( const Vec3d mirror)
inline

References m_transformation, mirror(), and Slic3r::Geometry::Transformation::set_mirror().

+ Here is the call graph for this function:

◆ set_model_object()

void Slic3r::ModelVolume::set_model_object ( ModelObject model_object)
inlineprotected
946{ object = model_object; }

◆ set_new_unique_id()

void Slic3r::ModelVolume::set_new_unique_id ( )
inline

References Slic3r::ObjectBase::set_new_unique_id().

Referenced by Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::ModelObject::delete_volume(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::GUI::Plater::priv::reload_from_disk(), and Slic3r::GUI::Plater::priv::replace_volume_with_stl().

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

◆ set_offset() [1/2]

void Slic3r::ModelVolume::set_offset ( Axis  axis,
double  offset 
)
inline
void set_offset(const Vec3d &offset)
Definition Geometry.hpp:392
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, ClipperLib::JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:416

References m_transformation, Slic3r::offset(), and Slic3r::Geometry::Transformation::set_offset().

+ Here is the call graph for this function:

◆ set_offset() [2/2]

void Slic3r::ModelVolume::set_offset ( const Vec3d offset)
inline

References m_transformation, Slic3r::offset(), and Slic3r::Geometry::Transformation::set_offset().

Referenced by Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::ModelObject::convert_units(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::ModelObject::process_connector_cut(), and Slic3r::ModelObject::split().

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

◆ set_rotation() [1/2]

void Slic3r::ModelVolume::set_rotation ( Axis  axis,
double  rotation 
)
inline
905{ m_transformation.set_rotation(axis, rotation); }
void set_rotation(const Vec3d &rotation)
Definition Geometry.cpp:464

References m_transformation, and Slic3r::Geometry::Transformation::set_rotation().

+ Here is the call graph for this function:

◆ set_rotation() [2/2]

void Slic3r::ModelVolume::set_rotation ( const Vec3d rotation)
inline
904{ m_transformation.set_rotation(rotation); }

References m_transformation, and Slic3r::Geometry::Transformation::set_rotation().

Referenced by Slic3r::ModelObject::process_connector_cut().

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

◆ set_scaling_factor() [1/2]

void Slic3r::ModelVolume::set_scaling_factor ( Axis  axis,
double  scaling_factor 
)
inline
911{ m_transformation.set_scaling_factor(axis, scaling_factor); }
void set_scaling_factor(const Vec3d &scaling_factor)
Definition Geometry.cpp:501

References m_transformation, and Slic3r::Geometry::Transformation::set_scaling_factor().

+ Here is the call graph for this function:

◆ set_scaling_factor() [2/2]

void Slic3r::ModelVolume::set_scaling_factor ( const Vec3d scaling_factor)
inline
910{ m_transformation.set_scaling_factor(scaling_factor); }

References m_transformation, and Slic3r::Geometry::Transformation::set_scaling_factor().

+ Here is the call graph for this function:

◆ set_transformation() [1/2]

void Slic3r::ModelVolume::set_transformation ( const Geometry::Transformation transformation)
inline

◆ set_transformation() [2/2]

void Slic3r::ModelVolume::set_transformation ( const Transform3d trafo)
inline
void set_matrix(const Transform3d &transform)
Definition Geometry.hpp:441

References m_transformation, and Slic3r::Geometry::Transformation::set_matrix().

+ Here is the call graph for this function:

◆ set_type()

void Slic3r::ModelVolume::set_type ( const ModelVolumeType  t)
inline

◆ split()

size_t Slic3r::ModelVolume::split ( unsigned int  max_extruders)
2156{
2157 std::vector<TriangleMesh> meshes = this->mesh().split();
2158 if (meshes.size() <= 1)
2159 return 1;
2160
2161 std::sort(meshes.begin(), meshes.end(), is_front_up_left);
2162
2163 // splited volume should not be text object
2164 if (text_configuration.has_value())
2165 text_configuration.reset();
2166
2167 size_t idx = 0;
2168 size_t ivolume = std::find(this->object->volumes.begin(), this->object->volumes.end(), this) - this->object->volumes.begin();
2169 const std::string& name = this->name;
2170
2171 unsigned int extruder_counter = 0;
2172 const Vec3d offset = this->get_offset();
2173
2174 for (TriangleMesh &mesh : meshes) {
2175 if (mesh.empty() || mesh.has_zero_volume())
2176 // Repair may have removed unconnected triangles, thus emptying the mesh.
2177 continue;
2178
2179 if (idx == 0) {
2180 this->set_mesh(std::move(mesh));
2181 this->calculate_convex_hull();
2182 // Assign a new unique ID, so that a new GLVolume will be generated.
2183 this->set_new_unique_id();
2184 // reset the source to disable reload from disk
2185 this->source = ModelVolume::Source();
2186 }
2187 else
2188 this->object->volumes.insert(this->object->volumes.begin() + (++ivolume), new ModelVolume(object, *this, std::move(mesh)));
2189
2190 this->object->volumes[ivolume]->set_offset(Vec3d::Zero());
2191 this->object->volumes[ivolume]->center_geometry_after_creation();
2192 this->object->volumes[ivolume]->translate(offset);
2193 this->object->volumes[ivolume]->name = name + "_" + std::to_string(idx + 1);
2194 this->object->volumes[ivolume]->config.set("extruder", auto_extruder_id(max_extruders, extruder_counter));
2195 this->object->volumes[ivolume]->m_is_splittable = 0;
2196 ++ idx;
2197 }
2198
2199 // discard volumes for which the convex hull was not generated or is degenerate
2200 size_t i = 0;
2201 while (i < this->object->volumes.size()) {
2202 const std::shared_ptr<const TriangleMesh> &hull = this->object->volumes[i]->get_convex_hull_shared_ptr();
2203 if (hull == nullptr || hull->its.vertices.empty() || hull->its.indices.empty()) {
2204 this->object->delete_volume(i);
2205 --idx;
2206 --i;
2207 }
2208 ++i;
2209 }
2210
2211 return idx;
2212}
ModelVolumePtrs volumes
Definition Model.hpp:337
void set_mesh(const TriangleMesh &mesh)
Definition Model.hpp:810
void set_new_unique_id()
Definition Model.hpp:925
std::vector< TriangleMesh > split() const
Definition TriangleMesh.cpp:391
bool empty() const
Definition TriangleMesh.hpp:139
bool has_zero_volume() const
Definition TriangleMesh.cpp:383
static int auto_extruder_id(unsigned int max_extruders, unsigned int &cntr)
Definition Model.cpp:429
static bool is_front_up_left(const TriangleMesh &trinagle_mesh1, const TriangleMesh &triangle_mesh2)
Compare TriangleMeshes by Bounding boxes (mainly for sort) From Front(Z) Upper(Y) TopLeft(X) corner.
Definition Model.cpp:1691

References Slic3r::auto_extruder_id(), Slic3r::TriangleMesh::empty(), Slic3r::TriangleMesh::has_zero_volume(), Slic3r::is_front_up_left(), Slic3r::TriangleMesh::split(), and Slic3r::ModelObject::volumes.

+ Here is the call graph for this function:

◆ timestamp()

virtual Timestamp Slic3r::ObjectBase::timestamp ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::ModelConfigObject, and Slic3r::ObjectWithTimestamp.

60{ return 0; }

Referenced by Slic3r::GUI::Plater::priv::undo_redo_to().

+ Here is the caller graph for this function:

◆ transform_this_mesh() [1/2]

void Slic3r::ModelVolume::transform_this_mesh ( const Matrix3d m,
bool  fix_left_handed 
)
protected
2295{
2296 TriangleMesh mesh = this->mesh();
2297 mesh.transform(matrix, fix_left_handed);
2298 this->set_mesh(std::move(mesh));
2299 TriangleMesh convex_hull = this->get_convex_hull();
2300 convex_hull.transform(matrix, fix_left_handed);
2301 m_convex_hull = std::make_shared<TriangleMesh>(std::move(convex_hull));
2302 // Let the rest of the application know that the geometry changed, so the meshes have to be reloaded.
2303 this->set_new_unique_id();
2304}
const TriangleMesh & get_convex_hull() const
Definition Model.cpp:2112
IGL_INLINE void convex_hull(const Eigen::MatrixBase< DerivedV > &V, Eigen::PlainObjectBase< DerivedW > &W, Eigen::PlainObjectBase< DerivedG > &G)
Definition convex_hull.cpp:21

References Slic3r::TriangleMesh::transform().

+ Here is the call graph for this function:

◆ transform_this_mesh() [2/2]

void Slic3r::ModelVolume::transform_this_mesh ( const Transform3d t,
bool  fix_left_handed 
)
protected
2283{
2284 TriangleMesh mesh = this->mesh();
2285 mesh.transform(mesh_trafo, fix_left_handed);
2286 this->set_mesh(std::move(mesh));
2287 TriangleMesh convex_hull = this->get_convex_hull();
2288 convex_hull.transform(mesh_trafo, fix_left_handed);
2289 m_convex_hull = std::make_shared<TriangleMesh>(std::move(convex_hull));
2290 // Let the rest of the application know that the geometry changed, so the meshes have to be reloaded.
2291 this->set_new_unique_id();
2292}

References Slic3r::TriangleMesh::transform().

+ Here is the call graph for this function:

◆ translate() [1/2]

void Slic3r::ModelVolume::translate ( const Vec3d displacement)
2215{
2216 set_offset(get_offset() + displacement);
2217}

◆ translate() [2/2]

void Slic3r::ModelVolume::translate ( double  x,
double  y,
double  z 
)
inline
863{ translate(Vec3d(x, y, z)); }

References translate().

Referenced by Slic3r::GUI::Plater::priv::replace_volume_with_stl(), and translate().

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

◆ type()

◆ type_from_string()

ModelVolumeType Slic3r::ModelVolume::type_from_string ( const std::string &  s)
static
2118{
2119 // Legacy support
2120 if (s == "1")
2122 // New type (supporting the support enforcers & blockers)
2123 if (s == "ModelPart")
2125 if (s == "NegativeVolume")
2127 if (s == "ParameterModifier")
2129 if (s == "SupportEnforcer")
2131 if (s == "SupportBlocker")
2133 assert(s == "0");
2134 // Default value if invalud type string received.
2136}

Referenced by Slic3r::AMFParserContext::endElement().

+ Here is the caller graph for this function:

◆ type_to_string()

std::string Slic3r::ModelVolume::type_to_string ( const ModelVolumeType  t)
static
2139{
2140 switch (t) {
2141 case ModelVolumeType::MODEL_PART: return "ModelPart";
2142 case ModelVolumeType::NEGATIVE_VOLUME: return "NegativeVolume";
2143 case ModelVolumeType::PARAMETER_MODIFIER: return "ParameterModifier";
2144 case ModelVolumeType::SUPPORT_ENFORCER: return "SupportEnforcer";
2145 case ModelVolumeType::SUPPORT_BLOCKER: return "SupportBlocker";
2146 default:
2147 assert(false);
2148 return "ModelPart";
2149 }
2150}

Friends And Related Symbol Documentation

◆ cereal::access

friend class cereal::access
friend

◆ Model

friend class Model
friend

◆ model_volume_list_update_supports

void model_volume_list_update_supports ( ModelObject model_object_dst,
const ModelObject model_object_new 
)
friend
14{
15 typedef std::pair<const ModelVolume*, bool> ModelVolumeWithStatus;
16 std::vector<ModelVolumeWithStatus> old_volumes;
17 old_volumes.reserve(model_object_dst.volumes.size());
18 for (const ModelVolume *model_volume : model_object_dst.volumes)
19 old_volumes.emplace_back(ModelVolumeWithStatus(model_volume, false));
20 auto model_volume_lower = [](const ModelVolumeWithStatus &mv1, const ModelVolumeWithStatus &mv2){ return mv1.first->id() < mv2.first->id(); };
21 auto model_volume_equal = [](const ModelVolumeWithStatus &mv1, const ModelVolumeWithStatus &mv2){ return mv1.first->id() == mv2.first->id(); };
22 std::sort(old_volumes.begin(), old_volumes.end(), model_volume_lower);
23 model_object_dst.volumes.clear();
24 model_object_dst.volumes.reserve(model_object_new.volumes.size());
25 for (const ModelVolume *model_volume_src : model_object_new.volumes) {
26 ModelVolumeWithStatus key(model_volume_src, false);
27 auto it = std::lower_bound(old_volumes.begin(), old_volumes.end(), key, model_volume_lower);
28 if (it != old_volumes.end() && model_volume_equal(*it, key)) {
29 // The volume was found in the old list. Just copy it.
30 assert(! it->second); // not consumed yet
31 it->second = true;
32 ModelVolume *model_volume_dst = const_cast<ModelVolume*>(it->first);
33 // For support modifiers, the type may have been switched from blocker to enforcer and vice versa.
34 assert((model_volume_dst->is_support_modifier() && model_volume_src->is_support_modifier()) || model_volume_dst->type() == model_volume_src->type());
35 model_object_dst.volumes.emplace_back(model_volume_dst);
36 if (model_volume_dst->is_support_modifier()) {
37 // For support modifiers, the type may have been switched from blocker to enforcer and vice versa.
38 model_volume_dst->set_type(model_volume_src->type());
39 model_volume_dst->set_transformation(model_volume_src->get_transformation());
40 }
41 assert(model_volume_dst->get_matrix().isApprox(model_volume_src->get_matrix()));
42 } else {
43 // The volume was not found in the old list. Create a new copy.
44 assert(model_volume_src->is_support_modifier());
45 model_object_dst.volumes.emplace_back(new ModelVolume(*model_volume_src));
46 model_object_dst.volumes.back()->set_model_object(&model_object_dst);
47 }
48 }
49 // Release the non-consumed old volumes (those were deleted from the new list).
50 for (ModelVolumeWithStatus &mv_with_status : old_volumes)
51 if (! mv_with_status.second)
52 delete mv_with_status.first;
53}
if(!(yy_init))
Definition lexer.c:1190

◆ ModelObject

friend class ModelObject
friend

◆ Print

friend class Print
friend

◆ SLAPrint

friend class SLAPrint
friend

◆ UndoRedo::StackImpl

friend class UndoRedo::StackImpl
friend

Member Data Documentation

◆ config

◆ cut_info

◆ m_convex_hull

std::shared_ptr<const TriangleMesh> Slic3r::ModelVolume::m_convex_hull
private

◆ m_id

◆ m_is_splittable

int Slic3r::ModelVolume::m_is_splittable { -1 }
mutableprivate

Referenced by load(), and save().

◆ m_material_id

t_model_material_id Slic3r::ModelVolume::m_material_id
private

Referenced by load(), material_id(), and save().

◆ m_mesh

◆ m_transformation

◆ m_type

◆ mmu_segmentation_facets

◆ name

◆ object

ModelObject* Slic3r::ModelVolume::object
private

Referenced by get_object().

◆ s_last_id

size_t Slic3r::ObjectBase::s_last_id = 0
staticprivateinherited

◆ seam_facets

◆ source

◆ supported_facets

◆ text_configuration


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