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

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/PresetHints.hpp>

Static Public Member Functions

static std::string cooling_description (const Preset &preset)
static std::string maximum_volumetric_flow_description (const PresetBundle &preset_bundle)
static std::string recommended_thin_wall_thickness (const PresetBundle &preset_bundle)
static std::string top_bottom_shell_thickness_explanation (const PresetBundle &preset_bundle)

Detailed Description

Member Function Documentation

◆ cooling_description()

std::string Slic3r::PresetHints::cooling_description ( const Preset & preset)
static
18{
19 std::string out;
20 //BBS: don't show cooling_description now
21 /*
22 bool cooling = preset.config.opt_bool("cooling", 0);
23 int fan_cooling_layer_time = preset.config.opt_int("fan_cooling_layer_time", 0);
24 int full_fan_speed_layer = preset.config.opt_int("full_fan_speed_layer", 0);
25
26 if (cooling) {
27 int slow_down_layer_time = preset.config.opt_int("slow_down_layer_time", 0);
28 int fan_min_speed = preset.config.opt_int("fan_min_speed", 0);
29 int fan_max_speed = preset.config.opt_int("fan_max_speed", 0);
30 int slow_down_min_speed = int(preset.config.opt_float("slow_down_min_speed", 0) + 0.5);
31
32 out += GUI::format(_L("If estimated layer time is below ~%1%s, "
33 "fan will run at %2%%% and print speed will be reduced "
34 "so that no less than %3%s are spent on that layer "
35 "(however, speed will never be reduced below %4%mm/s)."),
36 slow_down_layer_time, fan_max_speed, slow_down_layer_time, slow_down_min_speed);
37 if (fan_cooling_layer_time > slow_down_layer_time) {
38 out += "\n";
39 if (fan_min_speed != fan_max_speed)
40 out += GUI::format(_L("If estimated layer time is greater, but still below ~%1%s, "
41 "fan will run at a proportionally decreasing speed between %2%%% and %3%%%."),
42 fan_cooling_layer_time, fan_max_speed, fan_min_speed);
43 else
44 out += GUI::format(_L("If estimated layer time is greater, but still below ~%1%s, "
45 "fan will run at %2%%%"),
46 fan_cooling_layer_time, fan_min_speed);
47 }
48 out += "\n";
49 }
50 if (preset.config.opt_bool("reduce_fan_stop_start_freq", 0)) {
51 int close_fan_the_first_x_layers = preset.config.opt_int("close_fan_the_first_x_layers", 0);
52 int fan_min_speed = preset.config.opt_int("fan_min_speed", 0);
53
54 if (full_fan_speed_layer > close_fan_the_first_x_layers + 1)
55 out += GUI::format(_L("Fan speed will be ramped from zero at layer %1% to %2%%% at layer %3%."), close_fan_the_first_x_layers, fan_min_speed, full_fan_speed_layer);
56 else {
57 out += GUI::format(cooling ? _L("During the other layers, fan will always run at %1%%%") : _L("Fan will always run at %1%%%"), fan_min_speed) + " ";
58 if (close_fan_the_first_x_layers > 1)
59 out += GUI::format(_L("except for the first %1% layers."), close_fan_the_first_x_layers);
60 else if (close_fan_the_first_x_layers == 1)
61 out += GUI::format(_L("except for the first layer."));
62 }
63 } else
64 out += cooling ? _u8L("During the other layers, fan will be turned off.") : _u8L("Fan will be turned off.");
65 */
66 return out;
67}

Referenced by Slic3r::GUI::TabFilament::update_description_lines().

Here is the caller graph for this function:

◆ maximum_volumetric_flow_description()

