OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::SlicingParameters Struct Reference

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

Public Member Functions

 SlicingParameters ()=default
bool has_raft () const
size_t raft_layers () const
bool first_object_layer_height_fixed () const
coordf_t object_print_z_height () const
coordf_t object_print_z_uncompensated_height () const

Static Public Member Functions

static SlicingParameters create_from_config (const PrintConfig &print_config, const PrintObjectConfig &object_config, coordf_t object_height, const std::vector< unsigned int > &object_extruders, const Vec3d &object_shrinkage_compensation)

Public Attributes

bool valid { false }
size_t base_raft_layers { 0 }
size_t interface_raft_layers { 0 }
coordf_t base_raft_layer_height { 0 }
coordf_t interface_raft_layer_height { 0 }
coordf_t contact_raft_layer_height { 0 }
coordf_t layer_height { 0 }
coordf_t min_layer_height { 0 }
coordf_t max_layer_height { 0 }
coordf_t max_suport_layer_height { 0 }
coordf_t first_print_layer_height { 0 }
coordf_t first_object_layer_height { 0 }
bool first_object_layer_bridging { false }
bool zero_gap_interface_top { false }
bool zero_gap_interface_bottom { false }
bool zero_gap_interface_raft { false }
coordf_t gap_raft_object { 0 }
coordf_t gap_object_support { 0 }
coordf_t gap_support_object { 0 }
coordf_t raft_base_top_z { 0 }
coordf_t raft_interface_top_z { 0 }
coordf_t raft_contact_top_z { 0 }
coordf_t object_print_z_min { 0 }
coordf_t object_print_z_max { 0 }
coordf_t object_print_z_uncompensated_max { 0 }
coordf_t object_shrinkage_compensation_z { 0 }
double belt_floor_shear_factor { 0.0 }
int belt_floor_from_axis { 1 }
double belt_floor_z_shift { 0.0 }

Detailed Description

Constructor & Destructor Documentation

◆ SlicingParameters()

Slic3r::SlicingParameters::SlicingParameters ( )
default

References SlicingParameters(), and Slic3r::PrintObjectConfig.

Referenced by SlicingParameters(), and create_from_config().

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

Member Function Documentation

◆ create_from_config()

SlicingParameters Slic3r::SlicingParameters::create_from_config ( const PrintConfig & print_config,
const PrintObjectConfig & object_config,
coordf_t object_height,
const std::vector< unsigned int > & object_extruders,
const Vec3d & object_shrinkage_compensation )
static
77{
78 coordf_t initial_layer_print_height = (print_config.initial_layer_print_height.value <= 0) ?
79 object_config.layer_height.value : print_config.initial_layer_print_height.value;
80
81 // If object_config.support_filament == 0 resp. object_config.support_interface_filament == 0,
82 // print_config.nozzle_diameter.get_at(size_t(-1)) returns the 0th nozzle diameter,
83 // which is consistent with the requirement that if support_filament == 0 resp. support_interface_filament == 0,
84 // support will not trigger tool change, but it will use the current nozzle instead.
85 // In that case all the nozzles have to be of the same diameter.
86 coordf_t support_material_extruder_dmr = print_config.nozzle_diameter.get_at(object_config.support_filament.value - 1);
87 coordf_t support_material_interface_extruder_dmr = print_config.nozzle_diameter.get_at(object_config.support_interface_filament.value - 1);
88
89 // ORCA: store Z distance
90 const coordf_t support_top_z_gap = object_config.support_top_z_distance.value;
91 const coordf_t support_bottom_z_gap = object_config.support_bottom_z_distance.value;
92 const coordf_t raft_z_gap = object_config.raft_contact_distance.value;
93
94
95 /* -------------------------------------------------- */
96 /* ORCA: Zero-gap interface detection (asymmetric) */
97 /* -------------------------------------------------- */
98
99 const bool zero_topZ_contact =
100 support_top_z_gap == 0.0;
101
102 const bool zero_gap_interface_top =
103 object_config.support_interface_top_layers.value > 0 && // Has some top interface layers
104 zero_topZ_contact;
105
106 const bool zero_gap_interface_bottom =
107 (object_config.support_interface_bottom_layers.value < 0 // Negative value means "use same as top"
108 ? object_config.support_interface_top_layers.value
109 : object_config.support_interface_bottom_layers.value) > 0 && // Has some bottom interface layers
110 (support_bottom_z_gap == 0.0 || zero_topZ_contact);
111
112 const bool zero_gap_interface_raft =
113 raft_z_gap == 0.0 || zero_topZ_contact;
114
115 SlicingParameters params;
116
117 params.layer_height = object_config.layer_height.value;
118 params.first_print_layer_height = initial_layer_print_height;
119 params.first_object_layer_height = initial_layer_print_height;
120 params.object_print_z_min = 0.0;
121 // Orca: XYZ filament compensation
122 params.object_print_z_max = object_height * object_shrinkage_compensation.z();
123 params.object_print_z_uncompensated_max = object_height;
124 params.object_shrinkage_compensation_z = object_shrinkage_compensation.z();
125 params.base_raft_layers = object_config.raft_layers.value;
126 params.zero_gap_interface_top = zero_gap_interface_top;
127 params.zero_gap_interface_bottom = zero_gap_interface_bottom;
128 params.zero_gap_interface_raft = zero_gap_interface_raft;
129
130 // Miniumum/maximum of the minimum layer height over all extruders.
131 params.min_layer_height = MIN_LAYER_HEIGHT;
132 params.max_layer_height = std::numeric_limits<double>::max();
133 if (object_config.enable_support.value || params.base_raft_layers > 0 || object_config.enforce_support_layers > 0) {
134 // Has some form of support. Add the support layers to the minimum / maximum layer height limits.
135 params.min_layer_height = std::max(
136 min_layer_height_from_nozzle(print_config, object_config.support_filament),
137 min_layer_height_from_nozzle(print_config, object_config.support_interface_filament));
138 params.max_layer_height = std::min(
139 max_layer_height_from_nozzle(print_config, object_config.support_filament),
140 max_layer_height_from_nozzle(print_config, object_config.support_interface_filament));
141 params.max_suport_layer_height = params.max_layer_height;
142 }
143
144 if (object_extruders.empty()) {
145 params.min_layer_height = std::max(params.min_layer_height, min_layer_height_from_nozzle(print_config, 0));
146 params.max_layer_height = std::min(params.max_layer_height, max_layer_height_from_nozzle(print_config, 0));
147 } else {
148 for (unsigned int extruder_id : object_extruders) {
149 params.min_layer_height = std::max(params.min_layer_height, min_layer_height_from_nozzle(print_config, extruder_id));
150 params.max_layer_height = std::min(params.max_layer_height, max_layer_height_from_nozzle(print_config, extruder_id));
151 }
152 }
153
154 params.min_layer_height = std::min(params.min_layer_height, params.layer_height);
155 params.max_layer_height = std::max(params.max_layer_height, params.layer_height);
156
157 /* -------------------------------------------------- */
158 /* ORCA: Gap assignment */
159 /* -------------------------------------------------- */
160
161 // ORCA: Raft contact (raft -> object)
163 params.gap_raft_object = 0.0;
164 } else {
165 params.gap_raft_object = raft_z_gap;
166 if (!print_config.independent_support_layer_height) {
167 params.gap_raft_object =
168 std::round(params.gap_raft_object / object_config.layer_height + EPSILON)
169 * object_config.layer_height;
170 }
171 }
172
173 // ORCA: BOTTOM contact (object -> support)
175 params.gap_object_support = 0.0;
176 } else {
177 params.gap_object_support = support_bottom_z_gap;
178
179 if (!print_config.independent_support_layer_height) {
180 params.gap_object_support =
181 std::round(params.gap_object_support / object_config.layer_height + EPSILON)
182 * object_config.layer_height;
183 }
184 }
185
186 // ORCA: TOP contact (support -> object)
188 params.gap_support_object = 0.0;
189 } else {
190 params.gap_support_object = support_top_z_gap;
191
192 if (!print_config.independent_support_layer_height) {
193 params.gap_support_object =
194 std::round(params.gap_support_object / object_config.layer_height + EPSILON)
195 * object_config.layer_height;
196 }
197 }
198
199 /* -------------------------------------------------- */
200 /* Raft logic */
201 /* -------------------------------------------------- */
202
203 if (params.base_raft_layers > 0) {
204 params.interface_raft_layers = (params.base_raft_layers + 1) / 2;
205 params.base_raft_layers -= params.interface_raft_layers;
206 // Use as large as possible layer height for the intermediate raft layers.
207 params.base_raft_layer_height = std::max(params.layer_height, 0.75 * support_material_extruder_dmr);
208 params.interface_raft_layer_height = std::max(params.layer_height, 0.75 * support_material_interface_extruder_dmr);
209 params.first_object_layer_bridging = false;
210 params.contact_raft_layer_height = std::max(params.layer_height, 0.75 * support_material_interface_extruder_dmr);
211 params.first_object_layer_height = params.layer_height;
212 }
213
214 if (params.has_raft()) {
215 // Raise first object layer Z by the thickness of the raft itself plus the extra distance required by the support material logic.
216 //FIXME The last raft layer is the contact layer, which shall be printed with a bridging flow for ease of separation. Currently it is not the case.
217 if (params.raft_layers() == 1) {
218 // There is only the contact layer.
219 params.contact_raft_layer_height = initial_layer_print_height;
220 params.raft_contact_top_z = initial_layer_print_height;
221 } else {
222 assert(params.base_raft_layers > 0);
223 assert(params.interface_raft_layers > 0);
224 // Number of the base raft layers is decreased by the first layer.
225 params.raft_base_top_z = initial_layer_print_height + coordf_t(params.base_raft_layers - 1) * params.base_raft_layer_height;
226 // Number of the interface raft layers is decreased by the contact layer.
227 params.raft_interface_top_z = params.raft_base_top_z + coordf_t(params.interface_raft_layers - 1) * params.interface_raft_layer_height;
228 params.raft_contact_top_z = params.raft_interface_top_z + params.contact_raft_layer_height;
229 }
230
231 coordf_t print_z = params.raft_contact_top_z + params.gap_raft_object;
232 params.object_print_z_min = print_z;
233 params.object_print_z_max += print_z;
234 params.object_print_z_uncompensated_max += print_z;
235 }
236
237 params.valid = true;
238 return params;
239}
#define EPSILON
Definition ColorUtils.cpp:64
double coordf_t
Definition GUI_ObjectList.hpp:46
coordf_t max_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)
Definition Slicing.cpp:46
zaa_minimize_perimeter_height initial_layer_print_height((ConfigOptionFloatsNullable, initial_layer_speed))((ConfigOptionFloatsNullable
coordf_t min_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)
Definition Slicing.cpp:38
static const coordf_t MIN_LAYER_HEIGHT
Definition Slicing.cpp:33
bool zero_gap_interface_top
Definition Slicing.hpp:90
bool zero_gap_interface_raft
Definition Slicing.hpp:92
bool zero_gap_interface_bottom
Definition Slicing.hpp:91

References SlicingParameters(), base_raft_layer_height, base_raft_layers, contact_raft_layer_height, EPSILON, first_object_layer_bridging, first_object_layer_height, first_print_layer_height, gap_object_support, gap_raft_object, gap_support_object, has_raft(), Slic3r::initial_layer_print_height(), interface_raft_layer_height, interface_raft_layers, layer_height, max_layer_height, Slic3r::max_layer_height_from_nozzle(), max_suport_layer_height, Slic3r::MIN_LAYER_HEIGHT, min_layer_height, Slic3r::min_layer_height_from_nozzle(), object_print_z_max, object_print_z_min, object_print_z_uncompensated_max, object_shrinkage_compensation_z, Slic3r::PrintObjectConfig, raft_base_top_z, raft_contact_top_z, raft_interface_top_z, raft_layers(), valid, zero_gap_interface_bottom, zero_gap_interface_raft, and zero_gap_interface_top.

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

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

◆ first_object_layer_height_fixed()

bool Slic3r::SlicingParameters::first_object_layer_height_fixed ( ) const
inline
bool has_raft() const
Definition Slicing.hpp:43
bool first_object_layer_bridging
Definition Slicing.hpp:87

References first_object_layer_bridging, and has_raft().

Referenced by Slic3r::adjust_layer_height_profile(), Slic3r::generate_object_layers(), Slic3r::layer_height_profile_adaptive(), Slic3r::layer_height_profile_from_ranges(), and Slic3r::smooth_height_profile().

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

◆ has_raft()

bool Slic3r::SlicingParameters::has_raft ( ) const
inline
43{ return raft_layers() > 0; }
size_t raft_layers() const
Definition Slicing.hpp:44

References raft_layers().

Referenced by create_from_config(), first_object_layer_height_fixed(), and Slic3r::new_contact_layer().

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

◆ object_print_z_height()

coordf_t Slic3r::SlicingParameters::object_print_z_height ( ) const
inline
coordf_t object_print_z_max
Definition Slicing.hpp:109
coordf_t object_print_z_min
Definition Slicing.hpp:107

References object_print_z_max, and object_print_z_min.

Referenced by Slic3r::adjust_layer_series_to_align_object_height(), Slic3r::generate_layer_height_texture(), Slic3r::generate_object_layers(), and Slic3r::layer_height_profile_from_ranges().

Here is the caller graph for this function:

◆ object_print_z_uncompensated_height()

coordf_t Slic3r::SlicingParameters::object_print_z_uncompensated_height ( ) const
inline
coordf_t object_print_z_uncompensated_max
Definition Slicing.hpp:113

References object_print_z_min, and object_print_z_uncompensated_max.

Referenced by Slic3r::adjust_layer_height_profile(), Slic3r::layer_height_profile_adaptive(), and Slic3r::layer_height_profile_from_ranges().

Here is the caller graph for this function:

◆ raft_layers()

Member Data Documentation

◆ base_raft_layer_height

◆ base_raft_layers

◆ belt_floor_from_axis

int Slic3r::SlicingParameters::belt_floor_from_axis { 1 }
121{ 1 }; // which axis the shear is from (0=X, 1=Y)

Referenced by Slic3r::GCode::belt_height_above_floor(), Slic3r::BeltFloorContext::init(), and Slic3r::PrintObject::slicing_parameters().

◆ belt_floor_shear_factor

double Slic3r::SlicingParameters::belt_floor_shear_factor { 0.0 }

◆ belt_floor_z_shift

double Slic3r::SlicingParameters::belt_floor_z_shift { 0.0 }
122{ 0.0 }; // bb_min_z + max(0, -min_z_after_shear)

Referenced by Slic3r::GCode::belt_height_above_floor(), Slic3r::BeltFloorContext::init(), and Slic3r::PrintObject::slicing_parameters().

◆ contact_raft_layer_height

coordf_t Slic3r::SlicingParameters::contact_raft_layer_height { 0 }

◆ first_object_layer_bridging

bool Slic3r::SlicingParameters::first_object_layer_bridging { false }

◆ first_object_layer_height

◆ first_print_layer_height

◆ gap_object_support

◆ gap_raft_object

coordf_t Slic3r::SlicingParameters::gap_raft_object { 0 }
94{ 0 };

Referenced by create_from_config(), and Slic3r::equal_layering().

◆ gap_support_object

◆ interface_raft_layer_height

coordf_t Slic3r::SlicingParameters::interface_raft_layer_height { 0 }

◆ interface_raft_layers

◆ layer_height

◆ max_layer_height

◆ max_suport_layer_height

coordf_t Slic3r::SlicingParameters::max_suport_layer_height { 0 }

◆ min_layer_height

◆ object_print_z_max

coordf_t Slic3r::SlicingParameters::object_print_z_max { 0 }
109{ 0 };

Referenced by create_from_config(), and object_print_z_height().

◆ object_print_z_min

◆ object_print_z_uncompensated_max

coordf_t Slic3r::SlicingParameters::object_print_z_uncompensated_max { 0 }

◆ object_shrinkage_compensation_z

coordf_t Slic3r::SlicingParameters::object_shrinkage_compensation_z { 0 }

◆ raft_base_top_z

coordf_t Slic3r::SlicingParameters::raft_base_top_z { 0 }
103{ 0 };

Referenced by create_from_config(), and Slic3r::equal_layering().

◆ raft_contact_top_z

◆ raft_interface_top_z

coordf_t Slic3r::SlicingParameters::raft_interface_top_z { 0 }

◆ valid

bool Slic3r::SlicingParameters::valid { false }
56{ false };

Referenced by create_from_config(), and Slic3r::equal_layering().

◆ zero_gap_interface_bottom

bool Slic3r::SlicingParameters::zero_gap_interface_bottom { false }

◆ zero_gap_interface_raft

bool Slic3r::SlicingParameters::zero_gap_interface_raft { false }
92{ false };

Referenced by create_from_config(), and Slic3r::equal_layering().

◆ zero_gap_interface_top

bool Slic3r::SlicingParameters::zero_gap_interface_top { false }

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