OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::ModelObject Class Referencefinal

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

Inheritance diagram for Slic3r::ModelObject:
Collaboration diagram for Slic3r::ModelObject:

Public Types

using Timestamp = uint64_t

Public Member Functions

Model * get_model ()
const Model * get_model () const
int get_backup_id () const
template<typename T>
const T * get_config_value (const DynamicPrintConfig &global_config, const std::string &config_option)
ModelVolume * add_volume (const TriangleMesh &mesh, bool modify_to_center_geometry=true)
ModelVolume * add_volume (TriangleMesh &&mesh, ModelVolumeType type=ModelVolumeType::MODEL_PART, bool modify_to_center_geometry=true)
ModelVolume * add_volume (const ModelVolume &volume, ModelVolumeType type=ModelVolumeType::INVALID)
ModelVolume * add_volume (const ModelVolume &volume, TriangleMesh &&mesh)
ModelVolume * add_volume_with_shared_mesh (const ModelVolume &other, ModelVolumeType type=ModelVolumeType::MODEL_PART)
void delete_volume (size_t idx)
void clear_volumes ()
void sort_volumes (bool full_sort)
bool is_multiparts () const
bool is_fdm_support_painted () const
bool is_seam_painted () const
bool is_mm_painted () const
bool is_fuzzy_skin_painted () const
bool has_custom_layering () const
ModelInstance * add_instance ()
ModelInstance * add_instance (const ModelInstance &instance)
ModelInstance * add_instance (const Vec3d &offset, const Vec3d &scaling_factor, const Vec3d &rotation, const Vec3d &mirror)
void delete_instance (size_t idx)
void delete_last_instance ()
void clear_instances ()
const BoundingBoxf3 & bounding_box_approx () const
const BoundingBoxf3 & bounding_box_exact () const
double min_z () const
double max_z () const
void invalidate_bounding_box ()
TriangleMesh mesh () const
TriangleMesh raw_mesh () const
indexed_triangle_set raw_indexed_triangle_set () const
const BoundingBoxf3 & raw_bounding_box () const
BoundingBoxf3 instance_bounding_box (size_t instance_idx, bool dont_translate=false) const
BoundingBoxf3 instance_bounding_box (const ModelInstance &instance, bool dont_translate=false) const
const BoundingBoxf3 & raw_mesh_bounding_box () const
BoundingBoxf3 full_raw_mesh_bounding_box () const
BoundingBoxf3 instance_convex_hull_bounding_box (size_t instance_idx, bool dont_translate=false) const
BoundingBoxf3 instance_convex_hull_bounding_box (const ModelInstance *instance, bool dont_translate=false) const
Polygon convex_hull_2d (const Transform3d &trafo_instance) const
void center_around_origin (bool include_modifiers=true)
void ensure_on_bed (bool allow_negative_z=false)
void translate_instances (const Vec3d &vector)
void translate_instance (size_t instance_idx, const Vec3d &vector)
void translate (const Vec3d &vector)
void translate (double x, double y, double z)
void scale (const Vec3d &versor)
void scale (const double s)
void scale (double x, double y, double z)
void scale_to_fit (const Vec3d &size)
 Scale the current ModelObject to fit by altering the scaling factor of ModelInstances. It operates on the total size by duplicating the object according to all the instances.
void rotate (double angle, Axis axis)
void rotate (double angle, const Vec3d &axis)
void mirror (Axis axis)
void scale_mesh_after_creation (const float scale)
void convert_units (ModelObjectPtrs &new_objects, ConversionType conv_type, std::vector< int > volume_idxs)
size_t materials_count () const
size_t facets_count () const
size_t parts_count () const
void invalidate_cut ()
void delete_connectors ()
void clone_for_cut (ModelObject **obj)
void split (ModelObjectPtrs *new_objects, bool remap_paint)
void merge ()
bool make_boolean (ModelObject *cut_object, const std::string &boolean_opts)
ModelObjectPtrs merge_volumes (std::vector< int > &vol_indeces)
void bake_xy_rotation_into_meshes (size_t instance_idx)
double get_instance_min_z (size_t instance_idx) const
double get_instance_max_z (size_t instance_idx) const
void print_info () const
std::string get_export_filename () const
TriangleMeshStats get_object_stl_stats () const
int get_repaired_errors_count (const int vol_idx=-1) const
bool has_solid_mesh () const
bool is_cut () const
bool has_connectors () const
ObjectID id () const
virtual Timestamp timestamp () const

Public Attributes

std::string name
std::string module_name
std::string input_file
ModelInstancePtrs instances
ModelVolumePtrs volumes
ModelConfigObject config
t_layer_config_ranges layer_config_ranges
LayerHeightProfile layer_height_profile
bool printable { true }
bool auto_drop { true }
sla::SupportPoints sla_support_points
sla::PointsStatus sla_points_status = sla::PointsStatus::NoPoints
sla::DrainHoles sla_drain_holes
BrimPoints brim_points
Vec3d origin_translation
std::vector< ObjectID > volume_ids
CutConnectors cut_connectors
CutObjectBase cut_id

Protected Member Functions

void set_invalid_id ()
void copy_id (const ObjectBase &rhs)

Private Member Functions

 ModelObject (Model *model)
 ModelObject (int)
 ~ModelObject ()
void assign_new_unique_ids_recursive () override
 ModelObject (const ModelObject &rhs)
 ModelObject (ModelObject &&rhs)
ModelObject & operator= (const ModelObject &rhs)
ModelObject & operator= (ModelObject &&rhs)
void set_new_unique_id ()
void copy_transformation_caches (const ModelObject &src)
void set_model (Model *model)
 ModelObject ()
template<class Archive>
void save (Archive &ar) const
template<class Archive>
void load (Archive &ar)
unsigned int update_instances_print_volume_state (const BuildVolume &build_volume)
void update_min_max_z ()
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

Model * m_model { nullptr }
BoundingBoxf3 m_bounding_box_approx
bool m_bounding_box_approx_valid { false }
BoundingBoxf3 m_bounding_box_exact
bool m_bounding_box_exact_valid { false }
bool m_min_max_z_valid { false }
BoundingBoxf3 m_raw_bounding_box
bool m_raw_bounding_box_valid { false }
BoundingBoxf3 m_raw_mesh_bounding_box
bool m_raw_mesh_bounding_box_valid { false }
ObjectID m_id

Static Private Attributes

static size_t s_last_id = 0

Friends

class Model
class Print
class SLAPrint
class cereal::access
class UndoRedo::StackImpl

Detailed Description

Member Typedef Documentation

◆ Timestamp

using Slic3r::ObjectBase::Timestamp = uint64_t
inherited

Constructor & Destructor Documentation

◆ ModelObject() [1/5]

Slic3r::ModelObject::ModelObject ( Model * model)
inlineexplicitprivate
582 : m_model(model), origin_translation(Vec3d::Zero())
583 {
584 assert(this->id().valid());
585 assert(this->config.id().valid());
586 assert(this->layer_height_profile.id().valid());
587 }
ModelConfigObject config
Definition Model.hpp:395
Model * m_model
Definition Model.hpp:666
Vec3d origin_translation
Definition Model.hpp:424
LayerHeightProfile layer_height_profile
Definition Model.hpp:400

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

Referenced by ModelObject(), ModelObject(), clone_for_cut(), convert_units(), copy_transformation_caches(), make_boolean(), max_z(), merge_volumes(), min_z(), operator=(), operator=(), and split().

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

◆ ModelObject() [2/5]

Slic3r::ModelObject::ModelObject ( int )
inlineexplicitprivate
588 : ObjectBase(-1), config(-1), layer_height_profile(-1), origin_translation(Vec3d::Zero())
589 {
590 assert(this->id().invalid());
591 assert(this->config.id().invalid());
592 assert(this->layer_height_profile.id().invalid());
593 }
ObjectBase()
Definition ObjectID.hpp:79

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

Here is the call graph for this function:

◆ ~ModelObject()

Slic3r::ModelObject::~ModelObject ( )
private
1261{
1262 this->clear_volumes();
1263 this->clear_instances();
1264}
void clear_volumes()
Definition Model.cpp:1484
void clear_instances()
Definition Model.cpp:1596

References ~ModelObject(), clear_instances(), and clear_volumes().

Referenced by ~ModelObject().

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

◆ ModelObject() [3/5]

Slic3r::ModelObject::ModelObject ( const ModelObject & rhs)
inlineprivate
599 : ObjectBase(-1), config(-1), layer_height_profile(-1), m_model(rhs.m_model) {
600 assert(this->id().invalid());
601 assert(this->config.id().invalid());
602 assert(this->layer_height_profile.id().invalid());
603 assert(rhs.id() != rhs.config.id());
604 assert(rhs.id() != rhs.layer_height_profile.id());
605 this->assign_copy(rhs);
606 assert(this->id().valid());
607 assert(this->config.id().valid());
608 assert(this->layer_height_profile.id().valid());
609 assert(this->id() != this->config.id());
610 assert(this->id() != this->layer_height_profile.id());
611 assert(this->id() == rhs.id());
612 assert(this->config.id() == rhs.config.id());
613 assert(this->layer_height_profile.id() == rhs.layer_height_profile.id());
614 }

References ModelObject(), Slic3r::ObjectBase::ObjectBase(), config, Slic3r::ObjectBase::id(), Slic3r::ObjectID::invalid(), layer_height_profile, m_model, and Slic3r::ObjectID::valid().

Here is the call graph for this function:

◆ ModelObject() [4/5]

Slic3r::ModelObject::ModelObject ( ModelObject && rhs)
inlineexplicitprivate
615 : ObjectBase(-1), config(-1), layer_height_profile(-1) {
616 assert(this->id().invalid());
617 assert(this->config.id().invalid());
618 assert(this->layer_height_profile.id().invalid());
619 assert(rhs.id() != rhs.config.id());
620 assert(rhs.id() != rhs.layer_height_profile.id());
621 this->assign_copy(std::move(rhs));
622 assert(this->id().valid());
623 assert(this->config.id().valid());
624 assert(this->layer_height_profile.id().valid());
625 assert(this->id() != this->config.id());
626 assert(this->id() != this->layer_height_profile.id());
627 assert(this->id() == rhs.id());
628 assert(this->config.id() == rhs.config.id());
629 assert(this->layer_height_profile.id() == rhs.layer_height_profile.id());
630 }

References ModelObject(), Slic3r::ObjectBase::ObjectBase(), config, Slic3r::ObjectBase::id(), Slic3r::ObjectID::id, Slic3r::ObjectID::invalid(), layer_height_profile, and Slic3r::ObjectID::valid().

Here is the call graph for this function:

◆ ModelObject() [5/5]

Slic3r::ModelObject::ModelObject ( )
inlineprivate
701 :
703 assert(this->id().invalid());
704 assert(this->config.id().invalid());
705 assert(this->layer_height_profile.id().invalid());
706 }

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

Here is the call graph for this function:

Member Function Documentation

◆ add_instance() [1/3]

ModelInstance * Slic3r::ModelObject::add_instance ( )
1555{
1556 ModelInstance* i = new ModelInstance(this);
1557 this->instances.push_back(i);
1559 // BBS: backup: do not save
1560 if (this->instances.size() == 1)
1562 return i;
1563}
ModelInstancePtrs instances
Definition Model.hpp:390
void invalidate_bounding_box()
Definition Model.hpp:482
void save_object_mesh(ModelObject &object)
Definition bbs_3mf.cpp:9754

References add_instance(), instances, invalidate_bounding_box(), and Slic3r::save_object_mesh().

Referenced by Slic3r::_3MF_Importer::_load_model_from_file(), add_instance(), add_instance(), add_instance(), Slic3r::GUI::ObjectList::boolean(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::duplicate(), Slic3r::duplicate_objects(), Slic3r::AMFParserContext::endDocument(), Slic3r::GUI::ensure_belt_purge_tower(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::finalize(), Slic3r::GUI::Plater::increase_instances(), Slic3r::GUI::ObjectList::load_mesh_object(), Slic3r::GUI::ObjectList::merge(), Slic3r::GUI::FillBedJob::prepare(), Slic3r::GUI::DesignCanvas::rebuild_bodies(), Slic3r::CLI::run(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), and split().

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

◆ add_instance() [2/3]

ModelInstance * Slic3r::ModelObject::add_instance ( const ModelInstance & instance)
1566{
1567 ModelInstance* i = new ModelInstance(this, other);
1568 this->instances.push_back(i);
1570 return i;
1571}

References add_instance(), instances, and invalidate_bounding_box().

Here is the call graph for this function:

◆ add_instance() [3/3]

ModelInstance * Slic3r::ModelObject::add_instance ( const Vec3d & offset,
const Vec3d & scaling_factor,
const Vec3d & rotation,
const Vec3d & mirror )
1574{
1575 auto *instance = add_instance();
1576 instance->set_offset(offset);
1577 instance->set_scaling_factor(scaling_factor);
1578 instance->set_rotation(rotation);
1579 instance->set_mirror(mirror);
1580 return instance;
1581}
void mirror(Axis axis)
Definition Model.cpp:1982
ModelInstance * add_instance()
Definition Model.cpp:1554
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582

References add_instance(), mirror(), and Slic3r::offset().

Here is the call graph for this function:

◆ add_volume() [1/4]

ModelVolume * Slic3r::ModelObject::add_volume ( const ModelVolume & volume,
ModelVolumeType type = ModelVolumeType::INVALID )
1416{
1417 ModelVolume* v = new ModelVolume(this, other);
1418 if (type != ModelVolumeType::INVALID && v->type() != type)
1419 v->set_type(type);
1420
1421 v->cut_info = other.cut_info;
1422
1423 this->volumes.push_back(v);
1424 // The volume should already be centered at this point of time when copying shared pointers of the triangle mesh and convex hull.
1425// v->center_geometry_after_creation();
1426// this->invalidate_bounding_box();
1427 // BBS: backup
1429 return v;
1430}
ModelVolumePtrs volumes
Definition Model.hpp:393
@ INVALID
Definition Model.hpp:356

References add_volume(), Slic3r::ModelVolume::cut_info, Slic3r::INVALID, Slic3r::save_object_mesh(), Slic3r::ModelVolume::set_type(), and Slic3r::ModelVolume::type().

Here is the call graph for this function:

◆ add_volume() [2/4]

ModelVolume * Slic3r::ModelObject::add_volume ( const ModelVolume & volume,
TriangleMesh && mesh )
1433{
1434 ModelVolume* v = new ModelVolume(this, other, std::move(mesh));
1435 this->volumes.push_back(v);
1436 v->center_geometry_after_creation();
1438 // BBS: backup
1440 return v;
1441}
TriangleMesh mesh() const
Definition Model.cpp:1675

References add_volume(), Slic3r::ModelVolume::center_geometry_after_creation(), invalidate_bounding_box(), mesh(), and Slic3r::save_object_mesh().

Here is the call graph for this function:

◆ add_volume() [3/4]

ModelVolume * Slic3r::ModelObject::add_volume ( const TriangleMesh & mesh,
bool modify_to_center_geometry = true )
1390{
1391 ModelVolume* v = new ModelVolume(this, mesh);
1392 this->volumes.push_back(v);
1393 if (modify_to_center_geometry) {
1394 v->center_geometry_after_creation();
1396 }
1397 // BBS: backup
1399 return v;
1400}

References add_volume(), Slic3r::ModelVolume::center_geometry_after_creation(), invalidate_bounding_box(), mesh(), and Slic3r::save_object_mesh().

Referenced by Slic3r::Model::add_object(), Slic3r::Model::add_object(), add_volume(), add_volume(), add_volume(), add_volume(), Slic3r::GUI::GLGizmoCut3D::apply_cut_connectors(), Slic3r::GUI::ObjectList::boolean(), Slic3r::Model::convert_multipart_object(), convert_units(), Slic3r::GUI::Selection::copy_to_clipboard(), anonymous_namespace{EmbossJob.cpp}::create_volume(), Slic3r::distribute_modifiers_from_object(), Slic3r::GUI::ensure_belt_purge_tower(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::finalize(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_mesh_object(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::load_svg(), make_boolean(), Slic3r::GUI::ObjectList::merge(), merge(), merge_or_add_object(), merge_volumes(), Slic3r::Step::mesh(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::Cut::perform_by_contour(), Slic3r::Cut::perform_with_groove(), Slic3r::process_connector_cut(), Slic3r::process_modifier_cut(), Slic3r::GUI::DesignCanvas::rebuild_bodies(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::Plater::priv::replace_volume_with_stl(), Slic3r::CLI::run(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), and split().

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

◆ add_volume() [4/4]

ModelVolume * Slic3r::ModelObject::add_volume ( TriangleMesh && mesh,
ModelVolumeType type = ModelVolumeType::MODEL_PART,
bool modify_to_center_geometry = true )
1403{
1404 ModelVolume* v = new ModelVolume(this, std::move(mesh), type);
1405 this->volumes.push_back(v);
1406 if (modify_to_center_geometry) {
1407 v->center_geometry_after_creation();
1409 }
1410 // BBS: backup
1412 return v;
1413}

References add_volume(), Slic3r::ModelVolume::center_geometry_after_creation(), invalidate_bounding_box(), mesh(), and Slic3r::save_object_mesh().

Here is the call graph for this function:

◆ add_volume_with_shared_mesh()

ModelVolume * Slic3r::ModelObject::add_volume_with_shared_mesh ( const ModelVolume & other,
ModelVolumeType type = ModelVolumeType::MODEL_PART )
1444{
1445 ModelVolume* v = new ModelVolume(this, other.m_mesh);
1446 if (type != ModelVolumeType::INVALID && v->type() != type)
1447 v->set_type(type);
1448 this->volumes.push_back(v);
1449 // The volume should already be centered at this point of time when copying shared pointers of the triangle mesh and convex hull.
1450// v->center_geometry_after_creation();
1451// this->invalidate_bounding_box();
1452 // BBS: backup
1454 return v;
1455}

References add_volume_with_shared_mesh(), Slic3r::INVALID, Slic3r::ModelVolume::m_mesh, Slic3r::save_object_mesh(), Slic3r::ModelVolume::set_type(), and Slic3r::ModelVolume::type().

Referenced by add_volume_with_shared_mesh().

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

◆ assign_new_unique_ids_recursive()

void Slic3r::ModelObject::assign_new_unique_ids_recursive ( )
overrideprivatevirtual

Reimplemented from Slic3r::ObjectBase.

1347{
1348 this->set_new_unique_id();
1349 for (ModelVolume *model_volume : this->volumes)
1350 model_volume->assign_new_unique_ids_recursive();
1351 for (ModelInstance *model_instance : this->instances)
1352 model_instance->assign_new_unique_ids_recursive();
1353 this->layer_height_profile.set_new_unique_id();
1354}
void set_new_unique_id()
Definition Model.hpp:657

References assign_new_unique_ids_recursive(), Slic3r::ModelVolume::assign_new_unique_ids_recursive(), layer_height_profile, and set_new_unique_id().

Referenced by assign_new_unique_ids_recursive().

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

◆ bake_xy_rotation_into_meshes()

void Slic3r::ModelObject::bake_xy_rotation_into_meshes ( size_t instance_idx)
2429{
2430 assert(instance_idx < this->instances.size());
2431
2432 const Geometry::Transformation reference_trafo = this->instances[instance_idx]->get_transformation();
2433 if (Geometry::is_rotation_ninety_degrees(reference_trafo.get_rotation()))
2434 // nothing to do, scaling in the world coordinate space is possible in the representation of Geometry::Transformation.
2435 return;
2436
2437 bool left_handed = reference_trafo.is_left_handed();
2438 bool has_mirrorring = ! reference_trafo.get_mirror().isApprox(Vec3d(1., 1., 1.));
2439 bool uniform_scaling = std::abs(reference_trafo.get_scaling_factor().x() - reference_trafo.get_scaling_factor().y()) < EPSILON &&
2440 std::abs(reference_trafo.get_scaling_factor().x() - reference_trafo.get_scaling_factor().z()) < EPSILON;
2441 double new_scaling_factor = uniform_scaling ? reference_trafo.get_scaling_factor().x() : 1.;
2442
2443 // Adjust the instances.
2444 for (size_t i = 0; i < this->instances.size(); ++ i) {
2445 ModelInstance &model_instance = *this->instances[i];
2446 model_instance.set_rotation(Vec3d(0., 0., Geometry::rotation_diff_z(reference_trafo.get_rotation(), model_instance.get_rotation())));
2447 model_instance.set_scaling_factor(Vec3d(new_scaling_factor, new_scaling_factor, new_scaling_factor));
2448 model_instance.set_mirror(Vec3d(1., 1., 1.));
2449 }
2450
2451 // Adjust the meshes.
2452 // Transformation to be applied to the meshes.
2453 Geometry::Transformation reference_trafo_mod = reference_trafo;
2454 reference_trafo_mod.reset_offset();
2455 if (uniform_scaling)
2456 reference_trafo_mod.reset_scaling_factor();
2457 if (!has_mirrorring)
2458 reference_trafo_mod.reset_mirror();
2459 Eigen::Matrix3d mesh_trafo_3x3 = reference_trafo_mod.get_matrix().matrix().block<3, 3>(0, 0);
2460 Transform3d volume_offset_correction = this->instances[instance_idx]->get_transformation().get_matrix().inverse() * reference_trafo.get_matrix();
2461 for (ModelVolume *model_volume : this->volumes) {
2462 const Geometry::Transformation volume_trafo = model_volume->get_transformation();
2463 bool volume_left_handed = volume_trafo.is_left_handed();
2464 bool volume_has_mirrorring = ! volume_trafo.get_mirror().isApprox(Vec3d(1., 1., 1.));
2465 bool volume_uniform_scaling = std::abs(volume_trafo.get_scaling_factor().x() - volume_trafo.get_scaling_factor().y()) < EPSILON &&
2466 std::abs(volume_trafo.get_scaling_factor().x() - volume_trafo.get_scaling_factor().z()) < EPSILON;
2467 double volume_new_scaling_factor = volume_uniform_scaling ? volume_trafo.get_scaling_factor().x() : 1.;
2468 // Transform the mesh.
2469 Geometry::Transformation volume_trafo_mod = volume_trafo;
2470 volume_trafo_mod.reset_offset();
2471 if (volume_uniform_scaling)
2472 volume_trafo_mod.reset_scaling_factor();
2473 if (!volume_has_mirrorring)
2474 volume_trafo_mod.reset_mirror();
2475 Eigen::Matrix3d volume_trafo_3x3 = volume_trafo_mod.get_matrix().matrix().block<3, 3>(0, 0);
2476 // Following method creates a new shared_ptr<TriangleMesh>
2477 model_volume->transform_this_mesh(mesh_trafo_3x3 * volume_trafo_3x3, left_handed != volume_left_handed);
2478 // Reset the rotation, scaling and mirroring.
2479 model_volume->set_rotation(Vec3d(0., 0., 0.));
2480 model_volume->set_scaling_factor(Vec3d(volume_new_scaling_factor, volume_new_scaling_factor, volume_new_scaling_factor));
2481 model_volume->set_mirror(Vec3d(1., 1., 1.));
2482 // Move the reference point of the volume to compensate for the change of the instance trafo.
2483 model_volume->set_offset(volume_offset_correction * volume_trafo.get_offset());
2484 // reset the source to disable reload from disk
2485 model_volume->source = ModelVolume::Source();
2486 }
2487
2489}
#define EPSILON
Definition ColorUtils.cpp:64
bool is_rotation_ninety_degrees(double a)
Definition Geometry.hpp:545
double rotation_diff_z(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to)
Definition Geometry.cpp:765
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96

References bake_xy_rotation_into_meshes(), EPSILON, Slic3r::Geometry::Transformation::get_matrix(), Slic3r::Geometry::Transformation::get_mirror(), Slic3r::Geometry::Transformation::get_offset(), Slic3r::Geometry::Transformation::get_rotation(), Slic3r::ModelInstance::get_rotation(), Slic3r::Geometry::Transformation::get_scaling_factor(), Slic3r::ModelVolume::get_transformation(), instances, invalidate_bounding_box(), Slic3r::Geometry::Transformation::is_left_handed(), Slic3r::Geometry::is_rotation_ninety_degrees(), Slic3r::Geometry::Transformation::reset_mirror(), Slic3r::Geometry::Transformation::reset_offset(), Slic3r::Geometry::Transformation::reset_scaling_factor(), Slic3r::Geometry::rotation_diff_z(), Slic3r::ModelInstance::set_mirror(), Slic3r::ModelVolume::set_mirror(), Slic3r::ModelVolume::set_offset(), Slic3r::ModelInstance::set_rotation(), Slic3r::ModelVolume::set_rotation(), Slic3r::ModelInstance::set_scaling_factor(), Slic3r::ModelVolume::set_scaling_factor(), Slic3r::ModelVolume::source, and Slic3r::ModelVolume::transform_this_mesh().

Referenced by bake_xy_rotation_into_meshes().

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

◆ bounding_box_approx()

const BoundingBoxf3 & Slic3r::ModelObject::bounding_box_approx ( ) const
1607{
1610 BoundingBoxf3 raw_bbox = this->raw_mesh_bounding_box();
1611 m_bounding_box_approx.reset();
1612 for (const ModelInstance *i : this->instances)
1613 m_bounding_box_approx.merge(i->transform_bounding_box(raw_bbox));
1614 }
1615 return m_bounding_box_approx;
1616}
BoundingBoxf3 m_bounding_box_approx
Definition Model.hpp:669
bool m_bounding_box_approx_valid
Definition Model.hpp:670
const BoundingBoxf3 & raw_mesh_bounding_box() const
Definition Model.cpp:1739

References bounding_box_approx(), instances, m_bounding_box_approx, m_bounding_box_approx_valid, and raw_mesh_bounding_box().

Referenced by bounding_box_approx().

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

◆ bounding_box_exact()

const BoundingBoxf3 & Slic3r::ModelObject::bounding_box_exact ( ) const
1621{
1624 m_min_max_z_valid = true;
1625 m_bounding_box_exact.reset();
1626 for (size_t i = 0; i < this->instances.size(); ++ i)
1627 m_bounding_box_exact.merge(this->instance_bounding_box(i));
1628 }
1629 return m_bounding_box_exact;
1630}
bool m_bounding_box_exact_valid
Definition Model.hpp:672
bool m_min_max_z_valid
Definition Model.hpp:673
BoundingBoxf3 m_bounding_box_exact
Definition Model.hpp:671

References bounding_box_exact(), instances, m_bounding_box_exact, m_bounding_box_exact_valid, and m_min_max_z_valid.

Referenced by bounding_box_exact(), Slic3r::GUI::Plater::calib_max_vol_speed(), Slic3r::GUI::Plater::calib_retraction(), Slic3r::GUI::Plater::calib_temp(), Slic3r::GUI::ensure_belt_purge_tower(), and scale_to_fit().

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

◆ center_around_origin()

void Slic3r::ModelObject::center_around_origin ( bool include_modifiers = true)
1884{
1885 // calculate the displacements needed to
1886 // center this object around the origin
1887 const BoundingBoxf3 bb = include_modifiers ? full_raw_mesh_bounding_box() : raw_mesh_bounding_box();
1888
1889 // Shift is the vector from the center of the bounding box to the origin
1890 const Vec3d shift = -bb.center();
1891
1892 this->translate(shift);
1893 this->origin_translation += shift;
1894}
void translate(const Vec3d &vector)
Definition Model.hpp:523
BoundingBoxf3 full_raw_mesh_bounding_box() const
Definition Model.cpp:1751

References Slic3r::BoundingBox3Base< PointType >::center(), center_around_origin(), full_raw_mesh_bounding_box(), origin_translation, raw_mesh_bounding_box(), and translate().

Referenced by Slic3r::GUI::ObjectList::boolean(), center_around_origin(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::merge(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::Plater::priv::replace_volume_with_stl(), rotate(), and rotate().

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

◆ clear_instances()

void Slic3r::ModelObject::clear_instances ( )
1597{
1598 for (ModelInstance *i : this->instances)
1599 delete i;
1600 this->instances.clear();
1602}

References clear_instances(), instances, and invalidate_bounding_box().

Referenced by ~ModelObject(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::SLAPrint::apply(), clear_instances(), Slic3r::Model::duplicate_objects_grid(), and Slic3r::AMFParserContext::endDocument().

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

◆ clear_volumes()

void Slic3r::ModelObject::clear_volumes ( )
1485{
1486 for (ModelVolume *v : this->volumes)
1487 delete v;
1488 this->volumes.clear();
1490 // BBS: backup: do not save
1491 // Slic3r::save_object_mesh(*this);
1492}

References clear_volumes(), and invalidate_bounding_box().

Referenced by ~ModelObject(), clear_volumes(), convert_units(), make_boolean(), merge(), merge_volumes(), Slic3r::Cut::perform_with_groove(), and Slic3r::GUI::DesignCanvas::rebuild_bodies().

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

◆ clone_for_cut()

void Slic3r::ModelObject::clone_for_cut ( ModelObject ** obj)
2118{
2119 (*obj) = ModelObject::new_clone(*this);
2120 (*obj)->set_model(this->get_model());
2121 (*obj)->sla_support_points.clear();
2122 (*obj)->sla_drain_holes.clear();
2123 (*obj)->sla_points_status = sla::PointsStatus::NoPoints;
2124 (*obj)->clear_volumes();
2125 (*obj)->input_file.clear();
2126}
Model * get_model()
Definition Model.hpp:433
@ NoPoints
Definition SupportPoint.hpp:14

References ModelObject(), clone_for_cut(), get_model(), and Slic3r::sla::NoPoints.

Referenced by clone_for_cut(), Slic3r::Cut::perform_by_contour(), Slic3r::Cut::perform_with_groove(), Slic3r::Cut::perform_with_plane(), and Slic3r::process_connector_cut().

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

◆ convert_units()

void Slic3r::ModelObject::convert_units ( ModelObjectPtrs & new_objects,
ConversionType conv_type,
std::vector< int > volume_idxs )
2001{
2002 BOOST_LOG_TRIVIAL(trace) << "ModelObject::convert_units - start";
2003
2004 ModelObject* new_object = new_clone(*this);
2005
2006 float koef = conv_type == ConversionType::CONV_FROM_INCH ? 25.4f : conv_type == ConversionType::CONV_TO_INCH ? 0.0393700787f :
2007 conv_type == ConversionType::CONV_FROM_METER ? 1000.f : conv_type == ConversionType::CONV_TO_METER ? 0.001f : 1.f;
2008
2009 new_object->set_model(nullptr);
2010 new_object->sla_support_points.clear();
2011 new_object->sla_drain_holes.clear();
2012 new_object->sla_points_status = sla::PointsStatus::NoPoints;
2013 new_object->brim_points.clear();
2014 new_object->clear_volumes();
2015 new_object->input_file.clear();
2016
2017 int vol_idx = 0;
2018 for (ModelVolume* volume : volumes) {
2019 if (!volume->mesh().empty()) {
2020 TriangleMesh mesh(volume->mesh());
2021
2022 ModelVolume* vol = new_object->add_volume(mesh);
2023 vol->name = volume->name;
2024 vol->set_type(volume->type());
2025 // Don't copy the config's ID.
2026 vol->config.assign_config(volume->config);
2027 assert(vol->config.id().valid());
2028 assert(vol->config.id() != volume->config.id());
2029 vol->set_material(volume->material_id(), *volume->material());
2030 vol->source.input_file = volume->source.input_file;
2031 vol->source.object_idx = (int)new_objects.size();
2032 vol->source.volume_idx = vol_idx;
2033 vol->source.is_converted_from_inches = volume->source.is_converted_from_inches;
2034 vol->source.is_converted_from_meters = volume->source.is_converted_from_meters;
2035 vol->source.is_from_builtin_objects = volume->source.is_from_builtin_objects;
2036
2037 vol->supported_facets.assign(volume->supported_facets);
2038 vol->seam_facets.assign(volume->seam_facets);
2039 vol->mmu_segmentation_facets.assign(volume->mmu_segmentation_facets);
2040 vol->fuzzy_skin_facets.assign(volume->fuzzy_skin_facets);
2041
2042 // Perform conversion only if the target "imperial" state is different from the current one.
2043 // This check supports conversion of "mixed" set of volumes, each with different "imperial" state.
2044 if (//vol->source.is_converted_from_inches != from_imperial &&
2045 (volume_idxs.empty() ||
2046 std::find(volume_idxs.begin(), volume_idxs.end(), vol_idx) != volume_idxs.end())) {
2047 vol->scale_geometry_after_creation(koef);
2048 vol->set_offset(Vec3d(koef, koef, koef).cwiseProduct(volume->get_offset()));
2049 if (conv_type == ConversionType::CONV_FROM_INCH || conv_type == ConversionType::CONV_TO_INCH)
2050 vol->source.is_converted_from_inches = conv_type == ConversionType::CONV_FROM_INCH;
2051 if (conv_type == ConversionType::CONV_FROM_METER || conv_type == ConversionType::CONV_TO_METER)
2052 vol->source.is_converted_from_meters = conv_type == ConversionType::CONV_FROM_METER;
2053 assert(! vol->source.is_converted_from_inches || ! vol->source.is_converted_from_meters);
2054 }
2055 else
2056 vol->set_offset(volume->get_offset());
2057 }
2058 vol_idx ++;
2059 }
2060 new_object->invalidate_bounding_box();
2061
2062 new_objects.push_back(new_object);
2063
2064 BOOST_LOG_TRIVIAL(trace) << "ModelObject::convert_units - end";
2065}
ModelObject(Model *model)
Definition Model.hpp:582
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
@ CONV_TO_METER
Definition Model.hpp:747
@ CONV_TO_INCH
Definition Model.hpp:745
@ CONV_FROM_METER
Definition Model.hpp:748
@ CONV_FROM_INCH
Definition Model.hpp:746

References ModelObject(), add_volume(), Slic3r::FacetsAnnotation::assign(), Slic3r::ModelConfig::assign_config(), brim_points, clear_volumes(), Slic3r::ModelVolume::config, Slic3r::CONV_FROM_INCH, Slic3r::CONV_FROM_METER, Slic3r::CONV_TO_INCH, Slic3r::CONV_TO_METER, convert_units(), Slic3r::ModelVolume::fuzzy_skin_facets, Slic3r::ObjectBase::id(), Slic3r::ObjectID::id, input_file, Slic3r::ModelVolume::Source::input_file, invalidate_bounding_box(), Slic3r::ModelVolume::Source::is_converted_from_inches, Slic3r::ModelVolume::Source::is_converted_from_meters, Slic3r::ModelVolume::Source::is_from_builtin_objects, mesh(), Slic3r::ModelVolume::mmu_segmentation_facets, Slic3r::ModelVolume::name, Slic3r::sla::NoPoints, Slic3r::ModelVolume::Source::object_idx, Slic3r::ModelVolume::scale_geometry_after_creation(), Slic3r::ModelVolume::seam_facets, Slic3r::ModelVolume::set_material(), set_model(), Slic3r::ModelVolume::set_offset(), Slic3r::ModelVolume::set_type(), sla_drain_holes, sla_points_status, sla_support_points, Slic3r::ModelVolume::source, Slic3r::ModelVolume::supported_facets, Slic3r::trace(), Slic3r::ObjectID::valid(), Slic3r::ModelVolume::Source::volume_idx, and volumes.

Referenced by convert_units().

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

◆ convex_hull_2d()

Polygon Slic3r::ModelObject::convex_hull_2d ( const Transform3d & trafo_instance) const
1820{
1821#if 0
1822 Points pts;
1823
1824 for (const ModelVolume* v : volumes) {
1825 if (v->is_model_part()) {
1826 //BBS: use convex hull vertex instead of all
1827 append(pts, its_convex_hull_2d_above(v->get_convex_hull().its, (trafo_instance * v->get_matrix()).cast<float>(), 0.0f).points);
1828 // The next commented line instead of the previous + the rest of this #if0 section is the same as PrusaSlicer until https://github.com/prusa3d/PrusaSlicer/commit/2f7f3578d531f2d34f7732a64449606d86bb4aaa where it was parallelised.
1829 //append(pts, its_convex_hull_2d_above(v->mesh().its, (trafo_instance * v->get_matrix()).cast<float>(), 0.0f).points);
1830 // its_convex_hull_2d_above calls its_collect_mesh_projection_points_above
1831 // The latter multiplies each vertex by the full matrix
1832 // For every vector which crosses the Z plane, the intersection is used instead of any point below. Consecutive points below the Z plane are ignored.
1833 }
1834 }
1835 return Geometry::convex_hull(std::move(pts));
1836#else
1837 // This seems to differ from PrusaSlicer (and the old code above) in that
1838 // points below the Z plane aren't treated specially.
1839 Points pts;
1840 for (const ModelVolume *v : this->volumes)
1841 if (v->is_model_part()) {
1842 const Polygon& volume_hull = v->get_convex_hull_2d(trafo_instance);
1843 // In comparison to the old code above, get_convex_hull_2d starts with:
1844 // new_matrix = trafo_instance * m_transformation.get_matrix();
1845 // which is the same matrix multiplication as above.
1846 // Then checks caches, maybe calling ModelVolume::calculate_convex_hull_2d(const Geometry::Transformation &) if no hit
1847 // That method accesses v->get_convex_hull().its (also used above).
1848 // It multiplies each point by the matrix w/o translate, then calls convex_hull(pts)
1849 // Then translates polygon in X & Y
1850
1851 pts.insert(pts.end(), volume_hull.points.begin(), volume_hull.points.end());
1852 }
1853
1854 //std::sort(pts.begin(), pts.end(), [](const Point& a, const Point& b) { return a(0) < b(0) || (a(0) == b(0) && a(1) < b(1)); });
1855 //pts.erase(std::unique(pts.begin(), pts.end(), [](const Point& a, const Point& b) { return a(0) == b(0) && a(1) == b(1); }), pts.end());
1856 /*std::vector<Points> points;
1857 //points.push_back(pts);
1858 Polygon hull = Geometry::convex_hull(std::move(pts));
1859 static int irun = 0;
1860 BoundingBox bbox_svg;
1861
1862 bbox_svg.merge(get_extents(pts));
1863 bbox_svg.merge(get_extents(hull));
1864 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": bbox_svg.min{%1%,%2%} max{%3%,%4%}, points count %5%")% bbox_svg.min.x()% bbox_svg.min.y()% bbox_svg.max.x()% bbox_svg.max.y()%points[0].size();
1865 {
1866 std::stringstream stri;
1867 stri << "convex_2d_hull_" << irun << ".svg";
1868 SVG svg(stri.str(), bbox_svg);
1869
1870 std::vector<Polygon> hulls;
1871 hulls.push_back(hull);
1872 svg.draw(to_polylines(points), "blue");
1873 svg.draw(to_polylines(hulls), "red");
1874 svg.Close();
1875 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": stri %1%, Polygon.size %2%, point[0] {%3%, %4%}, point[1] {%5%, %6%}")% stri.str()% hull.size()% hull[0].x()% hull[0].y()% hull[1].x()% hull[1].y();
1876 }
1877 ++ irun;
1878 return hull;*/
1879 return Geometry::convex_hull(std::move(pts));
1880#endif
1881}
Points points
Definition MultiPoint.hpp:22
Polygon convex_hull(Points pts)
Definition ConvexHull.cpp:21
std::vector< Point, PointsAllocator< Point > > Points
Definition Point.hpp:73
Polygon its_convex_hull_2d_above(const indexed_triangle_set &its, const TransformVertex &transform_fn, const float z)
Definition TriangleMesh.cpp:884
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:157
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References Slic3r::append(), Slic3r::Geometry::convex_hull(), convex_hull_2d(), Slic3r::its_convex_hull_2d_above(), Slic3r::MultiPoint::points, and volumes.

Referenced by convex_hull_2d(), Slic3r::GUI::RotoptimizeJob::finalize(), Slic3r::GUI::GLCanvas3D::get_empty_cells(), Slic3r::GUI::GLCanvas3D::update_compacted_wipe_tower_clearance(), and Slic3r::GUI::GLCanvas3D::update_sequential_clearance().

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

◆ copy_id()

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

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

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

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

◆ copy_transformation_caches()

void Slic3r::ModelObject::copy_transformation_caches ( const ModelObject & src)
inlineprivate
680 {
681 m_bounding_box_approx = src.m_bounding_box_approx;
682 m_bounding_box_approx_valid = src.m_bounding_box_approx_valid;
683 m_bounding_box_exact = src.m_bounding_box_exact;
684 m_bounding_box_exact_valid = src.m_bounding_box_exact_valid;
685 m_min_max_z_valid = src.m_min_max_z_valid;
686 m_raw_bounding_box = src.m_raw_bounding_box;
687 m_raw_bounding_box_valid = src.m_raw_bounding_box_valid;
688 m_raw_mesh_bounding_box = src.m_raw_mesh_bounding_box;
689 m_raw_mesh_bounding_box_valid = src.m_raw_mesh_bounding_box_valid;
690 }
bool m_raw_mesh_bounding_box_valid
Definition Model.hpp:677
BoundingBoxf3 m_raw_bounding_box
Definition Model.hpp:674
BoundingBoxf3 m_raw_mesh_bounding_box
Definition Model.hpp:676
bool m_raw_bounding_box_valid
Definition Model.hpp:675

References ModelObject(), m_bounding_box_approx, m_bounding_box_approx_valid, m_bounding_box_exact, m_bounding_box_exact_valid, m_min_max_z_valid, m_raw_bounding_box, m_raw_bounding_box_valid, m_raw_mesh_bounding_box, and m_raw_mesh_bounding_box_valid.

Here is the call graph for this function:

◆ delete_connectors()

void Slic3r::ModelObject::delete_connectors ( )
2110{
2111 for (int id = int(this->volumes.size()) - 1; id >= 0; id--) {
2112 if (volumes[id]->is_cut_connector())
2113 this->delete_volume(size_t(id));
2114 }
2115}
void delete_volume(size_t idx)
Definition Model.cpp:1457

References delete_connectors(), delete_volume(), and volumes.

Referenced by delete_connectors().

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

◆ delete_instance()

void Slic3r::ModelObject::delete_instance ( size_t idx)
1584{
1585 ModelInstancePtrs::iterator i = this->instances.begin() + idx;
1586 delete *i;
1587 this->instances.erase(i);
1589}

References delete_instance(), instances, and invalidate_bounding_box().

Referenced by delete_instance(), delete_last_instance(), and Slic3r::GUI::ObjectList::instances_to_separated_object().

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

◆ delete_last_instance()

void Slic3r::ModelObject::delete_last_instance ( )
1592{
1593 this->delete_instance(this->instances.size() - 1);
1594}
void delete_instance(size_t idx)
Definition Model.cpp:1583

References delete_instance(), delete_last_instance(), and instances.

Referenced by Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::GUI::Plater::decrease_instances(), and delete_last_instance().

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

◆ delete_volume()

void Slic3r::ModelObject::delete_volume ( size_t idx)
1458{
1459 ModelVolumePtrs::iterator i = this->volumes.begin() + idx;
1460 delete *i;
1461 this->volumes.erase(i);
1462
1463 if (this->volumes.size() == 1)
1464 {
1465 // only one volume left
1466 // we need to collapse the volume transform into the instances transforms because now when selecting this volume
1467 // it will be seen as a single full instance ans so its volume transform may be ignored
1468 ModelVolume* v = this->volumes.front();
1469 Transform3d v_t = v->get_transformation().get_matrix();
1470 for (ModelInstance* inst : this->instances)
1471 {
1472 inst->set_transformation(Geometry::Transformation(inst->get_transformation().get_matrix() * v_t));
1473 }
1474 Geometry::Transformation t;
1475 v->set_transformation(t);
1476 v->set_new_unique_id();
1477 }
1478
1480 // BBS: backup
1482}

References delete_volume(), Slic3r::Geometry::Transformation::get_matrix(), Slic3r::ModelVolume::get_transformation(), invalidate_bounding_box(), Slic3r::save_object_mesh(), Slic3r::ModelVolume::set_new_unique_id(), and Slic3r::ModelVolume::set_transformation().

Referenced by delete_connectors(), delete_volume(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::Cut::perform_with_plane(), 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:

◆ ensure_on_bed()

void Slic3r::ModelObject::ensure_on_bed ( bool allow_negative_z = false)
1897{
1898 if (!auto_drop)
1899 return;
1900
1901 double z_offset = 0.0;
1902
1903 if (allow_negative_z) {
1904 if (parts_count() == 1) {
1905 const double min_z = this->min_z();
1906 const double max_z = this->max_z();
1907 if (min_z >= SINKING_Z_THRESHOLD || max_z < 0.0)
1908 z_offset = -min_z;
1909 }
1910 else {
1911 const double max_z = this->max_z();
1913 z_offset = SINKING_MIN_Z_THRESHOLD - max_z;
1914 }
1915 }
1916 else
1917 z_offset = -this->min_z();
1918
1919 if (z_offset != 0.0)
1920 translate_instances(z_offset * Vec3d::UnitZ());
1921}
double min_z() const
Definition Model.cpp:1632
size_t parts_count() const
Definition Model.cpp:2084
double max_z() const
Definition Model.cpp:1638
void translate_instances(const Vec3d &vector)
Definition Model.cpp:1923
bool auto_drop
Definition Model.hpp:405
static const double SINKING_MIN_Z_THRESHOLD
Definition Model.hpp:1968
static const float SINKING_Z_THRESHOLD
Definition Model.hpp:1967

References auto_drop, ensure_on_bed(), max_z(), min_z(), parts_count(), Slic3r::SINKING_MIN_Z_THRESHOLD, Slic3r::SINKING_Z_THRESHOLD, and translate_instances().

Referenced by Slic3r::GUI::Plater::_calib_apply_belt_mode(), Slic3r::GUI::Plater::_calib_pa_pattern(), Slic3r::GUI::Plater::_calib_temp_belt_sectioned(), Slic3r::GUI::ObjectList::apply_object_instance_transfrom_to_all_volumes(), Slic3r::GUI::GLGizmoSimplify::apply_simplify(), Slic3r::GUI::Plater::priv::apply_textured_mesh_import_result(), Slic3r::GUI::ObjectList::boolean(), Slic3r::GUI::Plater::calib_temp(), anonymous_namespace{EmbossJob.cpp}::create_volume(), Slic3r::GUI::ensure_belt_purge_tower(), ensure_on_bed(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::finalize(), Slic3r::GUI::RotoptimizeJob::finalize(), Slic3r::GUI::ObjectList::fix_through_cgal(), Slic3r::GUI::OrientJob::get_orient_mesh(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_mesh_object(), Slic3r::GUI::ObjectList::merge(), Slic3r::orientation::orient(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::Plater::priv::replace_volume_with_stl(), Slic3r::CLI::run(), Slic3r::GUI::Plater::set_printer_technology(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), Slic3r::GUI::ObjectList::smooth_mesh(), and Slic3r::GUI::ObjectList::toggle_auto_drop().

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

◆ facets_count()

size_t Slic3r::ModelObject::facets_count ( ) const
2076{
2077 size_t num = 0;
2078 for (const ModelVolume *v : this->volumes)
2079 if (v->is_model_part())
2080 num += v->mesh().facets_count();
2081 return num;
2082}

References facets_count().

Referenced by facets_count(), Slic3r::MeshInspect::inspect_to_json(), Slic3r::GUI::Plater::show_object_info(), and Slic3r::GUI::ObjectList::smooth_mesh().

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

◆ full_raw_mesh_bounding_box()

BoundingBoxf3 Slic3r::ModelObject::full_raw_mesh_bounding_box ( ) const
1752{
1753 BoundingBoxf3 bb;
1754 for (const ModelVolume *v : this->volumes)
1755 bb.merge(v->mesh().transformed_bounding_box(v->get_matrix()));
1756 return bb;
1757}

References full_raw_mesh_bounding_box(), and Slic3r::BoundingBox3Base< PointType >::merge().

Referenced by center_around_origin(), and full_raw_mesh_bounding_box().

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

◆ generate_new_id()

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

References s_last_id.

Referenced by ObjectBase(), and set_new_unique_id().

Here is the caller graph for this function:

◆ get_backup_id()

int Slic3r::ModelObject::get_backup_id ( ) const
1365{ return m_model ? get_model()->get_object_backup_id(*this) : -1; }
int get_object_backup_id(ModelObject const &object)
Definition Model.cpp:753

References get_backup_id(), get_model(), and m_model.

Referenced by get_backup_id().

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

◆ get_config_value()

template<typename T>
const T * Slic3r::ModelObject::get_config_value ( const DynamicPrintConfig & global_config,
const std::string & config_option )
inline
437 {
438 if (config.has(config_option))
439 return static_cast<const T*>(config.option(config_option));
440 else
441 return global_config.option<T>(config_option);
442 }

References config, and Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ get_export_filename()

std::string Slic3r::ModelObject::get_export_filename ( ) const
2606{
2607 std::string ret = input_file;
2608
2609 if (!name.empty())
2610 {
2611 if (ret.empty())
2612 // input_file was empty, just use name
2613 ret = name;
2614 else
2615 {
2616 // Replace file name in input_file with name, but keep the path and file extension.
2617 ret = (boost::filesystem::path(name).parent_path().empty()) ?
2618 (boost::filesystem::path(ret).parent_path() / name).make_preferred().string() : name;
2619 }
2620 }
2621
2622 return ret;
2623}
std::string name
Definition Model.hpp:384
std::string input_file
Definition Model.hpp:387

References get_export_filename(), input_file, and name.

Referenced by get_export_filename().

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

◆ get_instance_max_z()

double Slic3r::ModelObject::get_instance_max_z ( size_t instance_idx) const
2528{
2529 double max_z = -DBL_MAX;
2530
2531 const ModelInstance* inst = instances[instance_idx];
2532 const Transform3d mi = inst->get_matrix_no_offset();
2533
2534 for (const ModelVolume* v : volumes) {
2535 if (!v->is_model_part())
2536 continue;
2537
2538 const Transform3d mv = mi * v->get_matrix();
2539 const TriangleMesh& hull = v->get_convex_hull();
2540 for (const stl_triangle_vertex_indices& facet : hull.its.indices)
2541 for (int i = 0; i < 3; ++i)
2542 max_z = std::max(max_z, (mv * hull.its.vertices[facet[i]].cast<double>()).z());
2543 }
2544
2545 return max_z + inst->get_offset(Z);
2546}
@ Z
Definition libslic3r.h:143

References get_instance_max_z(), Slic3r::ModelInstance::get_matrix_no_offset(), Slic3r::ModelInstance::get_offset(), instances, Slic3r::TriangleMesh::its, max_z(), volumes, and Slic3r::Z.

Referenced by get_instance_max_z(), and Slic3r::GUI::GLCanvas3D::update_compacted_wipe_tower_clearance().

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

◆ get_instance_min_z()

double Slic3r::ModelObject::get_instance_min_z ( size_t instance_idx) const
2492{
2493 double min_z = DBL_MAX;
2494
2495 const ModelInstance* inst = instances[instance_idx];
2496 const Transform3d mi = inst->get_matrix_no_offset();
2497
2498 for (const ModelVolume* v : volumes) {
2499 if (!v->is_model_part())
2500 continue;
2501
2502 const Transform3d mv = mi * v->get_matrix();
2503 const TriangleMesh& hull = v->get_convex_hull();
2504 //BBS: in some case the convex hull is empty due to the qhull algo
2505 //use the original mesh instead
2506 //TODO: when the vertex's x/y/z are all the same, the run_qhull can not get correct result
2507 //we need to find another algo then
2508 if (hull.its.indices.size() == 0) {
2509 const TriangleMesh& mesh = v->mesh();
2510 for (const stl_triangle_vertex_indices& facet : mesh.its.indices)
2511 for (int i = 0; i < 3; ++i)
2512 min_z = std::min(min_z, (mv * mesh.its.vertices[facet[i]].cast<double>()).z());
2513 }
2514 else {
2515 for (const stl_triangle_vertex_indices& facet : hull.its.indices)
2516 for (int i = 0; i < 3; ++i)
2517 min_z = std::min(min_z, (mv * hull.its.vertices[facet[i]].cast<double>()).z());
2518 }
2519 }
2520
2521 //BBS: add some logic to avoid wrong compute for min_z
2522 if (min_z == DBL_MAX)
2523 min_z = 0;
2524 return min_z + inst->get_offset(Z);
2525}

References get_instance_min_z(), Slic3r::ModelInstance::get_matrix_no_offset(), Slic3r::ModelInstance::get_offset(), instances, Slic3r::TriangleMesh::its, mesh(), min_z(), volumes, and Slic3r::Z.

Referenced by Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), and get_instance_min_z().

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

◆ get_model() [1/2]

Model * Slic3r::ModelObject::get_model ( )
inline
433{ return m_model; }

References m_model, and Model.

Referenced by Slic3r::Model::add_object(), clone_for_cut(), get_backup_id(), Slic3r::GUI::ObjectList::instances_to_separated_object(), and Slic3r::GUI::ObjectList::instances_to_separated_objects().

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

◆ get_model() [2/2]

const Model * Slic3r::ModelObject::get_model ( ) const
inline
434{ return m_model; }

References m_model, and Model.

Here is the call graph for this function:

◆ get_object_stl_stats()

TriangleMeshStats Slic3r::ModelObject::get_object_stl_stats ( ) const
2626{
2627 TriangleMeshStats full_stats;
2628 full_stats.volume = 0.f;
2629
2630 // fill full_stats from all objet's meshes
2631 for (ModelVolume* volume : this->volumes)
2632 {
2633 const TriangleMeshStats& stats = volume->mesh().stats();
2634
2635 // initialize full_stats (for repaired errors)
2636 full_stats.open_edges += stats.open_edges;
2637 full_stats.repaired_errors.merge(stats.repaired_errors);
2638
2639 // another used satistics value
2640 if (volume->is_model_part()) {
2641 Transform3d trans = instances.empty() ? volume->get_matrix() : (volume->get_matrix() * instances[0]->get_matrix());
2642 full_stats.volume += stats.volume * std::fabs(trans.matrix().block(0, 0, 3, 3).determinant());
2643 full_stats.number_of_parts += stats.number_of_parts;
2644 }
2645 }
2646
2647 return full_stats;
2648}

References get_object_stl_stats(), instances, Slic3r::RepairedMeshErrors::merge(), Slic3r::TriangleMeshStats::number_of_parts, Slic3r::TriangleMeshStats::open_edges, Slic3r::TriangleMeshStats::repaired_errors, and Slic3r::TriangleMeshStats::volume.

Referenced by Slic3r::GUI::ObjectList::delete_from_model_and_list(), get_object_stl_stats(), get_repaired_errors_count(), and Slic3r::GUI::Plater::show_object_info().

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

◆ get_repaired_errors_count()

int Slic3r::ModelObject::get_repaired_errors_count ( const int vol_idx = -1) const
2651{
2652 if (vol_idx >= 0)
2653 return this->volumes[vol_idx]->get_repaired_errors_count();
2654
2655 const RepairedMeshErrors& stats = get_object_stl_stats().repaired_errors;
2656
2657 return stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
2658 stats.facets_reversed + stats.backwards_edges;
2659}
TriangleMeshStats get_object_stl_stats() const
Definition Model.cpp:2625
int degenerate_facets
Definition TriangleMesh.hpp:29
RepairedMeshErrors repaired_errors
Definition TriangleMesh.hpp:66

References Slic3r::RepairedMeshErrors::backwards_edges, Slic3r::RepairedMeshErrors::degenerate_facets, Slic3r::RepairedMeshErrors::edges_fixed, Slic3r::RepairedMeshErrors::facets_removed, Slic3r::RepairedMeshErrors::facets_reversed, get_object_stl_stats(), and get_repaired_errors_count().

Referenced by get_repaired_errors_count().

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

◆ has_connectors()

bool Slic3r::ModelObject::has_connectors ( ) const
2094{
2095 assert(is_cut());
2096 for (const ModelVolume *v : this->volumes)
2097 if (v->cut_info.is_connector) return true;
2098
2099 return false;
2100}
bool is_cut() const
Definition Model.hpp:577

References has_connectors(), and is_cut().

Referenced by has_connectors(), and Slic3r::GUI::ObjectList::update_info_items().

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

◆ has_custom_layering()

bool Slic3r::ModelObject::has_custom_layering ( ) const
inline
464 { return ! this->layer_config_ranges.empty() || ! this->layer_height_profile.empty(); }
t_layer_config_ranges layer_config_ranges
Definition Model.hpp:397

References Slic3r::LayerHeightProfile::empty().

Referenced by Slic3r::CLI::run().

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

◆ has_solid_mesh()

bool Slic3r::ModelObject::has_solid_mesh ( ) const
2662{
2663 for (const ModelVolume* volume : volumes)
2664 if (volume->is_model_part())
2665 return true;
2666 return false;
2667}

References has_solid_mesh(), and volumes.

Referenced by has_solid_mesh().

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

◆ id()

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

References m_id.

Referenced by Slic3r::CutObjectBase::CutObjectBase(), Slic3r::Model::Model(), Slic3r::ModelInstance::ModelInstance(), Slic3r::ModelMaterial::ModelMaterial(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelObject::ModelObject(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), Slic3r::ModelVolume::ModelVolume(), ObjectBase(), Slic3r::PrintBase::SlicingStatus::SlicingStatus(), Slic3r::PrintBase::SlicingStatus::SlicingStatus(), Slic3r::_BBS_3MF_Exporter::_add_cut_information_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::GUI::Plater::priv::actualize_slicing_warnings(), Slic3r::ModelObjectStatusDB::add(), Slic3r::ModelObjectStatusDB::add_if_new(), Slic3r::Model::add_object(), Slic3r::append_and_translate(), Slic3r::SLAPrint::apply(), Slic3r::GUI::calc_distance(), Slic3r::GUI::calc_surface_offset(), Slic3r::check_model_ids_equal(), Slic3r::check_model_ids_validity(), Slic3r::GUI::GLGizmoTextureDisplacement::close_image_adjust(), Slic3r::Model::collect_reusable_objects(), Slic3r::ModelObject::convert_units(), copy_id(), Slic3r::PrintObjectStatusDB::count(), anonymous_namespace{RaycastManager.cpp}::create_key(), Slic3r::GUI::create_meshes(), anonymous_namespace{EmbossJob.cpp}::create_volume(), Slic3r::GUI::Emboss::create_volume_sources(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GCode::do_export(), Slic3r::GUI::PartPlate::duplicate_all_instance(), Slic3r::GUI::PartPlateList::duplicate_plate(), Slic3r::GUI::PartPlate::estimate_wipe_tower_footprint(), Slic3r::Print::export_cached_data(), Slic3r::GUI::Plater::export_stl(), Slic3r::find_volume_extents(), Slic3r::PreciseSeam::detail::fragment_location(), Slic3r::GUI::Plater::priv::generate_first_layer_bbox(), Slic3r::ModelObjectStatusDB::get(), Slic3r::Model::get_backup_path(), Slic3r::GUI::GLCanvas3D::get_empty_cells(), Slic3r::ModelInstance::get_labeled_id(), Slic3r::GUI::get_model_volume(), Slic3r::PrintObjectStatusDB::get_range(), Slic3r::GUI::get_selected_volume(), Slic3r::GUI::get_volume(), Slic3r::CutObjectBase::has_same_id(), Slic3r::UndoRedo::StackImpl::immutable_object_id_impl(), Slic3r::GUI::GLGizmoFdmSupports::init_print_instance(), Slic3r::CutObjectBase::is_equal(), Slic3r::GUI::GLGizmoSVG::is_svg_object(), Slic3r::ModelVolume::is_the_only_one_part(), Slic3r::GUI::IMSlider::IsNewPrint(), Slic3r::ModelObject::load(), load_and_construct(), Slic3r::Print::load_cached_data(), Slic3r::GLVolumeCollection::load_object_auxiliary(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::UndoRedo::StackImpl::load_snapshot(), Slic3r::GUI::GLCanvas3D::CenterOfMass::model_markers(), 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::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::open_image_adjust(), Slic3r::CutObjectBase::operator<(), Slic3r::Model::operator=(), Slic3r::ModelObject::operator=(), Slic3r::ModelObject::operator=(), Slic3r::CutObjectBase::operator==(), Slic3r::outer_inner_brim_area(), Slic3r::GUI::GLGizmoTextureDisplacement::painted_area_mm2(), Slic3r::GUI::GLGizmoCut3D::perform_cut(), anonymous_namespace{GLGizmoEmboss.cpp}::prepare_volumes_to_slice(), Slic3r::GUI::GLGizmoTextureDisplacement::preview_part(), Slic3r::GCode::process_layer(), Slic3r::GUI::NotificationManager::push_slicing_warning_notification(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_preview_job(), Slic3r::GUI::queue_texture_displacement_debug(), Slic3r::GUI::GLGizmoEmboss::re_emboss(), Slic3r::GUI::GLGizmoTextureDisplacement::rebuild_other_paint_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::rebuild_painted_colors(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::_BBS_Backup_Manager::remove_backup(), Slic3r::Model::remove_backup_path_if_exist(), Slic3r::GUI::GLGizmoTextureDisplacement::render_image_adjust_window(), Slic3r::CLI::run(), Slic3r::GUI::GLCanvas3D::LayersEditing::select_object(), Slic3r::ModelMaterial::serialize(), Slic3r::Model::set_backup_path(), Slic3r::GUI::GLGizmoBrimEars::set_brim_data(), Slic3r::GUI::PartPlate::set_hover_id(), Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection(), Slic3r::GUI::GLGizmoSVG::set_volume_by_selection(), Slic3r::sla_instances(), Slic3r::slices_to_regions(), Slic3r::ModelObject::split(), anonymous_namespace{EmbossJob.cpp}::start_create_volume_on_surface_job(), anonymous_namespace{SurfaceDrag.cpp}::start_dragging(), Slic3r::GUI::Emboss::start_update_volume(), Slic3r::UndoRedo::StackImpl::take_snapshot(), Slic3r::GUI::texture_displacement_bake_volume(), Slic3r::GUI::GLGizmoPainterBase::update_contours(), anonymous_namespace{EmbossJob.cpp}::update_name_in_list(), Slic3r::GUI::ObjectList::update_name_in_model(), Slic3r::GUI::update_object_cut_id(), Slic3r::GUI::GLGizmoTextureDisplacement::v2_recommendation(), Slic3r::verify_update_print_object_regions(), wipe_tower_instance_id, and wipe_tower_object_id.

◆ instance_bounding_box() [1/2]

BoundingBoxf3 Slic3r::ModelObject::instance_bounding_box ( const ModelInstance & instance,
bool dont_translate = false ) const
1783{
1784 BoundingBoxf3 bb;
1785 const Transform3d inst_matrix = dont_translate ?
1786 instance.get_transformation().get_matrix_no_offset() :
1787 instance.get_transformation().get_matrix();
1788
1789 for (ModelVolume *v : this->volumes) {
1790 if (v->is_model_part())
1791 bb.merge(v->mesh().transformed_bounding_box(inst_matrix * v->get_matrix()));
1792 }
1793 return bb;
1794}

References Slic3r::Geometry::Transformation::get_matrix(), Slic3r::Geometry::Transformation::get_matrix_no_offset(), Slic3r::ModelInstance::get_transformation(), instance_bounding_box(), and Slic3r::BoundingBox3Base< PointType >::merge().

Here is the call graph for this function:

◆ instance_bounding_box() [2/2]

BoundingBoxf3 Slic3r::ModelObject::instance_bounding_box ( size_t instance_idx,
bool dont_translate = false ) const
1778 {
1779 return instance_bounding_box(*this->instances[instance_idx], dont_translate);
1780}
BoundingBoxf3 instance_bounding_box(size_t instance_idx, bool dont_translate=false) const
Definition Model.cpp:1778

References instance_bounding_box(), and instances.

Referenced by Slic3r::GUI::Plater::_calib_temp_belt_sectioned(), anonymous_namespace{EmbossJob.cpp}::create_volume(), Slic3r::distribute_modifiers_from_object(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::MeshInspect::inspect_to_json(), instance_bounding_box(), instance_bounding_box(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GUI::CommonGizmosDataObjects::ObjectClipper::on_update(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::Cut::perform_with_plane(), and Slic3r::CLI::run().

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

◆ instance_convex_hull_bounding_box() [1/2]

BoundingBoxf3 Slic3r::ModelObject::instance_convex_hull_bounding_box ( const ModelInstance * instance,
bool dont_translate = false ) const
1804{
1805 BoundingBoxf3 bb;
1806 const Transform3d inst_matrix = dont_translate ? instance->get_transformation().get_matrix_no_offset() :
1807 instance->get_transformation().get_matrix();
1808 for (ModelVolume* v : this->volumes) {
1809 if (v->is_model_part())
1810 bb.merge(v->get_convex_hull().transformed_bounding_box(inst_matrix * v->get_matrix()));
1811 }
1812 return bb;
1813}

References Slic3r::Geometry::Transformation::get_matrix(), Slic3r::Geometry::Transformation::get_matrix_no_offset(), Slic3r::ModelInstance::get_transformation(), instance_convex_hull_bounding_box(), and Slic3r::BoundingBox3Base< PointType >::merge().

Here is the call graph for this function:

◆ instance_convex_hull_bounding_box() [2/2]

BoundingBoxf3 Slic3r::ModelObject::instance_convex_hull_bounding_box ( size_t instance_idx,
bool dont_translate = false ) const
1799{
1800 return instance_convex_hull_bounding_box(this->instances[instance_idx], dont_translate);
1801}
BoundingBoxf3 instance_convex_hull_bounding_box(size_t instance_idx, bool dont_translate=false) const
Definition Model.cpp:1798

References instance_convex_hull_bounding_box(), and instances.

Referenced by Slic3r::GUI::PartPlate::estimate_wipe_tower_footprint(), instance_convex_hull_bounding_box(), instance_convex_hull_bounding_box(), Slic3r::GUI::Selection::paste_objects_from_clipboard(), and Slic3r::GUI::Plater::show_object_info().

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

◆ invalidate_bounding_box()

◆ invalidate_cut()

void Slic3r::ModelObject::invalidate_cut ( )
2103{
2104 this->cut_id.invalidate();
2105 for (ModelVolume *volume : this->volumes)
2106 volume->invalidate_cut_info();
2107}
CutObjectBase cut_id
Definition Model.hpp:431

References cut_id, and invalidate_cut().

Referenced by invalidate_cut().

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

◆ is_cut()

◆ is_fdm_support_painted()

bool Slic3r::ModelObject::is_fdm_support_painted ( ) const
1495{
1496 return std::any_of(this->volumes.cbegin(), this->volumes.cend(), [](const ModelVolume *mv) { return mv->is_fdm_support_painted(); });
1497}

References is_fdm_support_painted().

Referenced by is_fdm_support_painted().

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

◆ is_fuzzy_skin_painted()

bool Slic3r::ModelObject::is_fuzzy_skin_painted ( ) const
1510{
1511 return std::any_of(this->volumes.cbegin(), this->volumes.cend(), [](const ModelVolume *mv) { return mv->is_fuzzy_skin_painted(); });
1512}

References is_fuzzy_skin_painted().

Referenced by is_fuzzy_skin_painted(), Slic3r::PrintObject::is_fuzzy_skin_painted(), and Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window().

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

◆ is_mm_painted()

bool Slic3r::ModelObject::is_mm_painted ( ) const
1505{
1506 return std::any_of(this->volumes.cbegin(), this->volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
1507}

References is_mm_painted().

Referenced by is_mm_painted(), and Slic3r::PrintObject::is_mm_painted().

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

◆ is_multiparts()

bool Slic3r::ModelObject::is_multiparts ( ) const
inline
452{ return volumes.size() > 1; }

References volumes.

Referenced by Slic3r::GUI::Selection::Clipboard::is_sla_compliant().

Here is the caller graph for this function:

◆ is_seam_painted()

bool Slic3r::ModelObject::is_seam_painted ( ) const
1500{
1501 return std::any_of(this->volumes.cbegin(), this->volumes.cend(), [](const ModelVolume *mv) { return mv->is_seam_painted(); });
1502}

References is_seam_painted().

Referenced by is_seam_painted().

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

◆ load()

template<class Archive>
void Slic3r::ModelObject::load ( Archive & ar)
inlineprivate
718 {
719 ar(cereal::base_class<ObjectBase>(this));
720 Internal::StaticSerializationWrapper<ModelConfigObject> config_wrapper(config);
721 Internal::StaticSerializationWrapper<LayerHeightProfile> layer_heigth_profile_wrapper(layer_height_profile);
722 // BBS: add backup, check modify
723 SaveObjectGaurd gaurd(*this);
724 ar(name, module_name, input_file, instances, volumes, config_wrapper, layer_config_ranges, layer_heigth_profile_wrapper,
730 std::vector<ObjectID> volume_ids2;
731 std::transform(volumes.begin(), volumes.end(), std::back_inserter(volume_ids2), std::mem_fn(&ObjectBase::id));
732 if (volume_ids != volume_ids2)
734 volume_ids.clear();
735 }
std::string module_name
Definition Model.hpp:386
sla::SupportPoints sla_support_points
Definition Model.hpp:410
sla::PointsStatus sla_points_status
Definition Model.hpp:413
BrimPoints brim_points
Definition Model.hpp:418
std::vector< ObjectID > volume_ids
Definition Model.hpp:427
sla::DrainHoles sla_drain_holes
Definition Model.hpp:416
bool printable
Definition Model.hpp:402
CutConnectors cut_connectors
Definition Model.hpp:430
ObjectID id() const
Definition ObjectID.hpp:69

References auto_drop, brim_points, config, cut_connectors, cut_id, Slic3r::ObjectBase::id(), input_file, instances, layer_config_ranges, layer_height_profile, m_bounding_box_approx, m_bounding_box_approx_valid, m_bounding_box_exact, m_bounding_box_exact_valid, m_min_max_z_valid, m_raw_bounding_box, m_raw_bounding_box_valid, m_raw_mesh_bounding_box, m_raw_mesh_bounding_box_valid, module_name, name, origin_translation, printable, Slic3r::save_object_mesh(), sla_drain_holes, sla_points_status, sla_support_points, volume_ids, and volumes.

Here is the call graph for this function:

◆ load_and_construct()

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

References id().

Here is the call graph for this function:

◆ make_boolean()

bool Slic3r::ModelObject::make_boolean ( ModelObject * cut_object,
const std::string & boolean_opts )
1369{
1370 // merge meshes into single volume instead of multi-parts object
1371 if (this->volumes.size() != 1) {
1372 // we can't merge meshes if there's not just one volume
1373 return false;
1374 }
1375 std::vector<TriangleMesh> new_meshes;
1376
1377 const TriangleMesh &cut_mesh = cut_object->mesh();
1378 MeshBoolean::mcut::make_boolean(this->mesh(), cut_mesh, new_meshes, boolean_opts);
1379
1380 this->clear_volumes();
1381 int i = 1;
1382 for (TriangleMesh &mesh : new_meshes) {
1383 ModelVolume *vol = this->add_volume(mesh);
1384 vol->name = this->name + "_" + std::to_string(i++);
1385 }
1386 return true;
1387}
ModelVolume * add_volume(const TriangleMesh &mesh, bool modify_to_center_geometry=true)
Definition Model.cpp:1389
void make_boolean(const TriangleMesh &src_mesh, const TriangleMesh &cut_mesh, std::vector< TriangleMesh > &dst_mesh, const std::string &boolean_opts)
Definition MeshBoolean.cpp:1008
void cut_mesh(const indexed_triangle_set &mesh, float z, indexed_triangle_set *upper, indexed_triangle_set *lower, bool triangulate_caps)
Definition TriangleMeshSlicer.cpp:2462

References ModelObject(), add_volume(), clear_volumes(), Slic3r::cut_mesh(), Slic3r::MeshBoolean::mcut::make_boolean(), make_boolean(), mesh(), name, and Slic3r::ModelVolume::name.

Referenced by make_boolean().

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

◆ materials_count()

size_t Slic3r::ModelObject::materials_count ( ) const
2068{
2069 std::set<t_model_material_id> material_ids;
2070 for (const ModelVolume *v : this->volumes)
2071 material_ids.insert(v->material_id());
2072 return material_ids.size();
2073}

References materials_count().

Referenced by materials_count().

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

◆ max_z()

double Slic3r::ModelObject::max_z ( ) const
1639{
1640 const_cast<ModelObject*>(this)->update_min_max_z();
1641 return m_bounding_box_exact.max.z();
1642}
void update_min_max_z()
Definition Model.cpp:1644

References ModelObject(), m_bounding_box_exact, max_z(), and update_min_max_z().

Referenced by ensure_on_bed(), get_instance_max_z(), max_z(), Slic3r::GUI::GLCanvas3D::LayersEditing::select_object(), and Slic3r::Print::validate().

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

◆ merge()

void Slic3r::ModelObject::merge ( )
2351{
2352 if (this->volumes.size() == 1) {
2353 // We can't merge meshes if there's just one volume
2354 return;
2355 }
2356
2357 TriangleMesh mesh;
2358
2359 for (ModelVolume* volume : volumes)
2360 if (!volume->mesh().empty())
2361 mesh.merge(volume->mesh());
2362
2363 this->clear_volumes();
2364 ModelVolume* vol = this->add_volume(mesh);
2365
2366 if (!vol)
2367 return;
2368}

References add_volume(), clear_volumes(), merge(), mesh(), and volumes.

Referenced by Slic3r::GUI::ObjectList::merge(), and merge().

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

◆ merge_volumes()

ModelObjectPtrs Slic3r::ModelObject::merge_volumes ( std::vector< int > & vol_indeces)
2371{
2372 ModelObjectPtrs res;
2373 if (this->volumes.size() == 1) {
2374 // We can't merge meshes if there's just one volume
2375 return res;
2376 }
2377
2378 ModelObject* upper = ModelObject::new_clone(*this);
2379 upper->set_model(nullptr);
2380 upper->sla_support_points.clear();
2381 upper->sla_drain_holes.clear();
2382 upper->sla_points_status = sla::PointsStatus::NoPoints;
2383 upper->brim_points.clear();
2384 upper->clear_volumes();
2385 upper->input_file.clear();
2386
2387#if 1
2388 TriangleMesh mesh;
2389 for (int i : vol_indeces) {
2390 auto volume = volumes[i];
2391 if (!volume->mesh().empty()) {
2392 const auto volume_matrix = volume->get_matrix();
2393 TriangleMesh mesh_(volume->mesh());
2394 mesh_.transform(volume_matrix, true);
2395 volume->reset_mesh();
2396
2397 mesh.merge(mesh_);
2398 }
2399 }
2400#else
2401 std::vector<TriangleMesh> meshes;
2402 for (int i : vol_indeces) {
2403 auto volume = volumes[i];
2404 if (!volume->mesh().empty())
2405 meshes.emplace_back(volume->mesh());
2406 }
2407 TriangleMesh mesh = MeshBoolean::cgal::merge(meshes);
2408#endif
2409
2410 ModelVolume* vol = upper->add_volume(mesh);
2411 for (int i = 0; i < volumes.size();i++) {
2412 if (std::find(vol_indeces.begin(), vol_indeces.end(), i) != vol_indeces.end()) {
2413 vol->name = volumes[i]->name + "_merged";
2414 vol->config.assign_config(volumes[i]->config);
2415 }
2416 else
2417 upper->add_volume(*volumes[i]);
2418 }
2419 upper->invalidate_bounding_box();
2420 res.push_back(upper);
2421 return res;
2422}
void merge(std::vector< _EpicMesh > &srcs, _EpicMesh &dst)
Definition MeshBoolean.cpp:560
std::vector< ModelObject * > ModelObjectPtrs
Definition CutUtils.hpp:13

References ModelObject(), add_volume(), Slic3r::ModelConfig::assign_config(), brim_points, clear_volumes(), config, Slic3r::ModelVolume::config, input_file, invalidate_bounding_box(), Slic3r::MeshBoolean::cgal::merge(), merge_volumes(), mesh(), Slic3r::ModelVolume::name, Slic3r::sla::NoPoints, set_model(), sla_drain_holes, sla_points_status, sla_support_points, Slic3r::TriangleMesh::transform(), and volumes.

Referenced by merge_volumes().

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

◆ mesh()

TriangleMesh Slic3r::ModelObject::mesh ( ) const
1676{
1677 TriangleMesh mesh;
1678 TriangleMesh raw_mesh = this->raw_mesh();
1679 for (const ModelInstance *i : this->instances) {
1680 TriangleMesh m = raw_mesh;
1681 i->transform_mesh(&m);
1682 mesh.merge(m);
1683 }
1684 return mesh;
1685}
TriangleMesh raw_mesh() const
Definition Model.cpp:1690

References instances, mesh(), and raw_mesh().

Referenced by add_volume(), add_volume(), add_volume(), convert_units(), get_instance_min_z(), make_boolean(), merge(), merge_volumes(), mesh(), Slic3r::orientation::orient(), Slic3r::orientation::orient(), print_info(), raw_mesh(), Slic3r::GUI::Plater::priv::reload_from_disk(), split(), Slic3r::store_drc(), Slic3r::store_obj(), and Slic3r::store_stl().

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

◆ min_z()

double Slic3r::ModelObject::min_z ( ) const
1633{
1634 const_cast<ModelObject*>(this)->update_min_max_z();
1635 return m_bounding_box_exact.min.z();
1636}

References ModelObject(), m_bounding_box_exact, min_z(), and update_min_max_z().

Referenced by ensure_on_bed(), get_instance_min_z(), Slic3r::GUI::ObjectList::list_manipulation(), min_z(), Slic3r::GUI::ObjectList::OnEditingStarted(), 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:

◆ mirror()

void Slic3r::ModelObject::mirror ( Axis axis)
1983{
1984 for (ModelVolume *v : this->volumes) {
1985 v->mirror(axis);
1986 }
1988}

References invalidate_bounding_box(), and mirror().

Referenced by add_instance(), and mirror().

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

◆ operator=() [1/2]

ModelObject & Slic3r::ModelObject::operator= ( const ModelObject & rhs)
inlineprivate
631 {
632 this->assign_copy(rhs);
633 m_model = rhs.m_model;
634 assert(this->id().valid());
635 assert(this->config.id().valid());
636 assert(this->layer_height_profile.id().valid());
637 assert(this->id() != this->config.id());
638 assert(this->id() != this->layer_height_profile.id());
639 assert(this->id() == rhs.id());
640 assert(this->config.id() == rhs.config.id());
641 assert(this->layer_height_profile.id() == rhs.layer_height_profile.id());
642 return *this;
643 }

References ModelObject(), config, Slic3r::ObjectBase::id(), layer_height_profile, m_model, and Slic3r::ObjectID::valid().

Here is the call graph for this function:

◆ operator=() [2/2]

ModelObject & Slic3r::ModelObject::operator= ( ModelObject && rhs)
inlineprivate
644 {
645 this->assign_copy(std::move(rhs));
646 m_model = rhs.m_model;
647 assert(this->id().valid());
648 assert(this->config.id().valid());
649 assert(this->layer_height_profile.id().valid());
650 assert(this->id() != this->config.id());
651 assert(this->id() != this->layer_height_profile.id());
652 assert(this->id() == rhs.id());
653 assert(this->config.id() == rhs.config.id());
654 assert(this->layer_height_profile.id() == rhs.layer_height_profile.id());
655 return *this;
656 }

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

Here is the call graph for this function:

◆ parts_count()

size_t Slic3r::ModelObject::parts_count ( ) const
2085{
2086 size_t num = 0;
2087 for (const ModelVolume* v : this->volumes)
2088 if (v->is_model_part())
2089 ++num;
2090 return num;
2091}

References parts_count().

Referenced by ensure_on_bed(), and parts_count().

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

◆ print_info()

void Slic3r::ModelObject::print_info ( ) const
2565{
2566 using namespace std;
2567 cout << fixed;
2568 boost::nowide::cout << "[" << boost::filesystem::path(this->input_file).filename().string() << "]" << endl;
2569
2570 TriangleMesh mesh = this->raw_mesh();
2571 BoundingBoxf3 bb = mesh.bounding_box();
2572 Vec3d size = bb.size();
2573 cout << "size_x = " << size(0) << endl;
2574 cout << "size_y = " << size(1) << endl;
2575 cout << "size_z = " << size(2) << endl;
2576 cout << "min_x = " << bb.min(0) << endl;
2577 cout << "min_y = " << bb.min(1) << endl;
2578 cout << "min_z = " << bb.min(2) << endl;
2579 cout << "max_x = " << bb.max(0) << endl;
2580 cout << "max_y = " << bb.max(1) << endl;
2581 cout << "max_z = " << bb.max(2) << endl;
2582 cout << "number_of_facets = " << mesh.facets_count() << endl;
2583
2584 cout << "manifold = " << (mesh.stats().manifold() ? "yes" : "no") << endl;
2585 if (! mesh.stats().manifold())
2586 cout << "open_edges = " << mesh.stats().open_edges << endl;
2587
2588 if (mesh.stats().repaired()) {
2589 const RepairedMeshErrors& stats = mesh.stats().repaired_errors;
2590 if (stats.degenerate_facets > 0)
2591 cout << "degenerate_facets = " << stats.degenerate_facets << endl;
2592 if (stats.edges_fixed > 0)
2593 cout << "edges_fixed = " << stats.edges_fixed << endl;
2594 if (stats.facets_removed > 0)
2595 cout << "facets_removed = " << stats.facets_removed << endl;
2596 if (stats.facets_reversed > 0)
2597 cout << "facets_reversed = " << stats.facets_reversed << endl;
2598 if (stats.backwards_edges > 0)
2599 cout << "backwards_edges = " << stats.backwards_edges << endl;
2600 }
2601 cout << "number_of_parts = " << mesh.stats().number_of_parts << endl;
2602 cout << "volume = " << mesh.volume() << endl;
2603}

References Slic3r::RepairedMeshErrors::backwards_edges, Slic3r::RepairedMeshErrors::degenerate_facets, Slic3r::RepairedMeshErrors::edges_fixed, Slic3r::RepairedMeshErrors::facets_removed, Slic3r::RepairedMeshErrors::facets_reversed, input_file, Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::max, mesh(), Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::min, print_info(), raw_mesh(), and Slic3r::BoundingBox3Base< PointType >::size().

Referenced by print_info().

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

◆ raw_bounding_box()

const BoundingBoxf3 & Slic3r::ModelObject::raw_bounding_box ( ) const
1762{
1765 m_raw_bounding_box.reset();
1766 if (this->instances.empty())
1767 throw Slic3r::InvalidArgument("Can't call raw_bounding_box() with no instances");
1768
1769 const Transform3d inst_matrix = this->instances.front()->get_transformation().get_matrix_no_offset();
1770 for (const ModelVolume *v : this->volumes)
1771 if (v->is_model_part())
1772 m_raw_bounding_box.merge(v->mesh().transformed_bounding_box(inst_matrix * v->get_matrix()));
1773 }
1774 return m_raw_bounding_box;
1775}

References instances, m_raw_bounding_box, m_raw_bounding_box_valid, and raw_bounding_box().

Referenced by raw_bounding_box().

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

◆ raw_indexed_triangle_set()

indexed_triangle_set Slic3r::ModelObject::raw_indexed_triangle_set ( ) const
1707{
1708 size_t num_vertices = 0;
1709 size_t num_faces = 0;
1710 for (const ModelVolume *v : this->volumes)
1711 if (v->is_model_part()) {
1712 num_vertices += v->mesh().its.vertices.size();
1713 num_faces += v->mesh().its.indices.size();
1714 }
1715 indexed_triangle_set out;
1716 out.vertices.reserve(num_vertices);
1717 out.indices.reserve(num_faces);
1718 for (const ModelVolume *v : this->volumes)
1719 if (v->is_model_part()) {
1720 size_t i = out.vertices.size();
1721 size_t j = out.indices.size();
1722 append(out.vertices, v->mesh().its.vertices);
1723 append(out.indices, v->mesh().its.indices);
1724 // Orca: Point the volume's triangles at its own vertices, which follow those of the volumes before it.
1725 for (size_t k = j; k < out.indices.size(); ++ k)
1726 out.indices[k] += stl_triangle_vertex_indices::Constant(int(i));
1727 const Transform3d& m = v->get_matrix();
1728 for (; i < out.vertices.size(); ++ i)
1729 out.vertices[i] = (m * out.vertices[i].cast<double>()).cast<float>().eval();
1730 if (v->is_left_handed()) {
1731 for (; j < out.indices.size(); ++ j)
1732 std::swap(out.indices[j][0], out.indices[j][1]);
1733 }
1734 }
1735 return out;
1736}

References Slic3r::append(), and raw_indexed_triangle_set().

Referenced by raw_indexed_triangle_set().

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

◆ raw_mesh()

TriangleMesh Slic3r::ModelObject::raw_mesh ( ) const
1691{
1692 TriangleMesh mesh;
1693 for (const ModelVolume *v : this->volumes)
1694 if (v->is_model_part())
1695 {
1696 TriangleMesh vol_mesh(v->mesh());
1697 vol_mesh.transform(v->get_matrix());
1698 mesh.merge(vol_mesh);
1699 }
1700 return mesh;
1701}

References mesh(), raw_mesh(), and Slic3r::TriangleMesh::transform().

Referenced by Slic3r::sla::RotfinderBoilerplate< MAX_ITER >::get_mesh_to_rotate(), mesh(), print_info(), and raw_mesh().

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

◆ raw_mesh_bounding_box()

const BoundingBoxf3 & Slic3r::ModelObject::raw_mesh_bounding_box ( ) const
1740{
1744 for (const ModelVolume *v : this->volumes)
1745 if (v->is_model_part())
1746 m_raw_mesh_bounding_box.merge(v->mesh().transformed_bounding_box(v->get_matrix()));
1747 }
1749}

References m_raw_mesh_bounding_box, m_raw_mesh_bounding_box_valid, and raw_mesh_bounding_box().

Referenced by bounding_box_approx(), center_around_origin(), Slic3r::MeshInspect::inspect_to_json(), and raw_mesh_bounding_box().

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

◆ rotate() [1/2]

void Slic3r::ModelObject::rotate ( double angle,
Axis axis )
1959{
1960 for (ModelVolume *v : this->volumes) {
1961 v->rotate(angle, axis);
1962 }
1965}
void center_around_origin(bool include_modifiers=true)
Definition Model.cpp:1883
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138

References Slic3r::angle(), center_around_origin(), invalidate_bounding_box(), and rotate().

Referenced by Slic3r::orientation::orient(), rotate(), and rotate().

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

◆ rotate() [2/2]

void Slic3r::ModelObject::rotate ( double angle,
const Vec3d & axis )
1968{
1969 for (ModelVolume *v : this->volumes) {
1970 v->rotate(angle, axis);
1971 }
1972
1973 //BBS update assemble transformation when modify volume rotation
1974 for (int i = 0; i < instances.size(); i++) {
1975 instances[i]->rotate_assemble(-angle, axis);
1976 }
1977
1980}

References Slic3r::angle(), center_around_origin(), instances, invalidate_bounding_box(), and rotate().

Here is the call graph for this function:

◆ save()

◆ scale() [1/3]

void Slic3r::ModelObject::scale ( const double s)
inline
526{ this->scale(Vec3d(s, s, s)); }
void scale(const Vec3d &versor)
Definition Model.cpp:1950

References scale().

Referenced by scale().

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

◆ scale() [2/3]

void Slic3r::ModelObject::scale ( const Vec3d & versor)
1951{
1952 for (ModelVolume *v : this->volumes) {
1953 v->scale(versor);
1954 }
1956}

References invalidate_bounding_box(), and scale().

Referenced by Slic3r::GUI::Plater::_calib_temp_belt_sectioned(), Slic3r::GUI::Plater::calib_max_vol_speed(), scale(), and scale_mesh_after_creation().

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

◆ scale() [3/3]

void Slic3r::ModelObject::scale ( double x,
double y,
double z )
inline
527{ this->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_mesh_after_creation()

void Slic3r::ModelObject::scale_mesh_after_creation ( const float scale)
1992{
1993 for (ModelVolume *v : this->volumes) {
1994 v->scale_geometry_after_creation(scale);
1995 v->set_offset(Vec3d(scale, scale, scale).cwiseProduct(v->get_offset()));
1996 }
1998}

References invalidate_bounding_box(), scale(), and scale_mesh_after_creation().

Referenced by scale_mesh_after_creation().

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

◆ scale_to_fit()

void Slic3r::ModelObject::scale_to_fit ( const Vec3d & size)

Scale the current ModelObject to fit by altering the scaling factor of ModelInstances. It operates on the total size by duplicating the object according to all the instances.

Parameters
sizeSizef3 the size vector
3060{
3061 Vec3d orig_size = this->bounding_box_exact().size();
3062 double factor = std::min(
3063 size.x() / orig_size.x(),
3064 std::min(
3065 size.y() / orig_size.y(),
3066 size.z() / orig_size.z()
3067 )
3068 );
3069 this->scale(factor);
3070}
PointType size() const
Definition BoundingBox.cpp:187
const BoundingBoxf3 & bounding_box_exact() const
Definition Model.cpp:1620

References bounding_box_exact(), scale(), and scale_to_fit().

Referenced by scale_to_fit().

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
108{ ar(m_id); }

References m_id.

◆ set_invalid_id()

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

References m_id.

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

Here is the caller graph for this function:

◆ set_model()

void Slic3r::ModelObject::set_model ( Model * model)
inlineprivate
695{ m_model = model; }

References m_model, and Model.

Referenced by Slic3r::Model::add_object(), convert_units(), and merge_volumes().

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

◆ set_new_unique_id()

void Slic3r::ModelObject::set_new_unique_id ( )
inlineprivate
657 {
659 this->config.set_new_unique_id();
660 this->layer_height_profile.set_new_unique_id();
661 }
void set_new_unique_id()
Definition ObjectID.hpp:89

References Slic3r::ObjectBase::set_new_unique_id().

Referenced by assign_new_unique_ids_recursive().

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

◆ sort_volumes()

void Slic3r::ModelObject::sort_volumes ( bool full_sort)
1515{
1516 // sort volumes inside the object to order "Model Part, Negative Volume, Modifier, Support Blocker and Support Enforcer. "
1517 if (full_sort)
1518 std::stable_sort(volumes.begin(), volumes.end(), [](ModelVolume* vl, ModelVolume* vr) {
1519 // Special handling for Precise Seam modifiers: group-based sorting with user order preservation
1520 if (vl->is_precise_seam() && vr->is_precise_seam()) {
1521 // Strong (center/left/right) always before weak (enforced/blocked/neutral)
1522 bool vl_strong = vl->is_precise_seam_strong();
1523 bool vr_strong = vr->is_precise_seam_strong();
1524 if (vl_strong != vr_strong)
1525 return vl_strong; // strong < weak → strong group appears first
1526
1527 // Within same group (both strong or both weak): preserve current order
1528 // stable_sort will maintain relative positions when comparator returns false
1529 return false;
1530 }
1531
1532 // For non-Precise-Seam or mixed types: use standard enum-based ordering
1533 return vl->type() < vr->type();
1534 });
1535 // sort have to controll "place" of the support blockers/enforcers. But one of the model parts have to be on the first place.
1536 else
1537 std::stable_sort(volumes.begin(), volumes.end(), [](ModelVolume* vl, ModelVolume* vr) {
1538 ModelVolumeType vl_type = vl->type() > ModelVolumeType::PARAMETER_MODIFIER ? vl->type() : ModelVolumeType::PARAMETER_MODIFIER;
1539 ModelVolumeType vr_type = vr->type() > ModelVolumeType::PARAMETER_MODIFIER ? vr->type() : ModelVolumeType::PARAMETER_MODIFIER;
1540
1541 // Apply same Precise Seam grouping logic for partial sort
1542 if (vl->is_precise_seam() && vr->is_precise_seam()) {
1543 bool vl_strong = vl->is_precise_seam_strong();
1544 bool vr_strong = vr->is_precise_seam_strong();
1545 if (vl_strong != vr_strong)
1546 return vl_strong;
1547 return false; // preserve order within same group
1548 }
1549
1550 return vl_type < vr_type;
1551 });
1552}

References sort_volumes(), Slic3r::ModelVolume::type(), and volumes.

Referenced by Slic3r::GUI::cut_model(), Slic3r::GUI::ObjectList::load_mesh_object(), Slic3r::GUI::ObjectList::merge(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::ObjectList::reorder_volumes_and_get_selection(), Slic3r::GUI::Plater::priv::replace_volume_with_stl(), and sort_volumes().

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

◆ split()

void Slic3r::ModelObject::split ( ModelObjectPtrs * new_objects,
bool remap_paint )
2221{
2222 std::vector<TriangleMesh> all_meshes;
2223 std::vector<Transform3d> all_transfos;
2224 std::vector<std::pair<int, int>> volume_mesh_counts;
2225 all_meshes.reserve(this->volumes.size() * 5);
2226 bool is_multi_volume_object = (this->volumes.size() > 1);
2227 std::optional<TriangleSelector::SavedPainting> saved_painting;
2228
2229 for (int volume_idx = 0; volume_idx < this->volumes.size(); volume_idx++) {
2230 ModelVolume* volume = this->volumes[volume_idx];
2231 if (volume->type() != ModelVolumeType::MODEL_PART)
2232 continue;
2233
2234 // splited volume should not be text object
2235 if (volume->text_configuration.has_value())
2236 volume->text_configuration.reset();
2237
2238 if (!is_multi_volume_object) {
2239 if (remap_paint) {
2240 // Save painting so we could restore them after the mesh split
2241 saved_painting = volume->save_painting();
2242 }
2243 //BBS: not multi volume object, then split mesh.
2244 std::vector<TriangleMesh> volume_meshes = volume->mesh().split();
2245 int mesh_count = 0;
2246 for (TriangleMesh& mesh : volume_meshes) {
2247 if (mesh.facets_count() < 3)
2248 continue;
2249
2250 all_meshes.emplace_back(std::move(mesh));
2251 all_transfos.emplace_back(volume->get_matrix());
2252 mesh_count++;
2253 }
2254 volume_mesh_counts.push_back({ volume_idx, mesh_count });
2255 } else {
2256 //BBS: multi volume object, then only split to volume
2257 if (volume->mesh().facets_count() >= 3) {
2258 all_meshes.emplace_back(std::move(volume->mesh()));
2259 all_transfos.emplace_back(volume->get_matrix());
2260 volume_mesh_counts.push_back({ volume_idx, 1 });
2261 }
2262 }
2263 }
2264
2265 FaceDetector face_detector(all_meshes, all_transfos, 1.0);
2266 face_detector.detect_exterior_face();
2267
2268 int volume_mesh_begin = 0;
2269 for (int i = 0; i < volume_mesh_counts.size(); i++) {
2270 std::pair<int, int> mesh_info = volume_mesh_counts[i];
2271 ModelVolume* volume = this->volumes[mesh_info.first];
2272
2273 std::vector<TriangleMesh> meshes;
2274 for (int mesh_idx = volume_mesh_begin; mesh_idx < volume_mesh_begin + mesh_info.second; mesh_idx++) {
2275 meshes.emplace_back(std::move(all_meshes[mesh_idx]));
2276 }
2277 volume_mesh_begin += mesh_info.second;
2278
2279 size_t counter = 1;
2280 for (TriangleMesh& mesh : meshes) {
2281 // FIXME: crashes if not satisfied
2282 if (mesh.facets_count() < 3)
2283 continue;
2284
2285 // XXX: this seems to be the only real usage of m_model, maybe refactor this so that it's not needed?
2286 ModelObject* new_object = m_model->add_object();
2287 //BBS: refine the config logic
2288 //use object as basic, and add volume's config
2289 if (meshes.size() == 1) {
2290 new_object->name = volume->name;
2291 // Don't copy the config's ID.
2292 //new_object->config.assign_config(this->config.size() > 0 ? this->config : volume->config);
2293 }
2294 else {
2295 new_object->name = this->name + (meshes.size() > 1 ? "_" + std::to_string(counter++) : "");
2296 // Don't copy the config's ID.
2297 //new_object->config.assign_config(this->config);
2298 }
2299 new_object->config.assign_config(this->config);
2300 new_object->config.apply(volume->config, true);
2301
2302 assert(new_object->config.id().valid());
2303 assert(new_object->config.id() != this->config.id());
2304 new_object->instances.reserve(this->instances.size());
2305 for (const ModelInstance* model_instance : this->instances)
2306 new_object->add_instance(*model_instance);
2307 ModelVolume* new_vol = new_object->add_volume(*volume, std::move(mesh));
2308
2309 if (is_multi_volume_object) {
2310 // BBS: volume geometry not changed, so we can keep the paint facets
2311#define COPY_FACETS(f) if (new_vol->f.timestamp() == volume->f.timestamp()) new_vol->f.reset(); /* BBS: let next assign take effect */ new_vol->f.assign(volume->f)
2312
2313 COPY_FACETS(supported_facets);
2314 COPY_FACETS(seam_facets);
2315 COPY_FACETS(mmu_segmentation_facets);
2316 COPY_FACETS(fuzzy_skin_facets);
2317 } else if (saved_painting) {
2318 // Geometry changed, attempt to remap them to the new mesh
2319 new_vol->restore_painting(saved_painting);
2320 }
2321
2322 // BBS: clear volume's config, as we already set them into object
2323 new_vol->config.reset();
2324
2325 for (ModelInstance* model_instance : new_object->instances)
2326 {
2327 const Vec3d shift = model_instance->get_transformation().get_matrix_no_offset() * new_vol->get_offset();
2328 model_instance->set_offset(model_instance->get_offset() + shift);
2329
2330 //BBS: add assemble_view related logic
2331 Geometry::Transformation instance_transformation_copy = model_instance->get_transformation();
2332 instance_transformation_copy.set_offset(-new_vol->get_offset());
2333 const Transform3d &assemble_matrix = model_instance->get_assemble_transformation().get_matrix();
2334 const Transform3d &instance_inverse_matrix = instance_transformation_copy.get_matrix().inverse();
2335 Transform3d new_instance_inverse_matrix = instance_inverse_matrix * model_instance->get_transformation().get_matrix_no_offset().inverse();
2336 Transform3d new_assemble_transform = assemble_matrix * new_instance_inverse_matrix;
2337 model_instance->set_assemble_from_transform(new_assemble_transform);
2338 model_instance->set_offset_to_assembly(new_vol->get_offset());
2339 }
2340
2341 new_vol->set_offset(Vec3d::Zero());
2342 // reset the source to disable reload from disk
2343 new_vol->source = ModelVolume::Source();
2344 new_objects->emplace_back(new_object);
2345 }
2346 }
2347}
#define COPY_FACETS(f)
@ MODEL_PART
Definition Model.hpp:357

References ModelObject(), add_instance(), add_volume(), Slic3r::ModelConfig::apply(), Slic3r::ModelConfig::assign_config(), config, Slic3r::ModelVolume::config, COPY_FACETS, Slic3r::FaceDetector::detect_exterior_face(), Slic3r::TriangleMesh::facets_count(), Slic3r::ModelInstance::get_assemble_transformation(), Slic3r::Geometry::Transformation::get_matrix(), Slic3r::ModelVolume::get_matrix(), Slic3r::Geometry::Transformation::get_matrix_no_offset(), Slic3r::ModelInstance::get_offset(), Slic3r::ModelVolume::get_offset(), Slic3r::ModelInstance::get_transformation(), Slic3r::ObjectBase::id(), Slic3r::ObjectID::id, instances, m_model, mesh(), Slic3r::ModelVolume::mesh(), Slic3r::MODEL_PART, name, Slic3r::ModelVolume::name, Slic3r::ModelConfig::reset(), Slic3r::ModelVolume::restore_painting(), Slic3r::ModelVolume::save_painting(), Slic3r::ModelInstance::set_assemble_from_transform(), Slic3r::Geometry::Transformation::set_offset(), Slic3r::ModelInstance::set_offset(), Slic3r::ModelVolume::set_offset(), Slic3r::ModelInstance::set_offset_to_assembly(), Slic3r::ModelVolume::source, split(), Slic3r::TriangleMesh::split(), Slic3r::ModelVolume::text_configuration, Slic3r::ModelVolume::type(), and Slic3r::ObjectID::valid().

Referenced by split(), and Slic3r::GUI::Plater::priv::split_object().

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

◆ timestamp()

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

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

74{ return 0; }

◆ translate() [1/2]

void Slic3r::ModelObject::translate ( const Vec3d & vector)
inline
523{ this->translate(vector(0), vector(1), vector(2)); }

References translate().

Referenced by Slic3r::GUI::ObjectList::apply_object_instance_transfrom_to_all_volumes(), center_around_origin(), construct_assemble_list(), Slic3r::GUI::ObjectList::load_mesh_object(), translate(), and translate().

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

◆ translate() [2/2]

void Slic3r::ModelObject::translate ( double x,
double y,
double z )
1939{
1940 for (ModelVolume *v : this->volumes) {
1941 v->translate(x, y, z);
1942 }
1943
1945 m_bounding_box_approx.translate(x, y, z);
1947 m_bounding_box_exact.translate(x, y, z);
1948}

References m_bounding_box_approx, m_bounding_box_approx_valid, m_bounding_box_exact, m_bounding_box_exact_valid, and translate().

Here is the call graph for this function:

◆ translate_instance()

void Slic3r::ModelObject::translate_instance ( size_t instance_idx,
const Vec3d & vector )
1931{
1932 assert(instance_idx < instances.size());
1933 ModelInstance* i = instances[instance_idx];
1934 i->set_offset(i->get_offset() + vector);
1936}

References Slic3r::ModelInstance::get_offset(), instances, invalidate_bounding_box(), Slic3r::ModelInstance::set_offset(), and translate_instance().

Referenced by Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), translate_instance(), and translate_instances().

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

◆ translate_instances()

void Slic3r::ModelObject::translate_instances ( const Vec3d & vector)
1924{
1925 for (size_t i = 0; i < instances.size(); ++i) {
1926 translate_instance(i, vector);
1927 }
1928}
void translate_instance(size_t instance_idx, const Vec3d &vector)
Definition Model.cpp:1930

References instances, translate_instance(), and translate_instances().

Referenced by Slic3r::GUI::ObjectList::apply_object_instance_transfrom_to_all_volumes(), Slic3r::GUI::ObjectList::boolean(), Slic3r::GUI::Plater::calib_temp(), Slic3r::GUI::ensure_belt_purge_tower(), ensure_on_bed(), Slic3r::GUI::ObjectList::list_manipulation(), Slic3r::GUI::ObjectList::merge(), Slic3r::GUI::ObjectList::OnEditingStarted(), Slic3r::CLI::run(), and translate_instances().

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

◆ update_instances_print_volume_state()

unsigned int Slic3r::ModelObject::update_instances_print_volume_state ( const BuildVolume & build_volume)
private
2549{
2550 unsigned int num_printable = 0;
2551 //BBS: add logs for build_volume
2552 //const BoundingBoxf3& print_volume = build_volume.bounding_volume();
2553 //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", print_volume {%1%, %2%, %3%} to {%4%, %5%, %6%}") // %print_volume.min.x() %print_volume.min.y() %print_volume.min.z()%print_volume.max.x() %print_volume.max.y() %print_volume.max.z();
2554 for (ModelInstance* model_instance : this->instances) {
2555 if (model_instance->update_print_volume_state(build_volume) == ModelInstancePVS_Inside) {
2556 //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", object %1%'s instance inside print volum")%this->name;
2557 ++num_printable;
2558 }
2559 }
2560 //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", found %1% printable instances")%num_printable;
2561 return num_printable;
2562}
@ ModelInstancePVS_Inside
Definition Model.hpp:1411

References instances, Slic3r::ModelInstancePVS_Inside, and update_instances_print_volume_state().

Referenced by update_instances_print_volume_state().

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

◆ update_min_max_z()

void Slic3r::ModelObject::update_min_max_z ( )
private
1645{
1646 assert(! this->instances.empty());
1647 if (! m_min_max_z_valid && ! this->instances.empty()) {
1648 m_min_max_z_valid = true;
1649 const Transform3d mat_instance = this->instances.front()->get_transformation().get_matrix();
1650 double global_min_z = std::numeric_limits<double>::max();
1651 double global_max_z = - std::numeric_limits<double>::max();
1652 for (const ModelVolume *v : this->volumes)
1653 if (v->is_model_part()) {
1654 const Transform3d m = mat_instance * v->get_matrix();
1655 const Vec3d row_z = m.linear().row(2).cast<double>();
1656 const double shift_z = m.translation().z();
1657 double this_min_z = std::numeric_limits<double>::max();
1658 double this_max_z = - std::numeric_limits<double>::max();
1659 for (const Vec3f &p : v->mesh().its.vertices) {
1660 double z = row_z.dot(p.cast<double>());
1661 this_min_z = std::min(this_min_z, z);
1662 this_max_z = std::max(this_max_z, z);
1663 }
1664 this_min_z += shift_z;
1665 this_max_z += shift_z;
1666 global_min_z = std::min(global_min_z, this_min_z);
1667 global_max_z = std::max(global_max_z, this_max_z);
1668 }
1669 m_bounding_box_exact.min.z() = global_min_z;
1670 m_bounding_box_exact.max.z() = global_max_z;
1671 }
1672}
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65

References instances, m_bounding_box_exact, m_min_max_z_valid, and update_min_max_z().

Referenced by max_z(), min_z(), and update_min_max_z().

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

◆ cereal::access

friend class cereal::access
friend

References cereal::access.

Referenced by cereal::access.

◆ Model

friend class Model
friend

References Model.

Referenced by ModelObject(), get_model(), get_model(), Model, and set_model().

◆ Print

friend class Print
friend

References Print.

Referenced by Print.

◆ SLAPrint

friend class SLAPrint
friend

References SLAPrint.

Referenced by SLAPrint.

◆ UndoRedo::StackImpl

friend class UndoRedo::StackImpl
friend

Member Data Documentation

◆ auto_drop

◆ brim_points

◆ config

ModelConfigObject Slic3r::ModelObject::config

Referenced by ModelObject(), ModelObject(), ModelObject(), ModelObject(), Slic3r::_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::GUI::Plater::_calib_apply_belt_mode(), Slic3r::GUI::Plater::_calib_pa_pattern(), Slic3r::GUI::Plater::_calib_temp_belt_sectioned(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::Model::add_object(), Slic3r::Model::add_object(), Slic3r::Model::add_object(), Slic3r::GUI::ObjectDataViewModel::AddObject(), Slic3r::GUI::MenuFactory::append_menu_items_flush_options(), Slic3r::SLAPrint::apply(), Slic3r::GUI::Plater::priv::apply_textured_mesh_import_result(), Slic3r::GUI::ObjectList::boolean(), Slic3r::GUI::Plater::calib_max_vol_speed(), Slic3r::GUI::Plater::calib_retraction(), Slic3r::GUI::Plater::calib_temp(), Slic3r::check_model_ids_equal(), Slic3r::check_model_ids_validity(), Slic3r::GUI::PartPlate::check_single_extruder_mixed_filament_risk(), construct_assemble_list(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::GUI::ObjectList::delete_from_model_and_list(), Slic3r::GUI::ensure_belt_purge_tower(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::finalize(), Slic3r::sla::find_least_supports_rotation(), Slic3r::GUI::GLGizmoBrimEars::get_config_options(), get_config_value(), Slic3r::GUI::ObjectList::get_default_layer_config(), Slic3r::GUI::PartPlate::get_extruders(), Slic3r::GUI::PartPlate::get_extruders_under_cli(), Slic3r::GUI::is_belt_purge_prism(), load(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::ObjectList::load_mesh_object(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GUI::ObjectList::merge(), merge_or_add_object(), merge_volumes(), Slic3r::model_has_advanced_features(), Slic3r::GUI::ObjectList::object_config_options_changed(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), operator=(), Slic3r::Print::process(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::project_used_filament_slots(), Slic3r::region_config_from_model_volume(), Slic3r::GUI::GLGizmoMmuSegmentation::remap_filament_assignments(), Slic3r::remap_model_filament_slots(), Slic3r::CLI::run(), save(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), split(), Slic3r::GUI::ObjectTableSettings::update_settings_list(), and Slic3r::SLAPrint::validate().

◆ cut_connectors

◆ cut_id

◆ input_file

◆ instances

ModelInstancePtrs Slic3r::ModelObject::instances

Referenced by Slic3r::GUI::GLGizmoCut3D::PartSelection::PartSelection(), Slic3r::_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::GUI::Plater::_calib_apply_belt_mode(), Slic3r::GUI::Plater::_calib_pa_pattern(), Slic3r::GUI::Plater::_calib_temp_belt_sectioned(), Slic3r::_3MF_Importer::_handle_end_model(), Slic3r::_BBS_3MF_Importer::_handle_end_model(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::GUI::GLCanvas3D::_set_warning_notification(), add_instance(), add_instance(), Slic3r::GUI::GLGizmoCut3D::PartSelection::add_object(), Slic3r::GUI::MenuFactory::append_menu_item_printable(), Slic3r::GUI::MenuFactory::append_menu_item_set_printable(), Slic3r::SLAPrint::apply(), Slic3r::GUI::ObjectList::apply_object_instance_transfrom_to_all_volumes(), Slic3r::GUI::GLGizmoTextureDisplacement::apply_projection_frame(), bake_xy_rotation_into_meshes(), Slic3r::GUI::ObjectList::boolean(), bounding_box_approx(), bounding_box_exact(), Slic3r::GUI::PartPlate::calc_imex_ghosts(), Slic3r::GUI::GLGizmoTextureDisplacement::capture_view_projection(), Slic3r::GUI::GLGizmoCut3D::check_and_update_connectors_state(), Slic3r::check_model_ids_equal(), Slic3r::check_model_ids_validity(), clear_instances(), Slic3r::GUI::Plater::combine_mesh_fff(), Slic3r::GUI::PartPlate::contain_any_instance_totally(), Slic3r::GUI::Selection::copy_to_clipboard(), anonymous_namespace{EmbossJob.cpp}::create_volume(), Slic3r::GUI::Plater::decrease_instances(), delete_instance(), delete_last_instance(), Slic3r::distribute_modifiers_from_object(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), Slic3r::duplicate(), Slic3r::GUI::PartPlate::duplicate_all_instance(), Slic3r::duplicate_objects(), Slic3r::GUI::PartPlateList::duplicate_plate(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::GUI::PartPlate::estimate_wipe_tower_footprint(), Slic3r::GUI::PartPlate::exclusion_volume_preview_cache_key(), Slic3r::GUI::Plater::export_stl(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::finalize(), Slic3r::GUI::FillBedJob::finalize(), Slic3r::GUI::RotoptimizeJob::finalize(), Slic3r::GUI::Plater::find_new_position(), Slic3r::get_arrange_poly(), Slic3r::get_arrange_polys(), Slic3r::GUI::GLGizmoCut3D::get_cut_matrix(), Slic3r::GUI::GLCanvas3D::get_empty_cells(), get_instance_max_z(), get_instance_min_z(), Slic3r::sla::RotfinderBoilerplate< MAX_ITER >::get_mesh_to_rotate(), get_object_stl_stats(), Slic3r::GUI::GLGizmoAlignment::get_parent_box(), Slic3r::GUI::GLGizmoPainterBase::get_projected_height_range(), Slic3r::GUI::GLGizmoAlignment::get_selected_objects_info(), Slic3r::GUI::Selection::get_volume_idxs_from_plate(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoMeshBoolean::gizmo_event(), Slic3r::GUI::GLGizmoPainterBase::gizmo_event(), Slic3r::GUI::Plater::increase_instances(), Slic3r::GUI::GLGizmoFdmSupports::init_print_instance(), Slic3r::MeshInspect::inspect_to_json(), instance_bounding_box(), instance_convex_hull_bounding_box(), Slic3r::GUI::ObjectList::instances_to_separated_object(), Slic3r::GUI::GLGizmoFlatten::is_plane_update_necessary(), load(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_mesh_object(), Slic3r::GUI::Plater::priv::load_model_objects(), Slic3r::GUI::GLCanvas3D::load_object(), Slic3r::GLVolumeCollection::load_object_auxiliary(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::GUI::GCodeViewer::load_shells(), Slic3r::GUI::PartPlate::max_broad_phase_intersecting_object_height(), Slic3r::GUI::ObjectList::merge(), mesh(), Slic3r::GUI::GLGizmoPainterBase::mesh_trafo_matrices(), Slic3r::model_has_advanced_features(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_adjust_texture(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::Selection::paste_objects_from_clipboard(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::Cut::perform_by_contour(), Slic3r::Cut::perform_with_groove(), Slic3r::Cut::perform_with_plane(), Slic3r::GUI::FillBedJob::prepare(), Slic3r::GUI::ArrangeJob::prepare_all(), Slic3r::GUI::ArrangeJob::prepare_partplate(), Slic3r::GUI::OrientJob::prepare_partplate(), Slic3r::GUI::ArrangeJob::prepare_selected(), Slic3r::GUI::OrientJob::prepare_selection(), Slic3r::print_objects_from_model_object(), Slic3r::Print::process(), Slic3r::GUI::CalibUtils::process_and_store_3mf(), Slic3r::GUI::GLGizmoCut3D::process_selection_rectangle(), Slic3r::GUI::Plater::priv::process_validation_warning(), Slic3r::GUI::NotificationManager::push_slicing_serious_warning_notification(), Slic3r::GUI::NotificationManager::push_validate_error_notification(), Slic3r::GUI::GLGizmoCut3D::put_connectors_on_cut_plane(), raw_bounding_box(), Slic3r::GUI::DesignCanvas::rebuild_bodies(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLGizmoTextureDisplacement::render_adjust_texture_gizmo(), Slic3r::GUI::GLGizmoCut3D::render_connectors(), Slic3r::GUI::GLGizmoPainterBase::render_cursor_height_range(), Slic3r::GUI::CommonGizmosDataObjects::InstancesHider::render_cut(), Slic3r::GUI::CommonGizmosDataObjects::ObjectClipper::render_cut(), Slic3r::GUI::GLGizmoTextureDisplacement::render_island_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_paint_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painted_colors(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_seam_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_shaded_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_subdivide_preview(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoTextureDisplacement::render_uvcheck_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_wireframe_overlay(), rotate(), Slic3r::CLI::run(), save(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_edge_at(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_vertex_at(), Slic3r::GUI::GLGizmoFdmSupports::select_facets_by_angle(), Slic3r::GUI::GLGizmoTextureDisplacement::select_visible_faces(), Slic3r::GUI::Plater::set_number_of_copies(), Slic3r::GUI::CommonGizmosDataObjects::ObjectClipper::set_position_by_ratio(), Slic3r::GUI::Selection::set_printable(), Slic3r::GUI::Plater::show_object_info(), Slic3r::sla_instances(), Slic3r::SLAPrint::sla_trafo(), split(), Slic3r::texture_displacement_volume_to_world(), Slic3r::GUI::ObjectList::toggle_printable_state(), translate_instance(), translate_instances(), Slic3r::GUI::GLGizmoCut3D::unproject_on_cut_plane(), Slic3r::GUI::GLCanvas3D::update_compacted_wipe_tower_clearance(), Slic3r::GUI::PartPlate::update_exclusion_volume_preview_models(), Slic3r::GUI::PartPlate::update_imex_ghost_transforms(), Slic3r::GUI::GLCanvas3D::update_instance_printable_state_for_object(), update_instances_print_volume_state(), update_min_max_z(), Slic3r::PrintBase::update_object_placeholders(), Slic3r::GUI::GLGizmoFlatten::update_planes(), Slic3r::GUI::GLGizmoCut3D::update_raycasters_for_picking_transform(), Slic3r::GUI::GLCanvas3D::update_sequential_clearance(), Slic3r::Print::update_shrinkage_compensation(), and Slic3r::GUI::Selection::update_type().

◆ layer_config_ranges

◆ layer_height_profile

◆ m_bounding_box_approx

BoundingBoxf3 Slic3r::ModelObject::m_bounding_box_approx
mutableprivate

◆ m_bounding_box_approx_valid

bool Slic3r::ModelObject::m_bounding_box_approx_valid { false }
mutableprivate

◆ m_bounding_box_exact

BoundingBoxf3 Slic3r::ModelObject::m_bounding_box_exact
mutableprivate

◆ m_bounding_box_exact_valid

bool Slic3r::ModelObject::m_bounding_box_exact_valid { false }
mutableprivate

◆ m_id

ObjectID Slic3r::ObjectBase::m_id
privateinherited

◆ m_min_max_z_valid

bool Slic3r::ModelObject::m_min_max_z_valid { false }
mutableprivate

◆ m_model

Model* Slic3r::ModelObject::m_model { nullptr }
private

◆ m_raw_bounding_box

BoundingBoxf3 Slic3r::ModelObject::m_raw_bounding_box
mutableprivate

◆ m_raw_bounding_box_valid

bool Slic3r::ModelObject::m_raw_bounding_box_valid { false }
mutableprivate

◆ m_raw_mesh_bounding_box

BoundingBoxf3 Slic3r::ModelObject::m_raw_mesh_bounding_box
mutableprivate

◆ m_raw_mesh_bounding_box_valid

bool Slic3r::ModelObject::m_raw_mesh_bounding_box_valid { false }
mutableprivate

◆ module_name

std::string Slic3r::ModelObject::module_name

◆ name

std::string Slic3r::ModelObject::name

Referenced by Slic3r::_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::GUI::Plater::_calib_pa_pattern(), Slic3r::GUI::Plater::_calib_temp_belt_sectioned(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::Model::add_object(), Slic3r::Model::add_object(), Slic3r::GUI::ObjectDataViewModel::AddObject(), Slic3r::SLAPrint::apply(), Slic3r::GUI::ObjectList::boolean(), construct_assemble_list(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::GUI::Plater::priv::delete_object_from_model(), Slic3r::GUI::PartPlate::duplicate_all_instance(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::Print::export_cached_data(), Slic3r::GUI::Plater::export_stl(), anonymous_namespace{EmbossJob.cpp}::CreateObjectJob::finalize(), get_export_filename(), Slic3r::PrintObject::get_first_layer_bbox(), Slic3r::get_instance_name(), Slic3r::MeshInspect::inspect_to_json(), Slic3r::PaintCLI::inspect_to_json(), load(), Slic3r::Print::load_cached_data(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_mesh_object(), make_boolean(), Slic3r::GUI::ObjectList::merge(), merge_or_add_object(), Slic3r::Step::mesh(), Slic3r::Cut::perform_by_contour(), Slic3r::Cut::perform_with_groove(), Slic3r::GUI::FillBedJob::prepare(), Slic3r::GUI::ArrangeJob::prepare_selected(), Slic3r::GUI::NotificationManager::push_slicing_warning_notification(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::Plater::priv::replace_volume_with_stl(), Slic3r::CLI::run(), save(), Slic3r::GUI::Plater::show_object_info(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), Slic3r::GUI::ObjectList::smooth_mesh(), split(), Slic3r::GUI::ObjectList::update_name_in_model(), Slic3r::PrintBase::update_object_placeholders(), Slic3r::GUI::ObjectDataViewModel::UpdateItemNames(), and Slic3r::Print::validate().

◆ origin_translation

◆ printable

bool Slic3r::ModelObject::printable { true }

◆ s_last_id

size_t Slic3r::ObjectBase::s_last_id = 0
staticprivateinherited

Referenced by generate_new_id().

◆ sla_drain_holes

◆ sla_points_status

◆ sla_support_points

◆ volume_ids

std::vector<ObjectID> Slic3r::ModelObject::volume_ids

Referenced by load().

◆ volumes

ModelVolumePtrs Slic3r::ModelObject::volumes

Referenced by Slic3r::GUI::GLGizmoCut3D::PartSelection::PartSelection(), Slic3r::GUI::GLGizmoCut3D::PartSelection::PartSelection(), Slic3r::GUI::anonymous_namespace{Plater.cpp}::SvgArchivePathsRestorer::SvgArchivePathsRestorer(), Slic3r::_BBS_3MF_Exporter::_add_cut_information_file_to_archive(), Slic3r::_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Importer::_extract_embossed_svg_shape_file(), Slic3r::_3MF_Importer::_load_model_from_file(), Slic3r::GUI::GLCanvas3D::_render_section_view_caps(), Slic3r::GUI::RaycastManager::actualize(), Slic3r::Model::add_object(), Slic3r::Model::add_object(), Slic3r::GUI::MenuFactory::append_menu_items_convert_unit(), Slic3r::Print::append_model_object_extruders(), Slic3r::GUI::ObjectList::apply_object_instance_transfrom_to_all_volumes(), Slic3r::GUI::Plater::priv::apply_textured_mesh_import_result(), Slic3r::Print::auto_assign_extruders(), Slic3r::GUI::calc_distance(), Slic3r::ModelInstance::calc_print_volume_state(), Slic3r::GUI::can_add_volumes_to_object(), Slic3r::check_model_ids_equal(), Slic3r::check_model_ids_validity(), Slic3r::GLVolumeCollection::check_outside_state(), Slic3r::GUI::PartPlate::check_single_extruder_mixed_filament_risk(), Slic3r::GUI::Plater::clear_before_change_mesh(), Slic3r::GUI::Plater::combine_mesh_fff(), Slic3r::SeamPlacerImpl::compute_global_occlusion(), construct_assemble_list(), convert_units(), convex_hull_2d(), Slic3r::GUI::Selection::copy_to_clipboard(), Slic3r::GUI::Emboss::create_volume_sources(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), delete_connectors(), Slic3r::GUI::ObjectList::delete_from_model_and_list(), Slic3r::distribute_modifiers_from_object(), Slic3r::GUI::GLCanvas3D::do_mirror(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::GUI::GLCanvas3D::do_rotate(), Slic3r::GUI::GLCanvas3D::do_scale(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::GUI::PartPlate::exclusion_volume_preview_cache_key(), Slic3r::Print::export_cached_data(), Slic3r::GUI::Plater::export_stl(), Slic3r::Cut::finalize(), Slic3r::fix_model_with_cgal_gui(), Slic3r::GUI::ObjectList::fix_through_cgal(), Slic3r::SeamPlacerImpl::gather_enforcers_blockers(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::GUI::get_extruder_id_for_volumes(), Slic3r::GUI::PartPlate::get_extruders(), Slic3r::GUI::PartPlate::get_extruders_under_cli(), Slic3r::GUI::PartPlate::get_extruders_without_support(), get_instance_max_z(), get_instance_min_z(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::GLGizmoAlignment::get_selected_part_volumes(), Slic3r::GUI::Selection::get_selected_single_volume(), Slic3r::GUI::get_selected_volume(), Slic3r::GUI::GLGizmoMeshBoolean::gizmo_event(), Slic3r::GUI::GLGizmoPainterBase::gizmo_event(), Slic3r::groupingVolumesForBrim(), has_solid_mesh(), Slic3r::GUI::GLGizmoMmuSegmentation::init_model_triangle_selectors(), Slic3r::GUI::GLGizmoMeasure::init_plane_glmodel(), Slic3r::PreciseSeam::init_precise_seam_data(), Slic3r::PaintCLI::inspect_to_json(), Slic3r::ModelInstance::intersects_bed_exclude_region(), is_multiparts(), Slic3r::GUI::GLGizmoFlatten::is_plane_update_necessary(), Slic3r::GUI::Selection::Clipboard::is_sla_compliant(), Slic3r::GUI::GLGizmoSVG::is_svg_object(), load(), Slic3r::load_amf_archive(), Slic3r::load_amf_file(), Slic3r::GUI::Tab::load_current_preset(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_modifier(), Slic3r::GLVolumeCollection::load_object(), Slic3r::GLVolumeCollection::load_object_volume(), Slic3r::load_svg(), main(), Slic3r::GUI::ObjectList::merge(), merge(), merge_or_add_object(), merge_volumes(), Slic3r::Step::mesh(), Slic3r::GUI::GLGizmoPainterBase::mesh_trafo_matrices(), Slic3r::model_has_advanced_features(), Slic3r::model_has_multi_part_objects(), Slic3r::model_property_changed(), Slic3r::csg::model_to_csgmesh(), Slic3r::model_volume_list_changed(), Slic3r::model_volume_list_copy_configs(), Slic3r::ModelVolume::model_volume_list_update_supports_and_seams, Slic3r::GUI::move_volume_to_end(), Slic3r::GUI::GLGizmoFdmSupports::need_regenerate_support_volumes(), Slic3r::GUI::ObjectList::object_config_options_changed(), Slic3r::PrintObject::object_extruders(), Slic3r::GUI::Plater::on_filament_count_change(), Slic3r::GUI::Plater::on_filaments_delete(), Slic3r::GUI::GLGizmoMeshBoolean::on_load(), Slic3r::GUI::GLCanvas3D::on_mouse(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::CommonGizmosDataObjects::InstancesHider::on_update(), Slic3r::GUI::CommonGizmosDataObjects::ObjectClipper::on_update(), Slic3r::GUI::CommonGizmosDataObjects::Raycaster::on_update(), Slic3r::GUI::ObjectGridTable::OnCellLeftClick(), Slic3r::GUI::ObjectList::OnDrop(), Slic3r::outer_inner_brim_area(), Slic3r::GUI::Selection::paste_volumes_from_clipboard(), Slic3r::Cut::perform_by_contour(), Slic3r::Cut::perform_with_groove(), Slic3r::Cut::perform_with_plane(), Slic3r::Cut::post_process(), anonymous_namespace{GLGizmoEmboss.cpp}::prepare_volumes_to_slice(), Slic3r::GUI::GLGizmoTextureDisplacement::preview_part(), Slic3r::Print::process(), Slic3r::GUI::CalibUtils::process_and_store_3mf(), Slic3r::process_solid_part_cut(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::project_used_filament_slots(), Slic3r::GUI::anonymous_namespace{Plater.cpp}::publish(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::ObjectGridTable::reload_cell_data(), Slic3r::GUI::Plater::priv::reload_from_disk(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::GLGizmoMmuSegmentation::remap_filament_assignments(), Slic3r::remap_model_filament_slots(), Slic3r::GUI::GLGizmoPainterBase::render_cursor_height_range(), Slic3r::GUI::CommonGizmosDataObjects::InstancesHider::render_cut(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::Plater::priv::replace_volume_with_stl(), Slic3r::CLI::run(), Slic3r::GUI::GLGizmoFdmSupports::run_thread(), save(), Slic3r::segmentation_by_painting(), Slic3r::segmentation_top_and_bottom_layers(), Slic3r::GUI::GLGizmoFdmSupports::select_facets_by_angle(), Slic3r::GUI::ObjectList::select_items(), Slic3r::GUI::GLGizmoTextureDisplacement::select_whole_model(), Slic3r::GUI::ObjectList::set_extruder_for_selected_items(), Slic3r::GUI::CalibUtils::set_for_auto_pa_model_and_config(), Slic3r::GUI::ObjectList::show_context_menu(), Slic3r::GUI::Plater::show_object_info(), Slic3r::GLVolume::simple_render(), Slic3r::GUI::ObjectList::smooth_mesh(), sort_volumes(), Slic3r::ModelVolume::split(), anonymous_namespace{SurfaceDrag.cpp}::start_dragging(), Slic3r::GUI::GLGizmoTextureDisplacement::swap_layer_slots(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_parts(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_volume(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_volume_raycaster_index(), Slic3r::GUI::GLGizmoFdmSupports::update_from_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_from_model_object(), Slic3r::GUI::GLGizmoSeam::update_from_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_from_model_object(), Slic3r::GUI::ObjectList::update_info_items(), Slic3r::GUI::GLGizmoFdmSupports::update_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_model_object(), Slic3r::GUI::GLGizmoMmuSegmentation::update_model_object(), Slic3r::GUI::GLGizmoSeam::update_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_model_object(), Slic3r::GUI::ObjectList::update_name_in_model(), Slic3r::GUI::GLGizmoFlatten::update_planes(), Slic3r::GUI::ObjectList::update_selections_on_canvas(), Slic3r::Print::update_shrinkage_compensation(), Slic3r::GUI::Selection::update_type(), and Slic3r::GUI::ObjectDataViewModel::UpdateItemNames().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Model.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Model.cpp