std::string Slic3r::PresetHints::maximum_volumetric_flow_description ( const PresetBundle & preset_bundle)
static
75{
76 std::string out;
77 //BBS: don't show maximum_volumetric_flow_description now
78 /*
79 // Find out, to which nozzle index is the current filament profile assigned.
80 int idx_extruder = 0;
81 int num_extruders = (int)preset_bundle.filament_presets.size();
82 for (; idx_extruder < num_extruders; ++ idx_extruder)
83 if (preset_bundle.filament_presets[idx_extruder] == preset_bundle.filaments.get_selected_preset_name())
84 break;
85 if (idx_extruder == num_extruders)
86 // The current filament preset is not active for any extruder.
87 idx_extruder = -1;
88
89 const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config;
90 const DynamicPrintConfig &filament_config = preset_bundle.filaments.get_edited_preset().config;
91 const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config;
92
93 // Current printer values.
94 float nozzle_diameter = (float)printer_config.opt_float("nozzle_diameter", idx_extruder);
95
96 // Print config values
97 double layer_height = print_config.opt_float("layer_height");
98 double initial_layer_print_height = print_config.opt_float("initial_layer_print_height");
99 double support_speed = print_config.opt_float("support_speed");
100 double support_interface_speed = print_config.get_abs_value("support_interface_speed");
101 double bridge_speed = print_config.opt_float("bridge_speed");
102 double bridge_flow = print_config.opt_float("bridge_flow");
103 double inner_wall_speed = print_config.opt_float("inner_wall_speed");
104 double outer_wall_speed = print_config.get_abs_value("outer_wall_speed", inner_wall_speed);
105 // double gap_infill_speed = print_config.opt_bool("filter_out_gap_fill") ? print_config.opt_float("gap_infill_speed") : 0.;
106 double sparse_infill_speed = print_config.opt_float("sparse_infill_speed");
107 double small_perimeter_speed = print_config.get_abs_value("small_perimeter_speed", inner_wall_speed);
108 double internal_solid_infill_speed = print_config.opt_float("internal_solid_infill_speed");
109 double top_surface_speed = print_config.opt_float("top_surface_speed");
110 // Maximum print speed when auto-speed is enabled by setting any of the above speed values to zero.
111 double max_print_speed = print_config.opt_float("max_print_speed");
112 // Maximum volumetric speed allowed for the print profile.
113 double max_volumetric_speed = print_config.opt_float("max_volumetric_speed");
114
115 const auto &extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("line_width");
116 const auto &outer_wall_line_width = *print_config.option<ConfigOptionFloatOrPercent>("outer_wall_line_width");
117 const auto &initial_layer_line_width = *print_config.option<ConfigOptionFloatOrPercent>("initial_layer_line_width");
118 const auto &sparse_infill_line_width = *print_config.option<ConfigOptionFloatOrPercent>("sparse_infill_line_width");
119 const auto &inner_wall_line_width = *print_config.option<ConfigOptionFloatOrPercent>("inner_wall_line_width");
120 const auto &internal_solid_infill_line_width = *print_config.option<ConfigOptionFloatOrPercent>("internal_solid_infill_line_width");
121 const auto& support_line_width = *print_config.option<ConfigOptionFloatOrPercent>("support_line_width");
122 const auto &top_surface_line_width = *print_config.option<ConfigOptionFloatOrPercent>("top_surface_line_width");
123 const auto &initial_layer_speed = *print_config.option<ConfigOptionFloatOrPercent>("initial_layer_speed");
124
125 // Index of an extruder assigned to a feature. If set to 0, an active extruder will be used for a multi-material print.
126 // If different from idx_extruder, it will not be taken into account for this hint.
127 auto feature_extruder_active = [idx_extruder, num_extruders](int i) {
128 return i <= 0 || i > num_extruders || idx_extruder == -1 || idx_extruder == i - 1;
129 };
130 bool perimeter_extruder_active = feature_extruder_active(print_config.opt_int("outer_wall_filament_id"))
131 && feature_extruder_active(print_config.opt_int("inner_wall_filament_id"));
132 bool infill_extruder_active = feature_extruder_active(print_config.opt_int("sparse_infill_filament_id"));
133 bool solid_infill_extruder_active = feature_extruder_active(print_config.opt_int("internal_solid_filament_id"))
134 && feature_extruder_active(print_config.opt_int("top_surface_filament_id"))
135 && feature_extruder_active(print_config.opt_int("bottom_surface_filament_id"));
136 bool support_material_extruder_active = feature_extruder_active(print_config.opt_int("support_filament"));
137 bool support_material_interface_extruder_active = feature_extruder_active(print_config.opt_int("support_interface_filament"));
138
139 // Current filament values
140 double filament_diameter = filament_config.opt_float("filament_diameter", 0);
141 double filament_crossection = M_PI * 0.25 * filament_diameter * filament_diameter;
142 // double filament_flow_ratio = filament_config.opt_float("filament_flow_ratio", 0);
143 // The following value will be annotated by this hint, so it does not take part in the calculation.
144// double filament_max_volumetric_speed = filament_config.opt_float("filament_max_volumetric_speed", 0);
145 for (size_t idx_type = (initial_layer_line_width.value == 0) ? 1 : 0; idx_type < 3; ++ idx_type) {
146 // First test the maximum volumetric extrusion speed for non-bridging extrusions.
147 bool first_layer = idx_type == 0;
148 bool bridging = idx_type == 2;
149 const ConfigOptionFloatOrPercent *first_layer_extrusion_width_ptr = (first_layer && initial_layer_line_width.value > 0) ?
150 &initial_layer_line_width : nullptr;
151 const float lh = float(first_layer ? initial_layer_print_height : layer_height);
152 double max_flow = 0.;
153 std::string max_flow_extrusion_type;
154 auto limit_by_first_layer_speed = [&initial_layer_speed, first_layer](double speed_normal, double speed_max) {
155 if (first_layer && initial_layer_speed.value > 0)
156 // Apply the first layer limit.
157 speed_normal = initial_layer_speed.get_abs_value(speed_normal);
158 return (speed_normal > 0.) ? speed_normal : speed_max;
159 };
160 auto test_flow =
161 [first_layer_extrusion_width_ptr, extrusion_width, nozzle_diameter, lh, bridging, bridge_speed, bridge_flow, limit_by_first_layer_speed, max_print_speed, &max_flow, &max_flow_extrusion_type]
162 (FlowRole flow_role, const ConfigOptionFloatOrPercent &this_extrusion_width, double speed, const char *err_msg) {
163 Flow flow = bridging ?
164 Flow::new_from_config_width(flow_role, first_positive(first_layer_extrusion_width_ptr, this_extrusion_width, extrusion_width), nozzle_diameter, lh) :
165 Flow::bridging_flow(nozzle_diameter * bridge_flow, nozzle_diameter);
166 double volumetric_flow = flow.mm3_per_mm() * (bridging ? bridge_speed : limit_by_first_layer_speed(speed, max_print_speed));
167 if (max_flow < volumetric_flow) {
168 max_flow = volumetric_flow;
169 max_flow_extrusion_type = _utf8(err_msg);
170 }
171 };
172 if (perimeter_extruder_active) {
173 test_flow(frExternalPerimeter, outer_wall_line_width, std::max(outer_wall_speed, small_perimeter_speed), L("outer wall"));
174 test_flow(frPerimeter, inner_wall_line_width, std::max(inner_wall_speed, small_perimeter_speed), L("inner wall"));
175 }
176 if (! bridging && infill_extruder_active)
177 test_flow(frInfill, sparse_infill_line_width, sparse_infill_speed, L("sparse infill"));
178 if (solid_infill_extruder_active) {
179 test_flow(frInfill, internal_solid_infill_line_width, internal_solid_infill_speed, L("internal solid infill"));
180 if (! bridging)
181 test_flow(frInfill, top_surface_line_width, top_surface_speed, L("top surface"));
182 }
183 if (! bridging && support_material_extruder_active)
184 test_flow(frSupportMaterial, support_line_width, support_speed, L("support"));
185 if (support_material_interface_extruder_active)
186 test_flow(frSupportMaterialInterface, support_line_width, support_interface_speed, L("support interface"));
187 //FIXME handle gap_infill_speed
188 if (! out.empty())
189 out += "\n";
190 out += (first_layer ? _utf8(L("First layer volumetric")) : (bridging ? _utf8(L("Bridge volumetric")) : _utf8(L("Volumetric"))));
191 out += " " + _utf8(L("flow rate is maximized")) + " ";
192 bool limited_by_max_volumetric_speed = max_volumetric_speed > 0 && max_volumetric_speed < max_flow;
193 out += (limited_by_max_volumetric_speed ?
194 _utf8(L("by the print profile maximum")) :
195 (_utf8(L("when printing"))+ " " + max_flow_extrusion_type))
196 + " " + _utf8(L("with a volumetric rate"))+ " ";
197 if (limited_by_max_volumetric_speed)
198 max_flow = max_volumetric_speed;
199
200 out += (boost::format(_utf8(L("%3.2f mm³/s at filament speed %3.2f mm/s."))) % max_flow % (max_flow / filament_crossection)).str();
201 }
202 */
203 return out;
204}

◆ recommended_thin_wall_thickness()

std::string Slic3r::PresetHints::recommended_thin_wall_thickness ( const PresetBundle & preset_bundle)
static
207{
208 std::string out;
209 //BBS: don't show recommended_thin_wall_thickness description now
210 /*
211 const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config;
212 const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config;
213
214 float layer_height = float(print_config.opt_float("layer_height"));
215 int num_perimeters = print_config.opt_int("wall_loops");
216 bool thin_walls = print_config.opt_bool("detect_thin_wall");
217 float nozzle_diameter = float(printer_config.opt_float("nozzle_diameter", 0));
218
219 std::string out;
220 if (layer_height <= 0.f) {
221 out += _utf8(L("Recommended object thin wall thickness: Not available due to invalid layer height."));
222 return out;
223 }
224
225 if (num_perimeters > 0) {
226 int num_lines = std::min(num_perimeters * 2, 10);
227 out += (boost::format(_utf8(L("Recommended object thin wall thickness for layer height %.2f and"))) % layer_height).str() + " ";
228 // Start with the width of two closely spaced
229 try {
230 Flow external_perimeter_flow = Flow::new_from_config_width(
231 frExternalPerimeter,
232 *print_config.opt<ConfigOptionFloatOrPercent>("outer_wall_line_width"),
233 nozzle_diameter, layer_height);
234 Flow perimeter_flow = Flow::new_from_config_width(
235 frPerimeter,
236 *print_config.opt<ConfigOptionFloatOrPercent>("inner_wall_line_width"),
237 nozzle_diameter, layer_height);
238 double width = external_perimeter_flow.width() + external_perimeter_flow.spacing();
239 for (int i = 2; i <= num_lines; thin_walls ? ++ i : i += 2) {
240 if (i > 2)
241 out += ", ";
242 out += (boost::format(_utf8(L("%d lines: %.2f mm"))) % i % width).str() + " ";
243 width += perimeter_flow.spacing() * (thin_walls ? 1.f : 2.f);
244 }
245 } catch (const FlowErrorNegativeSpacing &) {
246 out = _utf8(L("Recommended object thin wall thickness: Not available due to excessively small extrusion width."));
247 }
248 }*/
249 return out;
250}

Referenced by Slic3r::GUI::TabPrint::update_description_lines().

Here is the caller graph for this function:

◆ top_bottom_shell_thickness_explanation()

std::string Slic3r::PresetHints::top_bottom_shell_thickness_explanation ( const PresetBundle & preset_bundle)
static
257{
258 std::string out;
259 //BBS: don't show top_bottom_shell_thickness_explanation now
260 /*
261 const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config;
262 const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config;
263
264 int top_shell_layers = print_config.opt_int("top_shell_layers");
265 int bottom_shell_layers = print_config.opt_int("bottom_shell_layers");
266 bool has_top_layers = top_shell_layers > 0;
267 bool has_bottom_layers = bottom_shell_layers > 0;
268 double top_shell_thickness = print_config.opt_float("top_shell_thickness");
269 double bottom_shell_thickness = print_config.opt_float("bottom_shell_thickness");
270 double layer_height = print_config.opt_float("layer_height");
271 //FIXME the following line takes into account the 1st extruder only.
272 double min_layer_height = Slicing::min_layer_height_from_nozzle(printer_config, 1);
273
274 if (layer_height <= 0.f) {
275 out += _utf8(L("Top / bottom shell thickness hint: Not available due to invalid layer height."));
276 return out;
277 }
278
279 if (has_top_layers) {
280 double top_shell_thickness = top_shell_layers * layer_height;
281 if (top_shell_thickness < top_shell_thickness) {
282 // top_solid_min_shell_thickness triggers even in case of normal layer height. Round the top_shell_thickness up
283 // to an integer multiply of layer_height.
284 double n = ceil(top_shell_thickness / layer_height);
285 top_shell_thickness = n * layer_height;
286 }
287 double top_shell_thickness_minimum = std::max(top_shell_thickness, top_shell_layers * min_layer_height);
288 out += (boost::format(_utf8(L("Top shell is %1% mm thick for layer height %2% mm."))) % top_shell_thickness % layer_height).str();
289 if (top_shell_thickness_minimum < top_shell_thickness) {
290 out += " ";
291 out += (boost::format(_utf8(L("Minimum top shell thickness is %1% mm."))) % top_shell_thickness_minimum).str();
292 }
293 } else
294 out += _utf8(L("Top is open."));
295
296 out += "\n";
297
298 if (has_bottom_layers) {
299 double bottom_shell_thickness = bottom_shell_layers * layer_height;
300 if (bottom_shell_thickness < bottom_shell_thickness) {
301 // bottom_solid_min_shell_thickness triggers even in case of normal layer height. Round the bottom_shell_thickness up
302 // to an integer multiply of layer_height.
303 double n = ceil(bottom_shell_thickness / layer_height);
304 bottom_shell_thickness = n * layer_height;
305 }
306 double bottom_shell_thickness_minimum = std::max(bottom_shell_thickness, bottom_shell_layers * min_layer_height);
307 out += (boost::format(_utf8(L("Bottom shell is %1% mm thick for layer height %2% mm."))) % bottom_shell_thickness % layer_height).str();
308 if (bottom_shell_thickness_minimum < bottom_shell_thickness) {
309 out += " ";
310 out += (boost::format(_utf8(L("Minimum bottom shell thickness is %1% mm."))) % bottom_shell_thickness_minimum).str();
311 }
312 } else
313 out += _utf8(L("Bottom is open."));
314 */
315 return out;
316}

Referenced by Slic3r::GUI::TabPrint::update_description_lines().

Here is the caller graph for this function:

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