Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::PrintRegion Class Reference

#include <src/libslic3r/Print.hpp>

Public Member Functions

 PrintRegion ()=default
 
 PrintRegion (const PrintRegionConfig &config)
 
 PrintRegion (const PrintRegionConfig &config, const size_t config_hash, int print_object_region_id=-1)
 
 PrintRegion (PrintRegionConfig &&config)
 
 PrintRegion (PrintRegionConfig &&config, const size_t config_hash, int print_object_region_id=-1)
 
 ~PrintRegion ()=default
 
const PrintRegionConfigconfig () const throw ()
 
size_t config_hash () const throw ()
 
int print_region_id () const throw ()
 
int print_object_region_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 }
 

Friends

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

Detailed Description

Constructor & Destructor Documentation

◆ PrintRegion() [1/5]

Slic3r::PrintRegion::PrintRegion ( )
default

◆ PrintRegion() [2/5]

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

◆ PrintRegion() [3/5]

Slic3r::PrintRegion::PrintRegion ( const PrintRegionConfig config,
const size_t  config_hash,
int  print_object_region_id = -1 
)
inline
size_t m_config_hash
Definition Print.hpp:117
PrintRegionConfig m_config
Definition Print.hpp:116
size_t config_hash() const
Definition Print.hpp:88
int m_print_object_region_id
Definition Print.hpp:119
int print_object_region_id() const
Definition Print.hpp:91

◆ PrintRegion() [4/5]

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

◆ PrintRegion() [5/5]

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

◆ ~PrintRegion()

Slic3r::PrintRegion::~PrintRegion ( )
default

Member Function Documentation

◆ bridging_height_avg()

coordf_t Slic3r::PrintRegion::bridging_height_avg ( const PrintConfig &  print_config) const
60{
61 return this->nozzle_dmr_avg(print_config) * sqrt(m_config.bridge_flow_ratio.value);
62}
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition ArrayCwiseUnaryOps.h:152
coordf_t nozzle_dmr_avg(const PrintConfig &print_config) const
Definition PrintRegion.cpp:52

References m_config, nozzle_dmr_avg(), and sqrt().

