OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::PrintRegion Class Reference

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

Collaboration diagram for Slic3r::PrintRegion:

Public Member Functions

 PrintRegion ()=default
 PrintRegion (const PrintRegionConfig &config)
 PrintRegion (const PrintRegionConfig &config, const size_t config_hash, int print_object_region_id=-1, ObjectID gradient_volume_id=ObjectID())
 PrintRegion (PrintRegionConfig &&config)
 PrintRegion (PrintRegionConfig &&config, const size_t config_hash, int print_object_region_id=-1, ObjectID gradient_volume_id=ObjectID())
 ~PrintRegion ()=default
const PrintRegionConfig & config () const throw ()
size_t config_hash () const throw ()
int print_region_id () const throw ()
int print_object_region_id () const throw ()
ObjectID gradient_volume_id () const throw ()
unsigned int extruder (FlowRole role) const
Flow flow (const PrintObject &object, FlowRole role, double layer_height, bool first_layer=false) const
coordf_t nozzle_dmr_avg (const PrintConfig &print_config) const
coordf_t bridging_height_avg (const PrintConfig &print_config) const
void collect_object_printing_extruders (const Print &print, std::vector< unsigned int > &object_extruders) const
void set_config (const PrintRegionConfig &config)
void set_config (PrintRegionConfig &&config)
void config_apply_only (const ConfigBase &other, const t_config_option_keys &keys, bool ignore_nonexistent=false)

Static Public Member Functions

static void collect_object_printing_extruders (const PrintConfig &print_config, const PrintRegionConfig &region_config, const bool has_brim, std::vector< unsigned int > &object_extruders)

Private Attributes

friend Print
PrintRegionConfig m_config
size_t m_config_hash
int m_print_region_id { -1 }
int m_print_object_region_id { -1 }
int m_ref_cnt { 0 }
ObjectID m_gradient_volume_id

Friends

void print_region_ref_inc (PrintRegion &r)
void print_region_ref_reset (PrintRegion &r)
int print_region_ref_cnt (const PrintRegion &r)

Detailed Description

Constructor & Destructor Documentation

◆ PrintRegion() [1/5]

Slic3r::PrintRegion::PrintRegion ( )
default

References config(), and Slic3r::PrintRegionConfig.

Referenced by PrintRegion(), PrintRegion(), print_region_ref_cnt, print_region_ref_inc, and print_region_ref_reset.

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

◆ PrintRegion() [2/5]

Slic3r::PrintRegion::PrintRegion ( const PrintRegionConfig & config)
129: PrintRegion(config, config.hash()) {}
const PrintRegionConfig & config() const
Definition Print.hpp:154

References PrintRegion(), config(), and Slic3r::PrintRegionConfig.

Here is the call graph for this function:

◆ PrintRegion() [3/5]

Slic3r::PrintRegion::PrintRegion ( const PrintRegionConfig & config,
const size_t config_hash,
int print_object_region_id = -1,
ObjectID gradient_volume_id = ObjectID() )
inline
size_t m_config_hash
Definition Print.hpp:188
PrintRegionConfig m_config
Definition Print.hpp:187
size_t config_hash() const
Definition Print.hpp:155
int m_print_object_region_id
Definition Print.hpp:190
ObjectID gradient_volume_id() const
Definition Print.hpp:162
int print_object_region_id() const
Definition Print.hpp:158
ObjectID m_gradient_volume_id
Definition Print.hpp:195

References config(), config_hash(), gradient_volume_id(), m_config, m_config_hash, m_gradient_volume_id, m_print_object_region_id, print_object_region_id(), and Slic3r::PrintRegionConfig.

Here is the call graph for this function:

◆ PrintRegion() [4/5]

Slic3r::PrintRegion::PrintRegion ( PrintRegionConfig && config)
130: PrintRegion(std::move(config), config.hash()) {}

References PrintRegion(), config(), and Slic3r::PrintRegionConfig.

Here is the call graph for this function:

◆ PrintRegion() [5/5]

Slic3r::PrintRegion::PrintRegion ( PrintRegionConfig && config,
const size_t config_hash,
int print_object_region_id = -1,
ObjectID gradient_volume_id = ObjectID() )
inline

References config(), config_hash(), gradient_volume_id(), m_config, m_config_hash, m_gradient_volume_id, m_print_object_region_id, print_object_region_id(), and Slic3r::PrintRegionConfig.

Here is the call graph for this function:

◆ ~PrintRegion()

Slic3r::PrintRegion::~PrintRegion ( )
default

Member Function Documentation

◆ bridging_height_avg()

coordf_t Slic3r::PrintRegion::bridging_height_avg ( const PrintConfig & print_config) const
75{
76 return this->nozzle_dmr_avg(print_config) * sqrt(m_config.bridge_flow.value);
77}
coordf_t nozzle_dmr_avg(const PrintConfig &print_config) const
Definition PrintRegion.cpp:64

References m_config, and nozzle_dmr_avg().

Here is the call graph for this function:

◆ collect_object_printing_extruders() [1/2]

void Slic3r::PrintRegion::collect_object_printing_extruders ( const Print & print,
std::vector< unsigned int > & object_extruders ) const
104{
105 // PrintRegion, if used by some PrintObject, shall have all the extruders set to an existing printer extruder.
106 // If not, then there must be something wrong with the Print::apply() function.
107#ifndef NDEBUG
108 // BBS
109 auto num_extruders = int(print.config().filament_diameter.size());
110 assert(this->config().outer_wall_filament_id <= num_extruders);
111 assert(this->config().inner_wall_filament_id <= num_extruders);
112 assert(this->config().sparse_infill_filament_id <= num_extruders);
113 assert(this->config().internal_solid_filament_id <= num_extruders);
114 assert(this->config().top_surface_filament_id <= num_extruders);
115 assert(this->config().bottom_surface_filament_id <= num_extruders);
116#endif
117 collect_object_printing_extruders(print.config(), this->config(), print.has_brim(), object_extruders);
118}
void collect_object_printing_extruders(const Print &print, std::vector< unsigned int > &object_extruders) const
Definition PrintRegion.cpp:103
bottom_surface_filament_id((ConfigOptionFloatOrPercent, internal_solid_infill_line_width))((ConfigOptionFloatsNullable
sparse_infill_filament_id((ConfigOptionFloatOrPercent, sparse_infill_line_width))((ConfigOptionPercent
inner_wall_filament_id((ConfigOptionFloatOrPercent, inner_wall_line_width))((ConfigOptionFloatsNullable
internal_solid_filament_id((ConfigOptionInt, top_surface_filament_id))((ConfigOptionInt

References Slic3r::bottom_surface_filament_id(), collect_object_printing_extruders(), Slic3r::Print::config(), config(), Slic3r::Print::has_brim(), Slic3r::inner_wall_filament_id(), Slic3r::internal_solid_filament_id(), Print, and Slic3r::sparse_infill_filament_id().

Referenced by collect_object_printing_extruders(), and Slic3r::PrintObject::slicing_parameters().

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

◆ collect_object_printing_extruders() [2/2]

void Slic3r::PrintRegion::collect_object_printing_extruders ( const PrintConfig & print_config,
const PrintRegionConfig & region_config,
const bool has_brim,
std::vector< unsigned int > & object_extruders )
static
80{
81 // These checks reflect the same logic used in the GUI for enabling/disabling extruder selection fields.
82 // BBS
83 auto num_extruders = (int)print_config.filament_diameter.size();
84 auto emplace_extruder = [num_extruders, &object_extruders](int extruder_id) {
85 int i = std::max(0, extruder_id - 1);
86 object_extruders.emplace_back((i >= num_extruders) ? 0 : i);
87 };
88 if (region_config.wall_loops.value > 0 || has_brim) {
89 emplace_extruder(region_config.outer_wall_filament_id);
90 if (region_config.wall_loops.value > 1)
91 emplace_extruder(region_config.inner_wall_filament_id);
92 }
93 if (region_config.sparse_infill_density.value > 0)
94 emplace_extruder(region_config.sparse_infill_filament_id);
95 if (region_config.sparse_infill_density.value > 0 || region_config.top_shell_layers.value > 0 || region_config.bottom_shell_layers.value > 0)
96 emplace_extruder(region_config.internal_solid_filament_id);
97 if (region_config.top_shell_layers.value > 0)
98 emplace_extruder(region_config.top_surface_filament_id);
99 if (region_config.bottom_shell_layers.value > 0)
100 emplace_extruder(region_config.bottom_surface_filament_id);
101}

References Slic3r::PrintRegionConfig.

◆ config()

const PrintRegionConfig & Slic3r::PrintRegion::config ( ) const
throw ( )
inline
154{ return m_config; }

References m_config, and Slic3r::PrintRegionConfig.

Referenced by PrintRegion(), PrintRegion(), PrintRegion(), PrintRegion(), PrintRegion(), Slic3r::SupportParameters::SupportParameters(), Slic3r::FillAdaptive::adaptive_fill_line_spacing(), Slic3r::PrintObject::clip_fill_surfaces(), Slic3r::ToolOrdering::collect_extruders(), collect_object_printing_extruders(), Slic3r::PrintObject::combine_infill(), Slic3r::GCode::compute_farthest_point(), Slic3r::compute_slice_z(), Slic3r::contour_extrusion_path(), Slic3r::PrintObject::discover_horizontal_shells(), Slic3r::PrintObject::discover_vertical_shells(), Slic3r::GCode::extrude_infill(), Slic3r::GCode::extrude_perimeters(), Slic3r::LayerTools::extruder(), Slic3r::Layer::generate_sparse_infill_polylines_for_anchoring(), Slic3r::group_fills(), Slic3r::LayerTools::internal_solid_filament_id(), Slic3r::Layer::is_perimeter_compatible(), Slic3r::Layer::make_fills(), Slic3r::Layer::make_perimeters(), Slic3r::LayerRegion::make_perimeters(), Slic3r::operator==(), Slic3r::precompute_overhang_layers(), Slic3r::LayerRegion::process_external_surfaces(), Slic3r::GCode::process_layer(), Slic3r::SupportMaterialInternal::remove_bridges_from_contacts(), Slic3r::segmentation_top_and_bottom_layers(), set_config(), set_config(), Slic3r::LayerTools::sparse_infill_filament_id(), Slic3r::verify_update_print_object_regions(), and Slic3r::LayerTools::wall_extruder_id().

Here is the caller graph for this function:

◆ config_apply_only()

void Slic3r::PrintRegion::config_apply_only ( const ConfigBase & other,
const t_config_option_keys & keys,
bool ignore_nonexistent = false )
inline
180 { m_config.apply_only(other, keys, ignore_nonexistent); m_config_hash = m_config.hash(); }

References m_config, and m_config_hash.

Referenced by Slic3r::verify_update_print_object_regions().

Here is the caller graph for this function:

◆ config_hash()

size_t Slic3r::PrintRegion::config_hash ( ) const
throw ( )
inline
155{ return m_config_hash; }

References m_config_hash.

Referenced by PrintRegion(), PrintRegion(), Slic3r::Print::load_cached_data(), Slic3r::operator==(), and Slic3r::to_json().

Here is the caller graph for this function:

◆ extruder()

unsigned int Slic3r::PrintRegion::extruder ( FlowRole role) const
16{
17 size_t extruder = 0;
18 if (role == frPerimeter)
19 extruder = m_config.inner_wall_filament_id;
20 else if (role == frExternalPerimeter)
21 extruder = m_config.outer_wall_filament_id;
22 else if (role == frInfill)
23 extruder = m_config.sparse_infill_filament_id;
24 else if (role == frSolidInfill)
25 extruder = m_config.internal_solid_filament_id;
26 else if (role == frTopSolidInfill)
27 extruder = m_config.top_surface_filament_id;
28 else
29 throw Slic3r::InvalidArgument("Unknown role");
30 return extruder;
31}
unsigned int extruder(FlowRole role) const
Definition PrintRegion.cpp:15
@ frTopSolidInfill
Definition Flow.hpp:23
@ frExternalPerimeter
Definition Flow.hpp:19
@ frPerimeter
Definition Flow.hpp:20
@ frSolidInfill
Definition Flow.hpp:22
@ frInfill
Definition Flow.hpp:21

References extruder(), Slic3r::frExternalPerimeter, Slic3r::frInfill, Slic3r::frPerimeter, Slic3r::frSolidInfill, Slic3r::frTopSolidInfill, and m_config.

Referenced by extruder(), flow(), Slic3r::InterlockingGenerator::generate_interlocking_structure(), and Slic3r::group_fills().

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

◆ flow()

Flow Slic3r::PrintRegion::flow ( const PrintObject & object,
FlowRole role,
double layer_height,
bool first_layer = false ) const
34{
35 const PrintConfig &print_config = object.print()->config();
36 ConfigOptionFloatOrPercent config_width;
37 // Get extrusion width from configuration.
38 // (might be an absolute value, or a percent value, or zero for auto)
39 if (first_layer && print_config.initial_layer_line_width.value > 0) {
40 config_width = print_config.initial_layer_line_width;
41 } else if (role == frExternalPerimeter) {
42 config_width = m_config.outer_wall_line_width;
43 } else if (role == frPerimeter) {
44 config_width = m_config.inner_wall_line_width;
45 } else if (role == frInfill) {
46 config_width = m_config.sparse_infill_line_width;
47 } else if (role == frSolidInfill) {
48 config_width = m_config.internal_solid_infill_line_width;
49 } else if (role == frTopSolidInfill) {
50 config_width = m_config.top_surface_line_width;
51 } else {
52 throw Slic3r::InvalidArgument("Unknown role");
53 }
54
55 if (config_width.value == 0)
56 config_width = object.config().line_width;
57
58 // Get the configured nozzle_diameter for the extruder associated to the flow role requested.
59 // Here this->extruder(role) - 1 may underflow to MAX_INT, but then the get_at() will follback to zero'th element, so everything is all right.
60 auto nozzle_diameter = float(nozzle_diameter_for_filament(print_config, this->extruder(role), object.print()->is_BBL_printer()));
61 return Flow::new_from_config_width(role, config_width, nozzle_diameter, float(layer_height));
62}
static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height)
Definition Flow.cpp:136
zaa_minimize_perimeter_height nozzle_diameter((ConfigOptionBool, reduce_infill_retraction))((ConfigOptionBool
layer_height((ConfigOptionInt, faded_layers))((ConfigOptionFloat
double nozzle_diameter_for_filament(const PrintConfig &config, int filament_id, bool is_bbl_printer)
Definition PrintConfig.cpp:148

References extruder(), Slic3r::frExternalPerimeter, Slic3r::frInfill, Slic3r::frPerimeter, Slic3r::frSolidInfill, Slic3r::frTopSolidInfill, Slic3r::layer_height(), m_config, Slic3r::Flow::new_from_config_width(), Slic3r::nozzle_diameter(), Slic3r::nozzle_diameter_for_filament(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::SupportParameters::SupportParameters(), Slic3r::TreeSupport3D::TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(), Slic3r::GCode::_do_export(), Slic3r::fuzzy_skin_segmentation_by_painting(), and Slic3r::group_fills().

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

◆ gradient_volume_id()

ObjectID Slic3r::PrintRegion::gradient_volume_id ( ) const
throw ( )
inline
162{ return m_gradient_volume_id; }

References m_gradient_volume_id.

Referenced by PrintRegion(), PrintRegion(), Slic3r::ToolOrdering::collect_extruders(), and Slic3r::Layer::make_perimeters().

Here is the caller graph for this function:

◆ nozzle_dmr_avg()

coordf_t Slic3r::PrintRegion::nozzle_dmr_avg ( const PrintConfig & print_config) const
65{
66 return (print_config.nozzle_diameter.get_at(m_config.outer_wall_filament_id.value - 1) +
67 print_config.nozzle_diameter.get_at(m_config.inner_wall_filament_id.value - 1) +
68 print_config.nozzle_diameter.get_at(m_config.sparse_infill_filament_id.value - 1) +
69 print_config.nozzle_diameter.get_at(m_config.internal_solid_filament_id.value - 1) +
70 print_config.nozzle_diameter.get_at(m_config.top_surface_filament_id.value - 1) +
71 print_config.nozzle_diameter.get_at(m_config.bottom_surface_filament_id.value - 1)) / 6.;
72}

References m_config.

Referenced by bridging_height_avg().

Here is the caller graph for this function:

◆ print_object_region_id()

int Slic3r::PrintRegion::print_object_region_id ( ) const
throw ( )
inline
158{ return m_print_object_region_id; }

References m_print_object_region_id.

Referenced by PrintRegion(), PrintRegion(), Slic3r::LayerRegion::make_perimeters(), and Slic3r::slices_to_regions().

Here is the caller graph for this function:

◆ print_region_id()

int Slic3r::PrintRegion::print_region_id ( ) const
throw ( )
inline
157{ return m_print_region_id; }
int m_print_region_id
Definition Print.hpp:189

References m_print_region_id.

Referenced by Slic3r::GCode::process_layer().

Here is the caller graph for this function:

◆ set_config() [1/2]

void Slic3r::PrintRegion::set_config ( const PrintRegionConfig & config)
inline
177{ m_config = config; m_config_hash = m_config.hash(); }

References config(), m_config, m_config_hash, and Slic3r::PrintRegionConfig.

Here is the call graph for this function:

◆ set_config() [2/2]

void Slic3r::PrintRegion::set_config ( PrintRegionConfig && config)
inline
178{ m_config = std::move(config); m_config_hash = m_config.hash(); }

References config(), m_config, m_config_hash, and Slic3r::PrintRegionConfig.

Here is the call graph for this function:

◆ print_region_ref_cnt

int print_region_ref_cnt ( const PrintRegion & r)
friend
809{ return r.m_ref_cnt; }

References PrintRegion(), m_ref_cnt, and print_region_ref_cnt.

Referenced by print_region_ref_cnt.

◆ print_region_ref_inc

void print_region_ref_inc ( PrintRegion & r)
friend
807{ ++ r.m_ref_cnt; }

References PrintRegion(), m_ref_cnt, and print_region_ref_inc.

Referenced by print_region_ref_inc.

◆ print_region_ref_reset

void print_region_ref_reset ( PrintRegion & r)
friend
808{ r.m_ref_cnt = 0; }

References PrintRegion(), m_ref_cnt, and print_region_ref_reset.

Referenced by print_region_ref_reset.

Member Data Documentation

◆ m_config

◆ m_config_hash

size_t Slic3r::PrintRegion::m_config_hash
private

◆ m_gradient_volume_id

ObjectID Slic3r::PrintRegion::m_gradient_volume_id
private

◆ m_print_object_region_id

int Slic3r::PrintRegion::m_print_object_region_id { -1 }
private
190{ -1 };

Referenced by PrintRegion(), PrintRegion(), and print_object_region_id().

◆ m_print_region_id

int Slic3r::PrintRegion::m_print_region_id { -1 }
private
189{ -1 };

Referenced by print_region_id().

◆ m_ref_cnt

int Slic3r::PrintRegion::m_ref_cnt { 0 }
private

◆ Print

friend Slic3r::PrintRegion::Print
private

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