+ 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
81{
82 // PrintRegion, if used by some PrintObject, shall have all the extruders set to an existing printer extruder.
83 // If not, then there must be something wrong with the Print::apply() function.
84#ifndef NDEBUG
85 auto num_extruders = int(print.config().nozzle_diameter.size());
86 assert(this->config().perimeter_extruder <= num_extruders);
87 assert(this->config().infill_extruder <= num_extruders);
88 assert(this->config().solid_infill_extruder <= num_extruders);
89#endif
90 collect_object_printing_extruders(print.config(), this->config(), print.has_brim(), object_extruders);
91}
void collect_object_printing_extruders(const Print &print, std::vector< unsigned int > &object_extruders) const
Definition PrintRegion.cpp:80
perimeter_extruder((ConfigOptionFloatOrPercent, perimeter_extrusion_width))((ConfigOptionFloat
solid_infill_extruder((ConfigOptionFloatOrPercent, solid_infill_extrusion_width))((ConfigOptionInt

References collect_object_printing_extruders(), config(), Slic3r::Print::config(), Slic3r::Print::has_brim(), Slic3r::perimeter_extruder(), and Slic3r::solid_infill_extruder().

Referenced by collect_object_printing_extruders().

+ 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
65{
66 // These checks reflect the same logic used in the GUI for enabling/disabling extruder selection fields.
67 auto num_extruders = (int)print_config.nozzle_diameter.size();
68 auto emplace_extruder = [num_extruders, &object_extruders](int extruder_id) {
69 int i = std::max(0, extruder_id - 1);
70 object_extruders.emplace_back((i >= num_extruders) ? 0 : i);
71 };
72 if (region_config.perimeters.value > 0 || has_brim)
73 emplace_extruder(region_config.perimeter_extruder);
74 if (region_config.fill_density.value > 0)
75 emplace_extruder(region_config.infill_extruder);
76 if (region_config.top_solid_layers.value > 0 || region_config.bottom_solid_layers.value > 0)
77 emplace_extruder(region_config.solid_infill_extruder);
78}

◆ config()

◆ config_apply_only()

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

References m_config, and m_config_hash.

◆ config_hash()

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

References m_config_hash.

Referenced by Slic3r::Print::apply(), and Slic3r::operator==().

+ Here is the caller graph for this function:

◆ extruder()

unsigned int Slic3r::PrintRegion::extruder ( FlowRole  role) const
8{
9 size_t extruder = 0;
10 if (role == frPerimeter || role == frExternalPerimeter)
11 extruder = m_config.perimeter_extruder;
12 else if (role == frInfill)
13 extruder = m_config.infill_extruder;
14 else if (role == frSolidInfill || role == frTopSolidInfill)
15 extruder = m_config.solid_infill_extruder;
16 else
17 throw Slic3r::InvalidArgument("Unknown role");
18 return extruder;
19}
unsigned int extruder(FlowRole role) const
Definition PrintRegion.cpp:7
@ frTopSolidInfill
Definition Flow.hpp:21
@ frExternalPerimeter
Definition Flow.hpp:17
@ frPerimeter
Definition Flow.hpp:18
@ frSolidInfill
Definition Flow.hpp:20
@ frInfill
Definition Flow.hpp:19

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

Referenced by Slic3r::LayerRegion::bridging_flow(), extruder(), 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
22{
23 const PrintConfig &print_config = object.print()->config();
24 ConfigOptionFloatOrPercent config_width;
25 // Get extrusion width from configuration.
26 // (might be an absolute value, or a percent value, or zero for auto)
27 if (first_layer && print_config.first_layer_extrusion_width.value > 0) {
28 config_width = print_config.first_layer_extrusion_width;
29 } else if (role == frExternalPerimeter) {
30 config_width = m_config.external_perimeter_extrusion_width;
31 } else if (role == frPerimeter) {
32 config_width = m_config.perimeter_extrusion_width;
33 } else if (role == frInfill) {
34 config_width = m_config.infill_extrusion_width;
35 } else if (role == frSolidInfill) {
36 config_width = m_config.solid_infill_extrusion_width;
37 } else if (role == frTopSolidInfill) {
38 config_width = m_config.top_infill_extrusion_width;
39 } else {
40 throw Slic3r::InvalidArgument("Unknown role");
41 }
42
43 if (config_width.value == 0)
44 config_width = object.config().extrusion_width;
45
46 // Get the configured nozzle_diameter for the extruder associated to the flow role requested.
47 // 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.
48 auto nozzle_diameter = float(print_config.nozzle_diameter.get_at(this->extruder(role) - 1));
49 return Flow::new_from_config_width(role, config_width, nozzle_diameter, float(layer_height));
50}
static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height)
Definition Flow.cpp:115
layer_height((ConfigOptionInt, faded_layers))((ConfigOptionFloat

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

Referenced by Slic3r::FFFSupport::SupportParameters::SupportParameters(), Slic3r::FFFTreeSupport::TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(), Slic3r::GCode::_do_export(), Slic3r::LayerRegion::flow(), and Slic3r::group_fills().

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

◆ nozzle_dmr_avg()

coordf_t Slic3r::PrintRegion::nozzle_dmr_avg ( const PrintConfig &  print_config) const
53{
54 return (print_config.nozzle_diameter.get_at(m_config.perimeter_extruder.value - 1) +
55 print_config.nozzle_diameter.get_at(m_config.infill_extruder.value - 1) +
56 print_config.nozzle_diameter.get_at(m_config.solid_infill_extruder.value - 1)) / 3.;
57}

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

References m_print_object_region_id.

Referenced by Slic3r::slices_to_regions().

+ Here is the caller graph for this function:

◆ print_region_id()

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

References m_print_region_id.

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

+ Here is the caller graph for this function:

◆ set_config() [1/2]

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

References config(), m_config, and m_config_hash.

+ Here is the call graph for this function:

◆ set_config() [2/2]

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

References config(), m_config, and m_config_hash.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ print_region_ref_cnt

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

◆ print_region_ref_inc

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

◆ print_region_ref_reset

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

Member Data Documentation

◆ m_config

◆ m_config_hash

size_t Slic3r::PrintRegion::m_config_hash
private

◆ m_print_object_region_id

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

Referenced by print_object_region_id().

◆ m_print_region_id

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

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: