1 #include "PrintConfig.hpp"
2 #include "I18N.hpp"
3 
4 #include <set>
5 #include <boost/algorithm/string/replace.hpp>
6 #include <boost/algorithm/string/case_conv.hpp>
7 #include <boost/format.hpp>
8 #include <boost/lexical_cast.hpp>
9 #include <boost/thread.hpp>
10 
11 #include <float.h>
12 
13 namespace Slic3r {
14 
15 //! macro used to mark string used at localization,
16 //! return same string
17 #define L(s) (s)
18 #define _(s) Slic3r::I18N::translate(s)
19 
assign_printer_technology_to_unknown(t_optiondef_map & options,PrinterTechnology printer_technology)20 static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
21 {
22     for (std::pair<const t_config_option_key, ConfigOptionDef> &kvp : options)
23         if (kvp.second.printer_technology == ptUnknown)
24             kvp.second.printer_technology = printer_technology;
25 }
26 
PrintConfigDef()27 PrintConfigDef::PrintConfigDef()
28 {
29     this->init_common_params();
30     assign_printer_technology_to_unknown(this->options, ptAny);
31     this->init_fff_params();
32     this->init_extruder_option_keys();
33     assign_printer_technology_to_unknown(this->options, ptFFF);
34     this->init_sla_params();
35     assign_printer_technology_to_unknown(this->options, ptSLA);
36 }
37 
init_common_params()38 void PrintConfigDef::init_common_params()
39 {
40     ConfigOptionDef* def;
41 
42     def = this->add("printer_technology", coEnum);
43     def->label = L("Printer technology");
44     def->tooltip = L("Printer technology");
45     def->enum_keys_map = &ConfigOptionEnum<PrinterTechnology>::get_enum_values();
46     def->enum_values.push_back("FFF");
47     def->enum_values.push_back("SLA");
48     def->set_default_value(new ConfigOptionEnum<PrinterTechnology>(ptFFF));
49 
50     def = this->add("bed_shape", coPoints);
51     def->label = L("Bed shape");
52     def->mode = comAdvanced;
53     def->set_default_value(new ConfigOptionPoints{ Vec2d(0, 0), Vec2d(200, 0), Vec2d(200, 200), Vec2d(0, 200) });
54 
55     def = this->add("bed_custom_texture", coString);
56     def->label = L("Bed custom texture");
57     def->mode = comAdvanced;
58     def->set_default_value(new ConfigOptionString(""));
59 
60     def = this->add("bed_custom_model", coString);
61     def->label = L("Bed custom model");
62     def->mode = comAdvanced;
63     def->set_default_value(new ConfigOptionString(""));
64 
65     def = this->add("thumbnails", coPoints);
66     def->label = L("G-code thumbnails");
67     def->tooltip = L("Picture sizes to be stored into a .gcode and .sl1 / .sl1s files, in the following format: \"XxY, XxY, ...\"");
68     def->mode = comExpert;
69     def->gui_type = "one_string";
70     def->set_default_value(new ConfigOptionPoints());
71 
72     def = this->add("layer_height", coFloat);
73     def->label = L("Layer height");
74     def->category = L("Layers and Perimeters");
75     def->tooltip = L("This setting controls the height (and thus the total number) of the slices/layers. "
76                    "Thinner layers give better accuracy but take more time to print.");
77     def->sidetext = L("mm");
78     def->min = 0;
79     def->set_default_value(new ConfigOptionFloat(0.3));
80 
81     def = this->add("max_print_height", coFloat);
82     def->label = L("Max print height");
83     def->tooltip = L("Set this to the maximum height that can be reached by your extruder while printing.");
84     def->sidetext = L("mm");
85     def->min = 0;
86     def->max = 1200;
87     def->mode = comAdvanced;
88     def->set_default_value(new ConfigOptionFloat(200.0));
89 
90     def = this->add("slice_closing_radius", coFloat);
91     def->label = L("Slice gap closing radius");
92     def->category = L("Advanced");
93     def->tooltip = L("Cracks smaller than 2x gap closing radius are being filled during the triangle mesh slicing. "
94                      "The gap closing operation may reduce the final print resolution, therefore it is advisable to keep the value reasonably low.");
95     def->sidetext = L("mm");
96     def->min = 0;
97     def->mode = comAdvanced;
98     def->set_default_value(new ConfigOptionFloat(0.049));
99 
100     def = this->add("print_host", coString);
101     def->label = L("Hostname, IP or URL");
102     def->tooltip = L("Slic3r can upload G-code files to a printer host. This field should contain "
103                    "the hostname, IP address or URL of the printer host instance. "
104                    "Print host behind HAProxy with basic auth enabled can be accessed by putting the user name and password into the URL "
105                    "in the following format: https://username:password@your-octopi-address/");
106     def->mode = comAdvanced;
107     def->set_default_value(new ConfigOptionString(""));
108 
109     def = this->add("printhost_apikey", coString);
110     def->label = L("API Key / Password");
111     def->tooltip = L("Slic3r can upload G-code files to a printer host. This field should contain "
112                    "the API Key or the password required for authentication.");
113     def->mode = comAdvanced;
114     def->set_default_value(new ConfigOptionString(""));
115 
116     def = this->add("printhost_port", coString);
117     def->label = L("Printer");
118     def->tooltip = L("Name of the printer");
119     def->gui_type = "select_open";
120     def->mode = comAdvanced;
121     def->set_default_value(new ConfigOptionString(""));
122 
123     def = this->add("printhost_cafile", coString);
124     def->label = L("HTTPS CA File");
125     def->tooltip = L("Custom CA certificate file can be specified for HTTPS OctoPrint connections, in crt/pem format. "
126                    "If left blank, the default OS CA certificate repository is used.");
127     def->mode = comAdvanced;
128     def->set_default_value(new ConfigOptionString(""));
129 
130     def = this->add("elefant_foot_compensation", coFloat);
131     def->label = L("Elephant foot compensation");
132     def->category = L("Advanced");
133     def->tooltip = L("The first layer will be shrunk in the XY plane by the configured value "
134                      "to compensate for the 1st layer squish aka an Elephant Foot effect.");
135     def->sidetext = L("mm");
136     def->min = 0;
137     def->mode = comAdvanced;
138     def->set_default_value(new ConfigOptionFloat(0.2));
139 
140     // Options used by physical printers
141 
142     def = this->add("printhost_user", coString);
143     def->label = L("User");
144 //    def->tooltip = L("");
145     def->mode = comAdvanced;
146     def->set_default_value(new ConfigOptionString(""));
147 
148     def = this->add("printhost_password", coString);
149     def->label = L("Password");
150 //    def->tooltip = L("");
151     def->mode = comAdvanced;
152     def->set_default_value(new ConfigOptionString(""));
153 
154     def = this->add("preset_name", coString);
155     def->label = L("Printer preset name");
156     def->tooltip = L("Related printer preset name");
157     def->mode = comAdvanced;
158     def->set_default_value(new ConfigOptionString(""));
159 
160     def = this->add("printhost_authorization_type", coEnum);
161     def->label = L("Authorization Type");
162 //    def->tooltip = L("");
163     def->enum_keys_map = &ConfigOptionEnum<AuthorizationType>::get_enum_values();
164     def->enum_values.push_back("key");
165     def->enum_values.push_back("user");
166     def->enum_labels.push_back(L("API key"));
167     def->enum_labels.push_back(L("HTTP digest"));
168     def->mode = comAdvanced;
169     def->set_default_value(new ConfigOptionEnum<AuthorizationType>(atKeyPassword));
170 }
171 
init_fff_params()172 void PrintConfigDef::init_fff_params()
173 {
174     ConfigOptionDef* def;
175 
176     // Maximum extruder temperature, bumped to 1500 to support printing of glass.
177     const int max_temp = 1500;
178 
179     def = this->add("avoid_crossing_perimeters", coBool);
180     def->label = L("Avoid crossing perimeters");
181     def->tooltip = L("Optimize travel moves in order to minimize the crossing of perimeters. "
182                    "This is mostly useful with Bowden extruders which suffer from oozing. "
183                    "This feature slows down both the print and the G-code generation.");
184     def->mode = comExpert;
185     def->set_default_value(new ConfigOptionBool(false));
186 
187     def = this->add("avoid_crossing_perimeters_max_detour", coFloatOrPercent);
188     def->label = L("Avoid crossing perimeters - Max detour length");
189     def->category = L("Layers and Perimeters");
190     def->tooltip = L("The maximum detour length for avoid crossing perimeters. "
191                      "If the detour is longer than this value, avoid crossing perimeters is not applied for this travel path. "
192                      "Detour length could be specified either as an absolute value or as percentage (for example 50%) of a direct travel path.");
193     def->sidetext = L("mm or % (zero to disable)");
194     def->min = 0;
195     def->mode = comExpert;
196     def->set_default_value(new ConfigOptionFloatOrPercent(0., false));
197 
198     def = this->add("bed_temperature", coInts);
199     def->label = L("Other layers");
200     def->tooltip = L("Bed temperature for layers after the first one. "
201                    "Set this to zero to disable bed temperature control commands in the output.");
202     def->sidetext = L("°C");
203     def->full_label = L("Bed temperature");
204     def->min = 0;
205     def->max = 300;
206     def->set_default_value(new ConfigOptionInts { 0 });
207 
208     def = this->add("before_layer_gcode", coString);
209     def->label = L("Before layer change G-code");
210     def->tooltip = L("This custom code is inserted at every layer change, right before the Z move. "
211                    "Note that you can use placeholder variables for all Slic3r settings as well "
212                    "as [layer_num] and [layer_z].");
213     def->multiline = true;
214     def->full_width = true;
215     def->height = 5;
216     def->mode = comExpert;
217     def->set_default_value(new ConfigOptionString(""));
218 
219     def = this->add("between_objects_gcode", coString);
220     def->label = L("Between objects G-code");
221     def->tooltip = L("This code is inserted between objects when using sequential printing. By default extruder and bed temperature are reset using non-wait command; however if M104, M109, M140 or M190 are detected in this custom code, Slic3r will not add temperature commands. Note that you can use placeholder variables for all Slic3r settings, so you can put a \"M109 S[first_layer_temperature]\" command wherever you want.");
222     def->multiline = true;
223     def->full_width = true;
224     def->height = 12;
225     def->mode = comExpert;
226     def->set_default_value(new ConfigOptionString(""));
227 
228     def = this->add("bottom_solid_layers", coInt);
229     //TRN To be shown in Print Settings "Bottom solid layers"
230     def->label = L("Bottom");
231     def->category = L("Layers and Perimeters");
232     def->tooltip = L("Number of solid layers to generate on bottom surfaces.");
233     def->full_label = L("Bottom solid layers");
234     def->min = 0;
235     def->set_default_value(new ConfigOptionInt(3));
236 
237     def = this->add("bottom_solid_min_thickness", coFloat);
238     //TRN To be shown in Print Settings "Top solid layers"
239     def->label = L("Bottom");
240     def->category = L("Layers and Perimeters");
241     def->tooltip = L("The number of bottom solid layers is increased above bottom_solid_layers if necessary to satisfy "
242     				 "minimum thickness of bottom shell.");
243     def->full_label = L("Minimum bottom shell thickness");
244     def->sidetext = L("mm");
245     def->min = 0;
246     def->set_default_value(new ConfigOptionFloat(0.));
247 
248     def = this->add("bridge_acceleration", coFloat);
249     def->label = L("Bridge");
250     def->tooltip = L("This is the acceleration your printer will use for bridges. "
251                    "Set zero to disable acceleration control for bridges.");
252     def->sidetext = L("mm/s²");
253     def->min = 0;
254     def->mode = comExpert;
255     def->set_default_value(new ConfigOptionFloat(0));
256 
257     def = this->add("bridge_angle", coFloat);
258     def->label = L("Bridging angle");
259     def->category = L("Infill");
260     def->tooltip = L("Bridging angle override. If left to zero, the bridging angle will be calculated "
261                    "automatically. Otherwise the provided angle will be used for all bridges. "
262                    "Use 180° for zero angle.");
263     def->sidetext = L("°");
264     def->min = 0;
265     def->mode = comAdvanced;
266     def->set_default_value(new ConfigOptionFloat(0.));
267 
268     def = this->add("bridge_fan_speed", coInts);
269     def->label = L("Bridges fan speed");
270     def->tooltip = L("This fan speed is enforced during all bridges and overhangs.");
271     def->sidetext = L("%");
272     def->min = 0;
273     def->max = 100;
274     def->mode = comExpert;
275     def->set_default_value(new ConfigOptionInts { 100 });
276 
277     def = this->add("bridge_flow_ratio", coFloat);
278     def->label = L("Bridge flow ratio");
279     def->category = L("Advanced");
280     def->tooltip = L("This factor affects the amount of plastic for bridging. "
281                    "You can decrease it slightly to pull the extrudates and prevent sagging, "
282                    "although default settings are usually good and you should experiment "
283                    "with cooling (use a fan) before tweaking this.");
284     def->min = 0;
285     def->max = 2;
286     def->mode = comAdvanced;
287     def->set_default_value(new ConfigOptionFloat(1));
288 
289     def = this->add("bridge_speed", coFloat);
290     def->label = L("Bridges");
291     def->category = L("Speed");
292     def->tooltip = L("Speed for printing bridges.");
293     def->sidetext = L("mm/s");
294     def->aliases = { "bridge_feed_rate" };
295     def->min = 0;
296     def->mode = comAdvanced;
297     def->set_default_value(new ConfigOptionFloat(60));
298 
299     def = this->add("brim_width", coFloat);
300     def->label = L("Brim width");
301     def->tooltip = L("Horizontal width of the brim that will be printed around each object on the first layer.");
302     def->sidetext = L("mm");
303     def->min = 0;
304     def->mode = comSimple;
305     def->set_default_value(new ConfigOptionFloat(0));
306 
307     def = this->add("clip_multipart_objects", coBool);
308     def->label = L("Clip multi-part objects");
309     def->tooltip = L("When printing multi-material objects, this settings will make Slic3r "
310                    "to clip the overlapping object parts one by the other "
311                    "(2nd part will be clipped by the 1st, 3rd part will be clipped by the 1st and 2nd etc).");
312     def->mode = comExpert;
313     def->set_default_value(new ConfigOptionBool(true));
314 
315     def = this->add("colorprint_heights", coFloats);
316     def->label = L("Colorprint height");
317     def->tooltip = L("Heights at which a filament change is to occur.");
318     def->set_default_value(new ConfigOptionFloats { });
319 
320     def = this->add("compatible_printers", coStrings);
321     def->label = L("Compatible printers");
322     def->mode = comAdvanced;
323     def->set_default_value(new ConfigOptionStrings());
324     def->cli = ConfigOptionDef::nocli;
325 
326     def = this->add("compatible_printers_condition", coString);
327     def->label = L("Compatible printers condition");
328     def->tooltip = L("A boolean expression using the configuration values of an active printer profile. "
329                    "If this expression evaluates to true, this profile is considered compatible "
330                    "with the active printer profile.");
331     def->mode = comExpert;
332     def->set_default_value(new ConfigOptionString());
333     def->cli = ConfigOptionDef::nocli;
334 
335     def = this->add("compatible_prints", coStrings);
336     def->label = L("Compatible print profiles");
337     def->mode = comAdvanced;
338     def->set_default_value(new ConfigOptionStrings());
339     def->cli = ConfigOptionDef::nocli;
340 
341     def = this->add("compatible_prints_condition", coString);
342     def->label = L("Compatible print profiles condition");
343     def->tooltip = L("A boolean expression using the configuration values of an active print profile. "
344                    "If this expression evaluates to true, this profile is considered compatible "
345                    "with the active print profile.");
346     def->mode = comExpert;
347     def->set_default_value(new ConfigOptionString());
348     def->cli = ConfigOptionDef::nocli;
349 
350     // The following value is to be stored into the project file (AMF, 3MF, Config ...)
351     // and it contains a sum of "compatible_printers_condition" values over the print and filament profiles.
352     def = this->add("compatible_printers_condition_cummulative", coStrings);
353     def->set_default_value(new ConfigOptionStrings());
354     def->cli = ConfigOptionDef::nocli;
355     def = this->add("compatible_prints_condition_cummulative", coStrings);
356     def->set_default_value(new ConfigOptionStrings());
357     def->cli = ConfigOptionDef::nocli;
358 
359     def = this->add("complete_objects", coBool);
360     def->label = L("Complete individual objects");
361     def->tooltip = L("When printing multiple objects or copies, this feature will complete "
362                    "each object before moving onto next one (and starting it from its bottom layer). "
363                    "This feature is useful to avoid the risk of ruined prints. "
364                    "Slic3r should warn and prevent you from extruder collisions, but beware.");
365     def->mode = comAdvanced;
366     def->set_default_value(new ConfigOptionBool(false));
367 
368     def = this->add("cooling", coBools);
369     def->label = L("Enable auto cooling");
370     def->tooltip = L("This flag enables the automatic cooling logic that adjusts print speed "
371                    "and fan speed according to layer printing time.");
372     def->set_default_value(new ConfigOptionBools { true });
373 
374     def = this->add("cooling_tube_retraction", coFloat);
375     def->label = L("Cooling tube position");
376     def->tooltip = L("Distance of the center-point of the cooling tube from the extruder tip.");
377     def->sidetext = L("mm");
378     def->min = 0;
379     def->mode = comAdvanced;
380     def->set_default_value(new ConfigOptionFloat(91.5f));
381 
382     def = this->add("cooling_tube_length", coFloat);
383     def->label = L("Cooling tube length");
384     def->tooltip = L("Length of the cooling tube to limit space for cooling moves inside it.");
385     def->sidetext = L("mm");
386     def->min = 0;
387     def->mode = comAdvanced;
388     def->set_default_value(new ConfigOptionFloat(5.f));
389 
390     def = this->add("default_acceleration", coFloat);
391     def->label = L("Default");
392     def->tooltip = L("This is the acceleration your printer will be reset to after "
393                    "the role-specific acceleration values are used (perimeter/infill). "
394                    "Set zero to prevent resetting acceleration at all.");
395     def->sidetext = L("mm/s²");
396     def->min = 0;
397     def->mode = comExpert;
398     def->set_default_value(new ConfigOptionFloat(0));
399 
400     def = this->add("default_filament_profile", coStrings);
401     def->label = L("Default filament profile");
402     def->tooltip = L("Default filament profile associated with the current printer profile. "
403                    "On selection of the current printer profile, this filament profile will be activated.");
404     def->set_default_value(new ConfigOptionStrings());
405     def->cli = ConfigOptionDef::nocli;
406 
407     def = this->add("default_print_profile", coString);
408     def->label = L("Default print profile");
409     def->tooltip = L("Default print profile associated with the current printer profile. "
410                    "On selection of the current printer profile, this print profile will be activated.");
411     def->set_default_value(new ConfigOptionString());
412     def->cli = ConfigOptionDef::nocli;
413 
414     def = this->add("disable_fan_first_layers", coInts);
415     def->label = L("Disable fan for the first");
416     def->tooltip = L("You can set this to a positive value to disable fan at all "
417                    "during the first layers, so that it does not make adhesion worse.");
418     def->sidetext = L("layers");
419     def->min = 0;
420     def->max = 1000;
421     def->mode = comExpert;
422     def->set_default_value(new ConfigOptionInts { 3 });
423 
424     def = this->add("dont_support_bridges", coBool);
425     def->label = L("Don't support bridges");
426     def->category = L("Support material");
427     def->tooltip = L("Experimental option for preventing support material from being generated "
428                    "under bridged areas.");
429     def->mode = comAdvanced;
430     def->set_default_value(new ConfigOptionBool(true));
431 
432     def = this->add("duplicate_distance", coFloat);
433     def->label = L("Distance between copies");
434     def->tooltip = L("Distance used for the auto-arrange feature of the plater.");
435     def->sidetext = L("mm");
436     def->aliases = { "multiply_distance" };
437     def->min = 0;
438     def->set_default_value(new ConfigOptionFloat(6));
439 
440     def = this->add("end_gcode", coString);
441     def->label = L("End G-code");
442     def->tooltip = L("This end procedure is inserted at the end of the output file. "
443                    "Note that you can use placeholder variables for all PrusaSlicer settings.");
444     def->multiline = true;
445     def->full_width = true;
446     def->height = 12;
447     def->mode = comExpert;
448     def->set_default_value(new ConfigOptionString("M104 S0 ; turn off temperature\nG28 X0  ; home X axis\nM84     ; disable motors\n"));
449 
450     def = this->add("end_filament_gcode", coStrings);
451     def->label = L("End G-code");
452     def->tooltip = L("This end procedure is inserted at the end of the output file, before the printer end gcode (and "
453                    "before any toolchange from this filament in case of multimaterial printers). "
454                    "Note that you can use placeholder variables for all PrusaSlicer settings. "
455                    "If you have multiple extruders, the gcode is processed in extruder order.");
456     def->multiline = true;
457     def->full_width = true;
458     def->height = 120;
459     def->mode = comExpert;
460     def->set_default_value(new ConfigOptionStrings { "; Filament-specific end gcode \n;END gcode for filament\n" });
461 
462     def = this->add("ensure_vertical_shell_thickness", coBool);
463     def->label = L("Ensure vertical shell thickness");
464     def->category = L("Layers and Perimeters");
465     def->tooltip = L("Add solid infill near sloping surfaces to guarantee the vertical shell thickness "
466                    "(top+bottom solid layers).");
467     def->mode = comAdvanced;
468     def->set_default_value(new ConfigOptionBool(false));
469 
470     auto def_top_fill_pattern = def = this->add("top_fill_pattern", coEnum);
471     def->label = L("Top fill pattern");
472     def->category = L("Infill");
473     def->tooltip = L("Fill pattern for top infill. This only affects the top visible layer, and not its adjacent solid shells.");
474     def->cli = "top-fill-pattern|external-fill-pattern|solid-fill-pattern";
475     def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
476     def->enum_values.push_back("rectilinear");
477     def->enum_values.push_back("monotonic");
478     def->enum_values.push_back("alignedrectilinear");
479     def->enum_values.push_back("concentric");
480     def->enum_values.push_back("hilbertcurve");
481     def->enum_values.push_back("archimedeanchords");
482     def->enum_values.push_back("octagramspiral");
483     def->enum_labels.push_back(L("Rectilinear"));
484     def->enum_labels.push_back(L("Monotonic"));
485     def->enum_labels.push_back(L("Aligned Rectilinear"));
486     def->enum_labels.push_back(L("Concentric"));
487     def->enum_labels.push_back(L("Hilbert Curve"));
488     def->enum_labels.push_back(L("Archimedean Chords"));
489     def->enum_labels.push_back(L("Octagram Spiral"));
490     // solid_fill_pattern is an obsolete equivalent to top_fill_pattern/bottom_fill_pattern.
491     def->aliases = { "solid_fill_pattern", "external_fill_pattern" };
492     def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipMonotonic));
493 
494     def = this->add("bottom_fill_pattern", coEnum);
495     def->label = L("Bottom fill pattern");
496     def->category = L("Infill");
497     def->tooltip = L("Fill pattern for bottom infill. This only affects the bottom external visible layer, and not its adjacent solid shells.");
498     def->cli = "bottom-fill-pattern|external-fill-pattern|solid-fill-pattern";
499     def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
500     def->enum_values = def_top_fill_pattern->enum_values;
501     def->enum_labels = def_top_fill_pattern->enum_labels;
502     def->aliases = def_top_fill_pattern->aliases;
503     def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipMonotonic));
504 
505     def = this->add("external_perimeter_extrusion_width", coFloatOrPercent);
506     def->label = L("External perimeters");
507     def->category = L("Extrusion Width");
508     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for external perimeters. "
509                    "If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
510                    "If expressed as percentage (for example 200%), it will be computed over layer height.");
511     def->sidetext = L("mm or %");
512     def->min = 0;
513     def->mode = comAdvanced;
514     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
515 
516     def = this->add("external_perimeter_speed", coFloatOrPercent);
517     def->label = L("External perimeters");
518     def->category = L("Speed");
519     def->tooltip = L("This separate setting will affect the speed of external perimeters (the visible ones). "
520                    "If expressed as percentage (for example: 80%) it will be calculated "
521                    "on the perimeters speed setting above. Set to zero for auto.");
522     def->sidetext = L("mm/s or %");
523     def->ratio_over = "perimeter_speed";
524     def->min = 0;
525     def->mode = comAdvanced;
526     def->set_default_value(new ConfigOptionFloatOrPercent(50, true));
527 
528     def = this->add("external_perimeters_first", coBool);
529     def->label = L("External perimeters first");
530     def->category = L("Layers and Perimeters");
531     def->tooltip = L("Print contour perimeters from the outermost one to the innermost one "
532                    "instead of the default inverse order.");
533     def->mode = comExpert;
534     def->set_default_value(new ConfigOptionBool(false));
535 
536     def = this->add("extra_perimeters", coBool);
537     def->label = L("Extra perimeters if needed");
538     def->category = L("Layers and Perimeters");
539     def->tooltip = L("Add more perimeters when needed for avoiding gaps in sloping walls. "
540                    "Slic3r keeps adding perimeters, until more than 70% of the loop immediately above "
541                    "is supported.");
542     def->mode = comExpert;
543     def->set_default_value(new ConfigOptionBool(true));
544 
545     def = this->add("extruder", coInt);
546     def->gui_type = "i_enum_open";
547     def->label = L("Extruder");
548     def->category = L("Extruders");
549     def->tooltip = L("The extruder to use (unless more specific extruder settings are specified). "
550                    "This value overrides perimeter and infill extruders, but not the support extruders.");
551     def->min = 0;  // 0 = inherit defaults
552     def->enum_labels.push_back(L("default"));  // override label for item 0
553     def->enum_labels.push_back("1");
554     def->enum_labels.push_back("2");
555     def->enum_labels.push_back("3");
556     def->enum_labels.push_back("4");
557     def->enum_labels.push_back("5");
558 
559     def = this->add("extruder_clearance_height", coFloat);
560     def->label = L("Height");
561     def->tooltip = L("Set this to the vertical distance between your nozzle tip and (usually) the X carriage rods. "
562                    "In other words, this is the height of the clearance cylinder around your extruder, "
563                    "and it represents the maximum depth the extruder can peek before colliding with "
564                    "other printed objects.");
565     def->sidetext = L("mm");
566     def->min = 0;
567     def->mode = comExpert;
568     def->set_default_value(new ConfigOptionFloat(20));
569 
570     def = this->add("extruder_clearance_radius", coFloat);
571     def->label = L("Radius");
572     def->tooltip = L("Set this to the clearance radius around your extruder. "
573                    "If the extruder is not centered, choose the largest value for safety. "
574                    "This setting is used to check for collisions and to display the graphical preview "
575                    "in the plater.");
576     def->sidetext = L("mm");
577     def->min = 0;
578     def->mode = comExpert;
579     def->set_default_value(new ConfigOptionFloat(20));
580 
581     def = this->add("extruder_colour", coStrings);
582     def->label = L("Extruder Color");
583     def->tooltip = L("This is only used in the Slic3r interface as a visual help.");
584     def->gui_type = "color";
585     // Empty string means no color assigned yet.
586     def->set_default_value(new ConfigOptionStrings { "" });
587 
588     def = this->add("extruder_offset", coPoints);
589     def->label = L("Extruder offset");
590     def->tooltip = L("If your firmware doesn't handle the extruder displacement you need the G-code "
591                    "to take it into account. This option lets you specify the displacement of each extruder "
592                    "with respect to the first one. It expects positive coordinates (they will be subtracted "
593                    "from the XY coordinate).");
594     def->sidetext = L("mm");
595     def->mode = comAdvanced;
596     def->set_default_value(new ConfigOptionPoints { Vec2d(0,0) });
597 
598     def = this->add("extrusion_axis", coString);
599     def->label = L("Extrusion axis");
600     def->tooltip = L("Use this option to set the axis letter associated to your printer's extruder "
601                    "(usually E but some printers use A).");
602     def->set_default_value(new ConfigOptionString("E"));
603 
604     def = this->add("extrusion_multiplier", coFloats);
605     def->label = L("Extrusion multiplier");
606     def->tooltip = L("This factor changes the amount of flow proportionally. You may need to tweak "
607                    "this setting to get nice surface finish and correct single wall widths. "
608                    "Usual values are between 0.9 and 1.1. If you think you need to change this more, "
609                    "check filament diameter and your firmware E steps.");
610     def->max = 2;
611     def->mode = comAdvanced;
612     def->set_default_value(new ConfigOptionFloats { 1. });
613 
614     def = this->add("extrusion_width", coFloatOrPercent);
615     def->label = L("Default extrusion width");
616     def->category = L("Extrusion Width");
617     def->tooltip = L("Set this to a non-zero value to allow a manual extrusion width. "
618                    "If left to zero, Slic3r derives extrusion widths from the nozzle diameter "
619                    "(see the tooltips for perimeter extrusion width, infill extrusion width etc). "
620                    "If expressed as percentage (for example: 230%), it will be computed over layer height.");
621     def->sidetext = L("mm or %");
622     def->min = 0;
623     def->max = 1000;
624     def->mode = comAdvanced;
625     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
626 
627     def = this->add("fan_always_on", coBools);
628     def->label = L("Keep fan always on");
629     def->tooltip = L("If this is enabled, fan will never be disabled and will be kept running at least "
630                    "at its minimum speed. Useful for PLA, harmful for ABS.");
631     def->set_default_value(new ConfigOptionBools { false });
632 
633     def = this->add("fan_below_layer_time", coInts);
634     def->label = L("Enable fan if layer print time is below");
635     def->tooltip = L("If layer print time is estimated below this number of seconds, fan will be enabled "
636                    "and its speed will be calculated by interpolating the minimum and maximum speeds.");
637     def->sidetext = L("approximate seconds");
638     def->min = 0;
639     def->max = 1000;
640     def->mode = comExpert;
641     def->set_default_value(new ConfigOptionInts { 60 });
642 
643     def = this->add("filament_colour", coStrings);
644     def->label = L("Color");
645     def->tooltip = L("This is only used in the Slic3r interface as a visual help.");
646     def->gui_type = "color";
647     def->set_default_value(new ConfigOptionStrings { "#29B2B2" });
648 
649     def = this->add("filament_notes", coStrings);
650     def->label = L("Filament notes");
651     def->tooltip = L("You can put your notes regarding the filament here.");
652     def->multiline = true;
653     def->full_width = true;
654     def->height = 13;
655     def->mode = comAdvanced;
656     def->set_default_value(new ConfigOptionStrings { "" });
657 
658     def = this->add("filament_max_volumetric_speed", coFloats);
659     def->label = L("Max volumetric speed");
660     def->tooltip = L("Maximum volumetric speed allowed for this filament. Limits the maximum volumetric "
661                    "speed of a print to the minimum of print and filament volumetric speed. "
662                    "Set to zero for no limit.");
663     def->sidetext = L("mm³/s");
664     def->min = 0;
665     def->mode = comAdvanced;
666     def->set_default_value(new ConfigOptionFloats { 0. });
667 
668     def = this->add("filament_loading_speed", coFloats);
669     def->label = L("Loading speed");
670     def->tooltip = L("Speed used for loading the filament on the wipe tower.");
671     def->sidetext = L("mm/s");
672     def->min = 0;
673     def->mode = comExpert;
674     def->set_default_value(new ConfigOptionFloats { 28. });
675 
676     def = this->add("filament_loading_speed_start", coFloats);
677     def->label = L("Loading speed at the start");
678     def->tooltip = L("Speed used at the very beginning of loading phase.");
679     def->sidetext = L("mm/s");
680     def->min = 0;
681     def->mode = comExpert;
682     def->set_default_value(new ConfigOptionFloats { 3. });
683 
684     def = this->add("filament_unloading_speed", coFloats);
685     def->label = L("Unloading speed");
686     def->tooltip = L("Speed used for unloading the filament on the wipe tower (does not affect "
687                       " initial part of unloading just after ramming).");
688     def->sidetext = L("mm/s");
689     def->min = 0;
690     def->mode = comExpert;
691     def->set_default_value(new ConfigOptionFloats { 90. });
692 
693     def = this->add("filament_unloading_speed_start", coFloats);
694     def->label = L("Unloading speed at the start");
695     def->tooltip = L("Speed used for unloading the tip of the filament immediately after ramming.");
696     def->sidetext = L("mm/s");
697     def->min = 0;
698     def->mode = comExpert;
699     def->set_default_value(new ConfigOptionFloats { 100. });
700 
701     def = this->add("filament_toolchange_delay", coFloats);
702     def->label = L("Delay after unloading");
703     def->tooltip = L("Time to wait after the filament is unloaded. "
704                    "May help to get reliable toolchanges with flexible materials "
705                    "that may need more time to shrink to original dimensions.");
706     def->sidetext = L("s");
707     def->min = 0;
708     def->mode = comExpert;
709     def->set_default_value(new ConfigOptionFloats { 0. });
710 
711     def = this->add("filament_cooling_moves", coInts);
712     def->label = L("Number of cooling moves");
713     def->tooltip = L("Filament is cooled by being moved back and forth in the "
714                    "cooling tubes. Specify desired number of these moves.");
715     def->max = 0;
716     def->max = 20;
717     def->mode = comExpert;
718     def->set_default_value(new ConfigOptionInts { 4 });
719 
720     def = this->add("filament_cooling_initial_speed", coFloats);
721     def->label = L("Speed of the first cooling move");
722     def->tooltip = L("Cooling moves are gradually accelerating beginning at this speed.");
723     def->sidetext = L("mm/s");
724     def->min = 0;
725     def->mode = comExpert;
726     def->set_default_value(new ConfigOptionFloats { 2.2f });
727 
728     def = this->add("filament_minimal_purge_on_wipe_tower", coFloats);
729     def->label = L("Minimal purge on wipe tower");
730     def->tooltip = L("After a tool change, the exact position of the newly loaded filament inside "
731                      "the nozzle may not be known, and the filament pressure is likely not yet stable. "
732                      "Before purging the print head into an infill or a sacrificial object, Slic3r will always prime "
733                      "this amount of material into the wipe tower to produce successive infill or sacrificial object extrusions reliably.");
734     def->sidetext = L("mm³");
735     def->min = 0;
736     def->mode = comExpert;
737     def->set_default_value(new ConfigOptionFloats { 15.f });
738 
739     def = this->add("filament_cooling_final_speed", coFloats);
740     def->label = L("Speed of the last cooling move");
741     def->tooltip = L("Cooling moves are gradually accelerating towards this speed.");
742     def->sidetext = L("mm/s");
743     def->min = 0;
744     def->mode = comExpert;
745     def->set_default_value(new ConfigOptionFloats { 3.4f });
746 
747     def = this->add("filament_load_time", coFloats);
748     def->label = L("Filament load time");
749     def->tooltip = L("Time for the printer firmware (or the Multi Material Unit 2.0) to load a new filament during a tool change (when executing the T code). This time is added to the total print time by the G-code time estimator.");
750     def->sidetext = L("s");
751     def->min = 0;
752     def->mode = comExpert;
753     def->set_default_value(new ConfigOptionFloats { 0.0f });
754 
755     def = this->add("filament_ramming_parameters", coStrings);
756     def->label = L("Ramming parameters");
757     def->tooltip = L("This string is edited by RammingDialog and contains ramming specific parameters.");
758     def->mode = comExpert;
759     def->set_default_value(new ConfigOptionStrings { "120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0|"
760        " 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6" });
761 
762     def = this->add("filament_unload_time", coFloats);
763     def->label = L("Filament unload time");
764     def->tooltip = L("Time for the printer firmware (or the Multi Material Unit 2.0) to unload a filament during a tool change (when executing the T code). This time is added to the total print time by the G-code time estimator.");
765     def->sidetext = L("s");
766     def->min = 0;
767     def->mode = comExpert;
768     def->set_default_value(new ConfigOptionFloats { 0.0f });
769 
770     def = this->add("filament_diameter", coFloats);
771     def->label = L("Diameter");
772     def->tooltip = L("Enter your filament diameter here. Good precision is required, so use a caliper "
773                    "and do multiple measurements along the filament, then compute the average.");
774     def->sidetext = L("mm");
775     def->min = 0;
776     def->set_default_value(new ConfigOptionFloats { 1.75 });
777 
778     def = this->add("filament_density", coFloats);
779     def->label = L("Density");
780     def->tooltip = L("Enter your filament density here. This is only for statistical information. "
781                    "A decent way is to weigh a known length of filament and compute the ratio "
782                    "of the length to volume. Better is to calculate the volume directly through displacement.");
783     def->sidetext = L("g/cm³");
784     def->min = 0;
785     def->set_default_value(new ConfigOptionFloats { 0. });
786 
787     def = this->add("filament_type", coStrings);
788     def->label = L("Filament type");
789     def->tooltip = L("The filament material type for use in custom G-codes.");
790     def->gui_type = "f_enum_open";
791     def->gui_flags = "show_value";
792     def->enum_values.push_back("PLA");
793     def->enum_values.push_back("PET");
794     def->enum_values.push_back("ABS");
795     def->enum_values.push_back("ASA");
796     def->enum_values.push_back("FLEX");
797     def->enum_values.push_back("HIPS");
798     def->enum_values.push_back("EDGE");
799     def->enum_values.push_back("NGEN");
800     def->enum_values.push_back("NYLON");
801     def->enum_values.push_back("PVA");
802     def->enum_values.push_back("PC");
803     def->enum_values.push_back("PP");
804     def->enum_values.push_back("PEI");
805     def->enum_values.push_back("PEEK");
806     def->enum_values.push_back("PEKK");
807     def->enum_values.push_back("POM");
808     def->enum_values.push_back("PSU");
809     def->enum_values.push_back("PVDF");
810     def->enum_values.push_back("SCAFF");
811 
812     def->mode = comAdvanced;
813     def->set_default_value(new ConfigOptionStrings { "PLA" });
814 
815     def = this->add("filament_soluble", coBools);
816     def->label = L("Soluble material");
817     def->tooltip = L("Soluble material is most likely used for a soluble support.");
818     def->mode = comAdvanced;
819     def->set_default_value(new ConfigOptionBools { false });
820 
821     def = this->add("filament_cost", coFloats);
822     def->label = L("Cost");
823     def->tooltip = L("Enter your filament cost per kg here. This is only for statistical information.");
824     def->sidetext = L("money/kg");
825     def->min = 0;
826     def->set_default_value(new ConfigOptionFloats { 0. });
827 
828     def = this->add("filament_spool_weight", coFloats);
829     def->label = L("Spool weight");
830     def->tooltip = L("Enter weight of the empty filament spool. "
831                      "One may weigh a partially consumed filament spool before printing and one may compare the measured weight "
832                      "with the calculated weight of the filament with the spool to find out whether the amount "
833                      "of filament on the spool is sufficient to finish the print.");
834     def->sidetext = L("g");
835     def->min = 0;
836     def->set_default_value(new ConfigOptionFloats { 0. });
837 
838     def = this->add("filament_settings_id", coStrings);
839     def->set_default_value(new ConfigOptionStrings { "" });
840     def->cli = ConfigOptionDef::nocli;
841 
842     def = this->add("filament_vendor", coString);
843     def->set_default_value(new ConfigOptionString(L("(Unknown)")));
844     def->cli = ConfigOptionDef::nocli;
845 
846     def = this->add("fill_angle", coFloat);
847     def->label = L("Fill angle");
848     def->category = L("Infill");
849     def->tooltip = L("Default base angle for infill orientation. Cross-hatching will be applied to this. "
850                    "Bridges will be infilled using the best direction Slic3r can detect, so this setting "
851                    "does not affect them.");
852     def->sidetext = L("°");
853     def->min = 0;
854     def->max = 360;
855     def->mode = comAdvanced;
856     def->set_default_value(new ConfigOptionFloat(45));
857 
858     def = this->add("fill_density", coPercent);
859     def->gui_type = "f_enum_open";
860     def->gui_flags = "show_value";
861     def->label = L("Fill density");
862     def->category = L("Infill");
863     def->tooltip = L("Density of internal infill, expressed in the range 0% - 100%.");
864     def->sidetext = L("%");
865     def->min = 0;
866     def->max = 100;
867     def->enum_values.push_back("0");
868     def->enum_values.push_back("5");
869     def->enum_values.push_back("10");
870     def->enum_values.push_back("15");
871     def->enum_values.push_back("20");
872     def->enum_values.push_back("25");
873     def->enum_values.push_back("30");
874     def->enum_values.push_back("40");
875     def->enum_values.push_back("50");
876     def->enum_values.push_back("60");
877     def->enum_values.push_back("70");
878     def->enum_values.push_back("80");
879     def->enum_values.push_back("90");
880     def->enum_values.push_back("100");
881     def->enum_labels.push_back("0%");
882     def->enum_labels.push_back("5%");
883     def->enum_labels.push_back("10%");
884     def->enum_labels.push_back("15%");
885     def->enum_labels.push_back("20%");
886     def->enum_labels.push_back("25%");
887     def->enum_labels.push_back("30%");
888     def->enum_labels.push_back("40%");
889     def->enum_labels.push_back("50%");
890     def->enum_labels.push_back("60%");
891     def->enum_labels.push_back("70%");
892     def->enum_labels.push_back("80%");
893     def->enum_labels.push_back("90%");
894     def->enum_labels.push_back("100%");
895     def->set_default_value(new ConfigOptionPercent(20));
896 
897     def = this->add("fill_pattern", coEnum);
898     def->label = L("Fill pattern");
899     def->category = L("Infill");
900     def->tooltip = L("Fill pattern for general low-density infill.");
901     def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
902     def->enum_values.push_back("rectilinear");
903     def->enum_values.push_back("alignedrectilinear");
904     def->enum_values.push_back("grid");
905     def->enum_values.push_back("triangles");
906     def->enum_values.push_back("stars");
907     def->enum_values.push_back("cubic");
908     def->enum_values.push_back("line");
909     def->enum_values.push_back("concentric");
910     def->enum_values.push_back("honeycomb");
911     def->enum_values.push_back("3dhoneycomb");
912     def->enum_values.push_back("gyroid");
913     def->enum_values.push_back("hilbertcurve");
914     def->enum_values.push_back("archimedeanchords");
915     def->enum_values.push_back("octagramspiral");
916     def->enum_values.push_back("adaptivecubic");
917     def->enum_values.push_back("supportcubic");
918     def->enum_labels.push_back(L("Rectilinear"));
919     def->enum_labels.push_back(L("Aligned Rectilinear"));
920     def->enum_labels.push_back(L("Grid"));
921     def->enum_labels.push_back(L("Triangles"));
922     def->enum_labels.push_back(L("Stars"));
923     def->enum_labels.push_back(L("Cubic"));
924     def->enum_labels.push_back(L("Line"));
925     def->enum_labels.push_back(L("Concentric"));
926     def->enum_labels.push_back(L("Honeycomb"));
927     def->enum_labels.push_back(L("3D Honeycomb"));
928     def->enum_labels.push_back(L("Gyroid"));
929     def->enum_labels.push_back(L("Hilbert Curve"));
930     def->enum_labels.push_back(L("Archimedean Chords"));
931     def->enum_labels.push_back(L("Octagram Spiral"));
932     def->enum_labels.push_back(L("Adaptive Cubic"));
933     def->enum_labels.push_back(L("Support Cubic"));
934     def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipStars));
935 
936     def = this->add("first_layer_acceleration", coFloat);
937     def->label = L("First layer");
938     def->tooltip = L("This is the acceleration your printer will use for first layer. Set zero "
939                    "to disable acceleration control for first layer.");
940     def->sidetext = L("mm/s²");
941     def->min = 0;
942     def->mode = comExpert;
943     def->set_default_value(new ConfigOptionFloat(0));
944 
945     def = this->add("first_layer_bed_temperature", coInts);
946     def->label = L("First layer");
947     def->full_label = L("First layer bed temperature");
948     def->tooltip = L("Heated build plate temperature for the first layer. Set this to zero to disable "
949                    "bed temperature control commands in the output.");
950     def->sidetext = L("°C");
951     def->max = 0;
952     def->max = 300;
953     def->set_default_value(new ConfigOptionInts { 0 });
954 
955     def = this->add("first_layer_extrusion_width", coFloatOrPercent);
956     def->label = L("First layer");
957     def->category = L("Extrusion Width");
958     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for first layer. "
959                    "You can use this to force fatter extrudates for better adhesion. If expressed "
960                    "as percentage (for example 120%) it will be computed over first layer height. "
961                    "If set to zero, it will use the default extrusion width.");
962     def->sidetext = L("mm or %");
963     def->ratio_over = "first_layer_height";
964     def->min = 0;
965     def->mode = comAdvanced;
966     def->set_default_value(new ConfigOptionFloatOrPercent(200, true));
967 
968     def = this->add("first_layer_height", coFloatOrPercent);
969     def->label = L("First layer height");
970     def->category = L("Layers and Perimeters");
971     def->tooltip = L("When printing with very low layer heights, you might still want to print a thicker "
972                    "bottom layer to improve adhesion and tolerance for non perfect build plates. "
973                    "This can be expressed as an absolute value or as a percentage (for example: 150%) "
974                    "over the default layer height.");
975     def->sidetext = L("mm or %");
976     def->ratio_over = "layer_height";
977     def->set_default_value(new ConfigOptionFloatOrPercent(0.35, false));
978 
979     def = this->add("first_layer_speed", coFloatOrPercent);
980     def->label = L("First layer speed");
981     def->tooltip = L("If expressed as absolute value in mm/s, this speed will be applied to all the print moves "
982                    "of the first layer, regardless of their type. If expressed as a percentage "
983                    "(for example: 40%) it will scale the default speeds.");
984     def->sidetext = L("mm/s or %");
985     def->min = 0;
986     def->mode = comAdvanced;
987     def->set_default_value(new ConfigOptionFloatOrPercent(30, false));
988 
989     def = this->add("first_layer_temperature", coInts);
990     def->label = L("First layer");
991     def->full_label = L("First layer nozzle temperature");
992     def->tooltip = L("Nozzle temperature for the first layer. If you want to control temperature manually "
993                      "during print, set this to zero to disable temperature control commands in the output G-code.");
994     def->sidetext = L("°C");
995     def->min = 0;
996     def->max = max_temp;
997     def->set_default_value(new ConfigOptionInts { 200 });
998 
999     def = this->add("full_fan_speed_layer", coInts);
1000     def->label = L("Full fan speed at layer");
1001     def->tooltip = L("Fan speed will be ramped up linearly from zero at layer \"disable_fan_first_layers\" "
1002                    "to maximum at layer \"full_fan_speed_layer\". "
1003                    "\"full_fan_speed_layer\" will be ignored if lower than \"disable_fan_first_layers\", in which case "
1004                    "the fan will be running at maximum allowed speed at layer \"disable_fan_first_layers\" + 1.");
1005     def->min = 0;
1006     def->max = 1000;
1007     def->mode = comExpert;
1008     def->set_default_value(new ConfigOptionInts { 0 });
1009 
1010     def = this->add("gap_fill_speed", coFloat);
1011     def->label = L("Gap fill");
1012     def->category = L("Speed");
1013     def->tooltip = L("Speed for filling small gaps using short zigzag moves. Keep this reasonably low "
1014                    "to avoid too much shaking and resonance issues. Set zero to disable gaps filling.");
1015     def->sidetext = L("mm/s");
1016     def->min = 0;
1017     def->mode = comAdvanced;
1018     def->set_default_value(new ConfigOptionFloat(20));
1019 
1020     def = this->add("gcode_comments", coBool);
1021     def->label = L("Verbose G-code");
1022     def->tooltip = L("Enable this to get a commented G-code file, with each line explained by a descriptive text. "
1023                    "If you print from SD card, the additional weight of the file could make your firmware "
1024                    "slow down.");
1025     def->mode = comExpert;
1026     def->set_default_value(new ConfigOptionBool(0));
1027 
1028     def = this->add("gcode_flavor", coEnum);
1029     def->label = L("G-code flavor");
1030     def->tooltip = L("Some G/M-code commands, including temperature control and others, are not universal. "
1031                    "Set this option to your printer's firmware to get a compatible output. "
1032                    "The \"No extrusion\" flavor prevents PrusaSlicer from exporting any extrusion value at all.");
1033     def->enum_keys_map = &ConfigOptionEnum<GCodeFlavor>::get_enum_values();
1034     def->enum_values.push_back("reprap");
1035     def->enum_values.push_back("reprapfirmware");
1036     def->enum_values.push_back("repetier");
1037     def->enum_values.push_back("teacup");
1038     def->enum_values.push_back("makerware");
1039     def->enum_values.push_back("marlin");
1040     def->enum_values.push_back("sailfish");
1041     def->enum_values.push_back("mach3");
1042     def->enum_values.push_back("machinekit");
1043     def->enum_values.push_back("smoothie");
1044     def->enum_values.push_back("no-extrusion");
1045     def->enum_labels.push_back("RepRap/Sprinter");
1046     def->enum_labels.push_back("RepRapFirmware");
1047     def->enum_labels.push_back("Repetier");
1048     def->enum_labels.push_back("Teacup");
1049     def->enum_labels.push_back("MakerWare (MakerBot)");
1050     def->enum_labels.push_back("Marlin");
1051     def->enum_labels.push_back("Sailfish (MakerBot)");
1052     def->enum_labels.push_back("Mach3/LinuxCNC");
1053     def->enum_labels.push_back("Machinekit");
1054     def->enum_labels.push_back("Smoothie");
1055     def->enum_labels.push_back(L("No extrusion"));
1056     def->mode = comExpert;
1057     def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfRepRapSprinter));
1058 
1059     def = this->add("gcode_label_objects", coBool);
1060     def->label = L("Label objects");
1061     def->tooltip = L("Enable this to add comments into the G-Code labeling print moves with what object they belong to,"
1062                    " which is useful for the Octoprint CancelObject plugin. This settings is NOT compatible with "
1063                    "Single Extruder Multi Material setup and Wipe into Object / Wipe into Infill.");
1064     def->mode = comAdvanced;
1065     def->set_default_value(new ConfigOptionBool(0));
1066 
1067     def = this->add("high_current_on_filament_swap", coBool);
1068     def->label = L("High extruder current on filament swap");
1069     def->tooltip = L("It may be beneficial to increase the extruder motor current during the filament exchange"
1070                    " sequence to allow for rapid ramming feed rates and to overcome resistance when loading"
1071                    " a filament with an ugly shaped tip.");
1072     def->mode = comExpert;
1073     def->set_default_value(new ConfigOptionBool(0));
1074 
1075     def = this->add("infill_acceleration", coFloat);
1076     def->label = L("Infill");
1077     def->tooltip = L("This is the acceleration your printer will use for infill. Set zero to disable "
1078                    "acceleration control for infill.");
1079     def->sidetext = L("mm/s²");
1080     def->min = 0;
1081     def->mode = comExpert;
1082     def->set_default_value(new ConfigOptionFloat(0));
1083 
1084     def = this->add("infill_every_layers", coInt);
1085     def->label = L("Combine infill every");
1086     def->category = L("Infill");
1087     def->tooltip = L("This feature allows to combine infill and speed up your print by extruding thicker "
1088                    "infill layers while preserving thin perimeters, thus accuracy.");
1089     def->sidetext = L("layers");
1090     def->full_label = L("Combine infill every n layers");
1091     def->min = 1;
1092     def->mode = comAdvanced;
1093     def->set_default_value(new ConfigOptionInt(1));
1094 
1095     auto def_infill_anchor_min = def = this->add("infill_anchor", coFloatOrPercent);
1096     def->label = L("Length of the infill anchor");
1097     def->category = L("Advanced");
1098     def->tooltip = L("Connect an infill line to an internal perimeter with a short segment of an additional perimeter. "
1099                      "If expressed as percentage (example: 15%) it is calculated over infill extrusion width. "
1100                      "PrusaSlicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment "
1101                      "shorter than infill_anchor_max is found, the infill line is connected to a perimeter segment at just one side "
1102                      "and the length of the perimeter segment taken is limited to this parameter, but no longer than anchor_length_max. "
1103                      "Set this parameter to zero to disable anchoring perimeters connected to a single infill line.");
1104     def->sidetext = L("mm or %");
1105     def->ratio_over = "infill_extrusion_width";
1106     def->gui_type = "f_enum_open";
1107     def->enum_values.push_back("0");
1108     def->enum_values.push_back("1");
1109     def->enum_values.push_back("2");
1110     def->enum_values.push_back("5");
1111     def->enum_values.push_back("10");
1112     def->enum_values.push_back("1000");
1113     def->enum_labels.push_back(L("0 (no open anchors)"));
1114     def->enum_labels.push_back("1 mm");
1115     def->enum_labels.push_back("2 mm");
1116     def->enum_labels.push_back("5 mm");
1117     def->enum_labels.push_back("10 mm");
1118     def->enum_labels.push_back(L("1000 (unlimited)"));
1119     def->mode = comAdvanced;
1120     def->set_default_value(new ConfigOptionFloatOrPercent(600, true));
1121 
1122     def = this->add("infill_anchor_max", coFloatOrPercent);
1123     def->label = L("Maximum length of the infill anchor");
1124     def->category    = def_infill_anchor_min->category;
1125     def->tooltip = L("Connect an infill line to an internal perimeter with a short segment of an additional perimeter. "
1126                      "If expressed as percentage (example: 15%) it is calculated over infill extrusion width. "
1127                      "PrusaSlicer tries to connect two close infill lines to a short perimeter segment. If no such perimeter segment "
1128                      "shorter than this parameter is found, the infill line is connected to a perimeter segment at just one side "
1129                      "and the length of the perimeter segment taken is limited to infill_anchor, but no longer than this parameter. "
1130                      "Set this parameter to zero to disable anchoring.");
1131     def->sidetext    = def_infill_anchor_min->sidetext;
1132     def->ratio_over  = def_infill_anchor_min->ratio_over;
1133     def->gui_type    = def_infill_anchor_min->gui_type;
1134     def->enum_values = def_infill_anchor_min->enum_values;
1135     def->enum_labels.push_back(L("0 (not anchored)"));
1136     def->enum_labels.push_back("1 mm");
1137     def->enum_labels.push_back("2 mm");
1138     def->enum_labels.push_back("5 mm");
1139     def->enum_labels.push_back("10 mm");
1140     def->enum_labels.push_back(L("1000 (unlimited)"));
1141     def->mode        = def_infill_anchor_min->mode;
1142     def->set_default_value(new ConfigOptionFloatOrPercent(50, false));
1143 
1144     def = this->add("infill_extruder", coInt);
1145     def->label = L("Infill extruder");
1146     def->category = L("Extruders");
1147     def->tooltip = L("The extruder to use when printing infill.");
1148     def->min = 1;
1149     def->mode = comAdvanced;
1150     def->set_default_value(new ConfigOptionInt(1));
1151 
1152     def = this->add("infill_extrusion_width", coFloatOrPercent);
1153     def->label = L("Infill");
1154     def->category = L("Extrusion Width");
1155     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for infill. "
1156                    "If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
1157                    "You may want to use fatter extrudates to speed up the infill and make your parts stronger. "
1158                    "If expressed as percentage (for example 90%) it will be computed over layer height.");
1159     def->sidetext = L("mm or %");
1160     def->min = 0;
1161     def->mode = comAdvanced;
1162     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
1163 
1164     def = this->add("infill_first", coBool);
1165     def->label = L("Infill before perimeters");
1166     def->tooltip = L("This option will switch the print order of perimeters and infill, making the latter first.");
1167     def->mode = comExpert;
1168     def->set_default_value(new ConfigOptionBool(false));
1169 
1170     def = this->add("infill_only_where_needed", coBool);
1171     def->label = L("Only infill where needed");
1172     def->category = L("Infill");
1173     def->tooltip = L("This option will limit infill to the areas actually needed for supporting ceilings "
1174                    "(it will act as internal support material). If enabled, slows down the G-code generation "
1175                    "due to the multiple checks involved.");
1176     def->mode = comAdvanced;
1177     def->set_default_value(new ConfigOptionBool(false));
1178 
1179     def = this->add("infill_overlap", coFloatOrPercent);
1180     def->label = L("Infill/perimeters overlap");
1181     def->category = L("Advanced");
1182     def->tooltip = L("This setting applies an additional overlap between infill and perimeters for better bonding. "
1183                    "Theoretically this shouldn't be needed, but backlash might cause gaps. If expressed "
1184                    "as percentage (example: 15%) it is calculated over perimeter extrusion width.");
1185     def->sidetext = L("mm or %");
1186     def->ratio_over = "perimeter_extrusion_width";
1187     def->mode = comExpert;
1188     def->set_default_value(new ConfigOptionFloatOrPercent(25, true));
1189 
1190     def = this->add("infill_speed", coFloat);
1191     def->label = L("Infill");
1192     def->category = L("Speed");
1193     def->tooltip = L("Speed for printing the internal fill. Set to zero for auto.");
1194     def->sidetext = L("mm/s");
1195     def->aliases = { "print_feed_rate", "infill_feed_rate" };
1196     def->min = 0;
1197     def->mode = comAdvanced;
1198     def->set_default_value(new ConfigOptionFloat(80));
1199 
1200     def = this->add("inherits", coString);
1201     def->label = L("Inherits profile");
1202     def->tooltip = L("Name of the profile, from which this profile inherits.");
1203     def->full_width = true;
1204     def->height = 5;
1205     def->set_default_value(new ConfigOptionString());
1206     def->cli = ConfigOptionDef::nocli;
1207 
1208     // The following value is to be stored into the project file (AMF, 3MF, Config ...)
1209     // and it contains a sum of "inherits" values over the print and filament profiles.
1210     def = this->add("inherits_cummulative", coStrings);
1211     def->set_default_value(new ConfigOptionStrings());
1212     def->cli = ConfigOptionDef::nocli;
1213 
1214     def = this->add("interface_shells", coBool);
1215     def->label = L("Interface shells");
1216     def->tooltip = L("Force the generation of solid shells between adjacent materials/volumes. "
1217                    "Useful for multi-extruder prints with translucent materials or manual soluble "
1218                    "support material.");
1219     def->category = L("Layers and Perimeters");
1220     def->mode = comExpert;
1221     def->set_default_value(new ConfigOptionBool(false));
1222 
1223     def = this->add("ironing", coBool);
1224     def->label = L("Enable ironing");
1225     def->tooltip = L("Enable ironing of the top layers with the hot print head for smooth surface");
1226     def->category = L("Ironing");
1227     def->mode = comAdvanced;
1228     def->set_default_value(new ConfigOptionBool(false));
1229 
1230     def = this->add("ironing_type", coEnum);
1231     def->label = L("Ironing Type");
1232     def->category = L("Ironing");
1233     def->tooltip = L("Ironing Type");
1234     def->enum_keys_map = &ConfigOptionEnum<IroningType>::get_enum_values();
1235     def->enum_values.push_back("top");
1236     def->enum_values.push_back("topmost");
1237     def->enum_values.push_back("solid");
1238     def->enum_labels.push_back(L("All top surfaces"));
1239     def->enum_labels.push_back(L("Topmost surface only"));
1240     def->enum_labels.push_back(L("All solid surfaces"));
1241     def->mode = comAdvanced;
1242     def->set_default_value(new ConfigOptionEnum<IroningType>(IroningType::TopSurfaces));
1243 
1244     def = this->add("ironing_flowrate", coPercent);
1245     def->label = L("Flow rate");
1246     def->category = L("Ironing");
1247     def->tooltip = L("Percent of a flow rate relative to object's normal layer height.");
1248     def->sidetext = L("%");
1249     def->ratio_over = "layer_height";
1250     def->min = 0;
1251     def->mode = comExpert;
1252     def->set_default_value(new ConfigOptionPercent(15));
1253 
1254     def = this->add("ironing_spacing", coFloat);
1255     def->label = L("Spacing between ironing passes");
1256     def->category = L("Ironing");
1257     def->tooltip = L("Distance between ironing lines");
1258     def->sidetext = L("mm");
1259     def->min = 0;
1260     def->mode = comExpert;
1261     def->set_default_value(new ConfigOptionFloat(0.1));
1262 
1263     def = this->add("ironing_speed", coFloat);
1264     def->label = L("Ironing");
1265     def->category = L("Speed");
1266     def->tooltip = L("Ironing");
1267     def->sidetext = L("mm/s");
1268     def->min = 0;
1269     def->mode = comAdvanced;
1270     def->set_default_value(new ConfigOptionFloat(15));
1271 
1272     def = this->add("layer_gcode", coString);
1273     def->label = L("After layer change G-code");
1274     def->tooltip = L("This custom code is inserted at every layer change, right after the Z move "
1275                    "and before the extruder moves to the first layer point. Note that you can use "
1276                    "placeholder variables for all Slic3r settings as well as [layer_num] and [layer_z].");
1277     def->cli = "after-layer-gcode|layer-gcode";
1278     def->multiline = true;
1279     def->full_width = true;
1280     def->height = 5;
1281     def->mode = comExpert;
1282     def->set_default_value(new ConfigOptionString(""));
1283 
1284     def = this->add("remaining_times", coBool);
1285     def->label = L("Supports remaining times");
1286     def->tooltip = L("Emit M73 P[percent printed] R[remaining time in minutes] at 1 minute"
1287                      " intervals into the G-code to let the firmware show accurate remaining time."
1288                      " As of now only the Prusa i3 MK3 firmware recognizes M73."
1289                      " Also the i3 MK3 firmware supports M73 Qxx Sxx for the silent mode.");
1290     def->mode = comExpert;
1291     def->set_default_value(new ConfigOptionBool(false));
1292 
1293     def = this->add("silent_mode", coBool);
1294     def->label = L("Supports stealth mode");
1295     def->tooltip = L("The firmware supports stealth mode");
1296     def->mode = comExpert;
1297     def->set_default_value(new ConfigOptionBool(true));
1298 
1299     def = this->add("machine_limits_usage", coEnum);
1300     def->label = L("How to apply limits");
1301     def->full_label = L("Purpose of Machine Limits");
1302     def->category = L("Machine limits");
1303     def->tooltip = L("How to apply the Machine Limits");
1304     def->enum_keys_map = &ConfigOptionEnum<MachineLimitsUsage>::get_enum_values();
1305     def->enum_values.push_back("emit_to_gcode");
1306     def->enum_values.push_back("time_estimate_only");
1307     def->enum_values.push_back("ignore");
1308     def->enum_labels.push_back(L("Emit to G-code"));
1309     def->enum_labels.push_back(L("Use for time estimate"));
1310     def->enum_labels.push_back(L("Ignore"));
1311     def->mode = comAdvanced;
1312     def->set_default_value(new ConfigOptionEnum<MachineLimitsUsage>(MachineLimitsUsage::EmitToGCode));
1313 
1314     {
1315         struct AxisDefault {
1316             std::string         name;
1317             std::vector<double> max_feedrate;
1318             std::vector<double> max_acceleration;
1319             std::vector<double> max_jerk;
1320         };
1321         std::vector<AxisDefault> axes {
1322             // name, max_feedrate,  max_acceleration, max_jerk
1323             { "x", { 500., 200. }, {  9000., 1000. }, { 10. , 10.  } },
1324             { "y", { 500., 200. }, {  9000., 1000. }, { 10. , 10.  } },
1325             { "z", {  12.,  12. }, {   500.,  200. }, {  0.2,  0.4 } },
1326             { "e", { 120., 120. }, { 10000., 5000. }, {  2.5,  2.5 } }
1327         };
1328         for (const AxisDefault &axis : axes) {
1329             std::string axis_upper = boost::to_upper_copy<std::string>(axis.name);
1330             // Add the machine feedrate limits for XYZE axes. (M203)
1331             def = this->add("machine_max_feedrate_" + axis.name, coFloats);
1332             def->full_label = (boost::format("Maximum feedrate %1%") % axis_upper).str();
1333             (void)L("Maximum feedrate X");
1334             (void)L("Maximum feedrate Y");
1335             (void)L("Maximum feedrate Z");
1336             (void)L("Maximum feedrate E");
1337             def->category = L("Machine limits");
1338             def->tooltip  = (boost::format("Maximum feedrate of the %1% axis") % axis_upper).str();
1339             (void)L("Maximum feedrate of the X axis");
1340             (void)L("Maximum feedrate of the Y axis");
1341             (void)L("Maximum feedrate of the Z axis");
1342             (void)L("Maximum feedrate of the E axis");
1343             def->sidetext = L("mm/s");
1344             def->min = 0;
1345             def->mode = comAdvanced;
1346             def->set_default_value(new ConfigOptionFloats(axis.max_feedrate));
1347             // Add the machine acceleration limits for XYZE axes (M201)
1348             def = this->add("machine_max_acceleration_" + axis.name, coFloats);
1349             def->full_label = (boost::format("Maximum acceleration %1%") % axis_upper).str();
1350             (void)L("Maximum acceleration X");
1351             (void)L("Maximum acceleration Y");
1352             (void)L("Maximum acceleration Z");
1353             (void)L("Maximum acceleration E");
1354             def->category = L("Machine limits");
1355             def->tooltip  = (boost::format("Maximum acceleration of the %1% axis") % axis_upper).str();
1356             (void)L("Maximum acceleration of the X axis");
1357             (void)L("Maximum acceleration of the Y axis");
1358             (void)L("Maximum acceleration of the Z axis");
1359             (void)L("Maximum acceleration of the E axis");
1360             def->sidetext = L("mm/s²");
1361             def->min = 0;
1362             def->mode = comAdvanced;
1363             def->set_default_value(new ConfigOptionFloats(axis.max_acceleration));
1364             // Add the machine jerk limits for XYZE axes (M205)
1365             def = this->add("machine_max_jerk_" + axis.name, coFloats);
1366             def->full_label = (boost::format("Maximum jerk %1%") % axis_upper).str();
1367             (void)L("Maximum jerk X");
1368             (void)L("Maximum jerk Y");
1369             (void)L("Maximum jerk Z");
1370             (void)L("Maximum jerk E");
1371             def->category = L("Machine limits");
1372             def->tooltip  = (boost::format("Maximum jerk of the %1% axis") % axis_upper).str();
1373             (void)L("Maximum jerk of the X axis");
1374             (void)L("Maximum jerk of the Y axis");
1375             (void)L("Maximum jerk of the Z axis");
1376             (void)L("Maximum jerk of the E axis");
1377             def->sidetext = L("mm/s");
1378             def->min = 0;
1379             def->mode = comAdvanced;
1380             def->set_default_value(new ConfigOptionFloats(axis.max_jerk));
1381         }
1382     }
1383 
1384     // M205 S... [mm/sec]
1385     def = this->add("machine_min_extruding_rate", coFloats);
1386     def->full_label = L("Minimum feedrate when extruding");
1387     def->category = L("Machine limits");
1388     def->tooltip = L("Minimum feedrate when extruding (M205 S)");
1389     def->sidetext = L("mm/s");
1390     def->min = 0;
1391     def->mode = comAdvanced;
1392     def->set_default_value(new ConfigOptionFloats{ 0., 0. });
1393 
1394     // M205 T... [mm/sec]
1395     def = this->add("machine_min_travel_rate", coFloats);
1396     def->full_label = L("Minimum travel feedrate");
1397     def->category = L("Machine limits");
1398     def->tooltip = L("Minimum travel feedrate (M205 T)");
1399     def->sidetext = L("mm/s");
1400     def->min = 0;
1401     def->mode = comAdvanced;
1402     def->set_default_value(new ConfigOptionFloats{ 0., 0. });
1403 
1404     // M204 S... [mm/sec^2]
1405     def = this->add("machine_max_acceleration_extruding", coFloats);
1406     def->full_label = L("Maximum acceleration when extruding");
1407     def->category = L("Machine limits");
1408     def->tooltip = L("Maximum acceleration when extruding (M204 S)");
1409     def->sidetext = L("mm/s²");
1410     def->min = 0;
1411     def->mode = comAdvanced;
1412     def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
1413 
1414     // M204 T... [mm/sec^2]
1415     def = this->add("machine_max_acceleration_retracting", coFloats);
1416     def->full_label = L("Maximum acceleration when retracting");
1417     def->category = L("Machine limits");
1418     def->tooltip = L("Maximum acceleration when retracting (M204 T)");
1419     def->sidetext = L("mm/s²");
1420     def->min = 0;
1421     def->mode = comAdvanced;
1422     def->set_default_value(new ConfigOptionFloats{ 1500., 1250. });
1423 
1424     def = this->add("max_fan_speed", coInts);
1425     def->label = L("Max");
1426     def->tooltip = L("This setting represents the maximum speed of your fan.");
1427     def->sidetext = L("%");
1428     def->min = 0;
1429     def->max = 100;
1430     def->mode = comExpert;
1431     def->set_default_value(new ConfigOptionInts { 100 });
1432 
1433     def = this->add("max_layer_height", coFloats);
1434     def->label = L("Max");
1435     def->tooltip = L("This is the highest printable layer height for this extruder, used to cap "
1436                    "the variable layer height and support layer height. Maximum recommended layer height "
1437                    "is 75% of the extrusion width to achieve reasonable inter-layer adhesion. "
1438                    "If set to 0, layer height is limited to 75% of the nozzle diameter.");
1439     def->sidetext = L("mm");
1440     def->min = 0;
1441     def->mode = comAdvanced;
1442     def->set_default_value(new ConfigOptionFloats { 0. });
1443 
1444     def = this->add("max_print_speed", coFloat);
1445     def->label = L("Max print speed");
1446     def->tooltip = L("When setting other speed settings to 0 Slic3r will autocalculate the optimal speed "
1447                    "in order to keep constant extruder pressure. This experimental setting is used "
1448                    "to set the highest print speed you want to allow.");
1449     def->sidetext = L("mm/s");
1450     def->min = 1;
1451     def->mode = comExpert;
1452     def->set_default_value(new ConfigOptionFloat(80));
1453 
1454     def = this->add("max_volumetric_speed", coFloat);
1455     def->label = L("Max volumetric speed");
1456     def->tooltip = L("This experimental setting is used to set the maximum volumetric speed your "
1457                    "extruder supports.");
1458     def->sidetext = L("mm³/s");
1459     def->min = 0;
1460     def->mode = comExpert;
1461     def->set_default_value(new ConfigOptionFloat(0));
1462 
1463 #ifdef HAS_PRESSURE_EQUALIZER
1464     def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat);
1465     def->label = L("Max volumetric slope positive");
1466     def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. "
1467                    "A value of 1.8 mm³/s² ensures, that a change from the extrusion rate "
1468                    "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) "
1469                    "to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds.");
1470     def->sidetext = L("mm³/s²");
1471     def->min = 0;
1472     def->mode = comExpert;
1473     def->set_default_value(new ConfigOptionFloat(0));
1474 
1475     def = this->add("max_volumetric_extrusion_rate_slope_negative", coFloat);
1476     def->label = L("Max volumetric slope negative");
1477     def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. "
1478                    "A value of 1.8 mm³/s² ensures, that a change from the extrusion rate "
1479                    "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) "
1480                    "to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds.");
1481     def->sidetext = L("mm³/s²");
1482     def->min = 0;
1483     def->mode = comExpert;
1484     def->set_default_value(new ConfigOptionFloat(0));
1485 #endif /* HAS_PRESSURE_EQUALIZER */
1486 
1487     def = this->add("min_fan_speed", coInts);
1488     def->label = L("Min");
1489     def->tooltip = L("This setting represents the minimum PWM your fan needs to work.");
1490     def->sidetext = L("%");
1491     def->min = 0;
1492     def->max = 100;
1493     def->mode = comExpert;
1494     def->set_default_value(new ConfigOptionInts { 35 });
1495 
1496     def = this->add("min_layer_height", coFloats);
1497     def->label = L("Min");
1498     def->tooltip = L("This is the lowest printable layer height for this extruder and limits "
1499                    "the resolution for variable layer height. Typical values are between 0.05 mm and 0.1 mm.");
1500     def->sidetext = L("mm");
1501     def->min = 0;
1502     def->mode = comAdvanced;
1503     def->set_default_value(new ConfigOptionFloats { 0.07 });
1504 
1505     def = this->add("min_print_speed", coFloats);
1506     def->label = L("Min print speed");
1507     def->tooltip = L("Slic3r will not scale speed down below this speed.");
1508     def->sidetext = L("mm/s");
1509     def->min = 0;
1510     def->mode = comExpert;
1511     def->set_default_value(new ConfigOptionFloats { 10. });
1512 
1513     def = this->add("min_skirt_length", coFloat);
1514     def->label = L("Minimal filament extrusion length");
1515     def->tooltip = L("Generate no less than the number of skirt loops required to consume "
1516                    "the specified amount of filament on the bottom layer. For multi-extruder machines, "
1517                    "this minimum applies to each extruder.");
1518     def->sidetext = L("mm");
1519     def->min = 0;
1520     def->mode = comExpert;
1521     def->set_default_value(new ConfigOptionFloat(0));
1522 
1523     def = this->add("notes", coString);
1524     def->label = L("Configuration notes");
1525     def->tooltip = L("You can put here your personal notes. This text will be added to the G-code "
1526                    "header comments.");
1527     def->multiline = true;
1528     def->full_width = true;
1529     def->height = 13;
1530     def->mode = comAdvanced;
1531     def->set_default_value(new ConfigOptionString(""));
1532 
1533     def = this->add("nozzle_diameter", coFloats);
1534     def->label = L("Nozzle diameter");
1535     def->tooltip = L("This is the diameter of your extruder nozzle (for example: 0.5, 0.35 etc.)");
1536     def->sidetext = L("mm");
1537     def->set_default_value(new ConfigOptionFloats { 0.4 });
1538 
1539     def = this->add("host_type", coEnum);
1540     def->label = L("Host Type");
1541     def->tooltip = L("Slic3r can upload G-code files to a printer host. This field must contain "
1542                    "the kind of the host.");
1543     def->enum_keys_map = &ConfigOptionEnum<PrintHostType>::get_enum_values();
1544     def->enum_values.push_back("prusalink");
1545     def->enum_values.push_back("octoprint");
1546     def->enum_values.push_back("duet");
1547     def->enum_values.push_back("flashair");
1548     def->enum_values.push_back("astrobox");
1549     def->enum_values.push_back("repetier");
1550     def->enum_labels.push_back("PrusaLink");
1551     def->enum_labels.push_back("OctoPrint");
1552     def->enum_labels.push_back("Duet");
1553     def->enum_labels.push_back("FlashAir");
1554     def->enum_labels.push_back("AstroBox");
1555     def->enum_labels.push_back("Repetier");
1556     def->mode = comAdvanced;
1557     def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));
1558 
1559     def = this->add("only_retract_when_crossing_perimeters", coBool);
1560     def->label = L("Only retract when crossing perimeters");
1561     def->tooltip = L("Disables retraction when the travel path does not exceed the upper layer's perimeters "
1562                    "(and thus any ooze will be probably invisible).");
1563     def->mode = comExpert;
1564     def->set_default_value(new ConfigOptionBool(true));
1565 
1566     def = this->add("ooze_prevention", coBool);
1567     def->label = L("Enable");
1568     def->tooltip = L("This option will drop the temperature of the inactive extruders to prevent oozing. "
1569                    "It will enable a tall skirt automatically and move extruders outside such "
1570                    "skirt when changing temperatures.");
1571     def->mode = comExpert;
1572     def->set_default_value(new ConfigOptionBool(false));
1573 
1574     def = this->add("output_filename_format", coString);
1575     def->label = L("Output filename format");
1576     def->tooltip = L("You can use all configuration options as variables inside this template. "
1577                    "For example: [layer_height], [fill_density] etc. You can also use [timestamp], "
1578                    "[year], [month], [day], [hour], [minute], [second], [version], [input_filename], "
1579                    "[input_filename_base].");
1580     def->full_width = true;
1581     def->mode = comExpert;
1582     def->set_default_value(new ConfigOptionString("[input_filename_base].gcode"));
1583 
1584     def = this->add("overhangs", coBool);
1585     def->label = L("Detect bridging perimeters");
1586     def->category = L("Layers and Perimeters");
1587     def->tooltip = L("Experimental option to adjust flow for overhangs (bridge flow will be used), "
1588                    "to apply bridge speed to them and enable fan.");
1589     def->mode = comAdvanced;
1590     def->set_default_value(new ConfigOptionBool(true));
1591 
1592     def = this->add("parking_pos_retraction", coFloat);
1593     def->label = L("Filament parking position");
1594     def->tooltip = L("Distance of the extruder tip from the position where the filament is parked "
1595                       "when unloaded. This should match the value in printer firmware.");
1596     def->sidetext = L("mm");
1597     def->min = 0;
1598     def->mode = comAdvanced;
1599     def->set_default_value(new ConfigOptionFloat(92.f));
1600 
1601     def = this->add("extra_loading_move", coFloat);
1602     def->label = L("Extra loading distance");
1603     def->tooltip = L("When set to zero, the distance the filament is moved from parking position during load "
1604                       "is exactly the same as it was moved back during unload. When positive, it is loaded further, "
1605                       " if negative, the loading move is shorter than unloading.");
1606     def->sidetext = L("mm");
1607     def->mode = comAdvanced;
1608     def->set_default_value(new ConfigOptionFloat(-2.f));
1609 
1610     def = this->add("perimeter_acceleration", coFloat);
1611     def->label = L("Perimeters");
1612     def->tooltip = L("This is the acceleration your printer will use for perimeters. "
1613                      "Set zero to disable acceleration control for perimeters.");
1614     def->sidetext = L("mm/s²");
1615     def->mode = comExpert;
1616     def->set_default_value(new ConfigOptionFloat(0));
1617 
1618     def = this->add("perimeter_extruder", coInt);
1619     def->label = L("Perimeter extruder");
1620     def->category = L("Extruders");
1621     def->tooltip = L("The extruder to use when printing perimeters and brim. First extruder is 1.");
1622     def->aliases = { "perimeters_extruder" };
1623     def->min = 1;
1624     def->mode = comAdvanced;
1625     def->set_default_value(new ConfigOptionInt(1));
1626 
1627     def = this->add("perimeter_extrusion_width", coFloatOrPercent);
1628     def->label = L("Perimeters");
1629     def->category = L("Extrusion Width");
1630     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for perimeters. "
1631                    "You may want to use thinner extrudates to get more accurate surfaces. "
1632                    "If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
1633                    "If expressed as percentage (for example 200%) it will be computed over layer height.");
1634     def->sidetext = L("mm or %");
1635     def->aliases = { "perimeters_extrusion_width" };
1636     def->min = 0;
1637     def->mode = comAdvanced;
1638     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
1639 
1640     def = this->add("perimeter_speed", coFloat);
1641     def->label = L("Perimeters");
1642     def->category = L("Speed");
1643     def->tooltip = L("Speed for perimeters (contours, aka vertical shells). Set to zero for auto.");
1644     def->sidetext = L("mm/s");
1645     def->aliases = { "perimeter_feed_rate" };
1646     def->min = 0;
1647     def->mode = comAdvanced;
1648     def->set_default_value(new ConfigOptionFloat(60));
1649 
1650     def = this->add("perimeters", coInt);
1651     def->label = L("Perimeters");
1652     def->category = L("Layers and Perimeters");
1653     def->tooltip = L("This option sets the number of perimeters to generate for each layer. "
1654                    "Note that Slic3r may increase this number automatically when it detects "
1655                    "sloping surfaces which benefit from a higher number of perimeters "
1656                    "if the Extra Perimeters option is enabled.");
1657     def->sidetext = L("(minimum)");
1658     def->aliases = { "perimeter_offsets" };
1659     def->min = 0;
1660     def->max = 10000;
1661     def->set_default_value(new ConfigOptionInt(3));
1662 
1663     def = this->add("post_process", coStrings);
1664     def->label = L("Post-processing scripts");
1665     def->tooltip = L("If you want to process the output G-code through custom scripts, "
1666                    "just list their absolute paths here. Separate multiple scripts with a semicolon. "
1667                    "Scripts will be passed the absolute path to the G-code file as the first argument, "
1668                    "and they can access the Slic3r config settings by reading environment variables.");
1669     def->gui_flags = "serialized";
1670     def->multiline = true;
1671     def->full_width = true;
1672     def->height = 6;
1673     def->mode = comExpert;
1674     def->set_default_value(new ConfigOptionStrings());
1675 
1676     def = this->add("printer_model", coString);
1677     def->label = L("Printer type");
1678     def->tooltip = L("Type of the printer.");
1679     def->set_default_value(new ConfigOptionString());
1680     def->cli = ConfigOptionDef::nocli;
1681 
1682     def = this->add("printer_notes", coString);
1683     def->label = L("Printer notes");
1684     def->tooltip = L("You can put your notes regarding the printer here.");
1685     def->multiline = true;
1686     def->full_width = true;
1687     def->height = 13;
1688     def->mode = comAdvanced;
1689     def->set_default_value(new ConfigOptionString(""));
1690 
1691     def = this->add("printer_vendor", coString);
1692     def->label = L("Printer vendor");
1693     def->tooltip = L("Name of the printer vendor.");
1694     def->set_default_value(new ConfigOptionString());
1695     def->cli = ConfigOptionDef::nocli;
1696 
1697     def = this->add("printer_variant", coString);
1698     def->label = L("Printer variant");
1699     def->tooltip = L("Name of the printer variant. For example, the printer variants may be differentiated by a nozzle diameter.");
1700     def->set_default_value(new ConfigOptionString());
1701     def->cli = ConfigOptionDef::nocli;
1702 
1703     def = this->add("print_settings_id", coString);
1704     def->set_default_value(new ConfigOptionString(""));
1705     def->cli = ConfigOptionDef::nocli;
1706 
1707     def = this->add("printer_settings_id", coString);
1708     def->set_default_value(new ConfigOptionString(""));
1709     def->cli = ConfigOptionDef::nocli;
1710 
1711     def = this->add("physical_printer_settings_id", coString);
1712     def->set_default_value(new ConfigOptionString(""));
1713     def->cli = ConfigOptionDef::nocli;
1714 
1715     def = this->add("raft_layers", coInt);
1716     def->label = L("Raft layers");
1717     def->category = L("Support material");
1718     def->tooltip = L("The object will be raised by this number of layers, and support material "
1719                    "will be generated under it.");
1720     def->sidetext = L("layers");
1721     def->min = 0;
1722     def->mode = comAdvanced;
1723     def->set_default_value(new ConfigOptionInt(0));
1724 
1725     def = this->add("resolution", coFloat);
1726     def->label = L("Resolution");
1727     def->tooltip = L("Minimum detail resolution, used to simplify the input file for speeding up "
1728                    "the slicing job and reducing memory usage. High-resolution models often carry "
1729                    "more detail than printers can render. Set to zero to disable any simplification "
1730                    "and use full resolution from input.");
1731     def->sidetext = L("mm");
1732     def->min = 0;
1733     def->mode = comExpert;
1734     def->set_default_value(new ConfigOptionFloat(0));
1735 
1736     def = this->add("retract_before_travel", coFloats);
1737     def->label = L("Minimum travel after retraction");
1738     def->tooltip = L("Retraction is not triggered when travel moves are shorter than this length.");
1739     def->sidetext = L("mm");
1740     def->mode = comAdvanced;
1741     def->set_default_value(new ConfigOptionFloats { 2. });
1742 
1743     def = this->add("retract_before_wipe", coPercents);
1744     def->label = L("Retract amount before wipe");
1745     def->tooltip = L("With bowden extruders, it may be wise to do some amount of quick retract "
1746                    "before doing the wipe movement.");
1747     def->sidetext = L("%");
1748     def->mode = comAdvanced;
1749     def->set_default_value(new ConfigOptionPercents { 0. });
1750 
1751     def = this->add("retract_layer_change", coBools);
1752     def->label = L("Retract on layer change");
1753     def->tooltip = L("This flag enforces a retraction whenever a Z move is done.");
1754     def->mode = comAdvanced;
1755     def->set_default_value(new ConfigOptionBools { false });
1756 
1757     def = this->add("retract_length", coFloats);
1758     def->label = L("Length");
1759     def->full_label = L("Retraction Length");
1760     def->tooltip = L("When retraction is triggered, filament is pulled back by the specified amount "
1761                    "(the length is measured on raw filament, before it enters the extruder).");
1762     def->sidetext = L("mm (zero to disable)");
1763     def->set_default_value(new ConfigOptionFloats { 2. });
1764 
1765     def = this->add("retract_length_toolchange", coFloats);
1766     def->label = L("Length");
1767     def->full_label = L("Retraction Length (Toolchange)");
1768     def->tooltip = L("When retraction is triggered before changing tool, filament is pulled back "
1769                    "by the specified amount (the length is measured on raw filament, before it enters "
1770                    "the extruder).");
1771     def->sidetext = L("mm (zero to disable)");
1772     def->mode = comExpert;
1773     def->set_default_value(new ConfigOptionFloats { 10. });
1774 
1775     def = this->add("retract_lift", coFloats);
1776     def->label = L("Lift Z");
1777     def->tooltip = L("If you set this to a positive value, Z is quickly raised every time a retraction "
1778                    "is triggered. When using multiple extruders, only the setting for the first extruder "
1779                    "will be considered.");
1780     def->sidetext = L("mm");
1781     def->set_default_value(new ConfigOptionFloats { 0. });
1782 
1783     def = this->add("retract_lift_above", coFloats);
1784     def->label = L("Above Z");
1785     def->full_label = L("Only lift Z above");
1786     def->tooltip = L("If you set this to a positive value, Z lift will only take place above the specified "
1787                    "absolute Z. You can tune this setting for skipping lift on the first layers.");
1788     def->sidetext = L("mm");
1789     def->mode = comAdvanced;
1790     def->set_default_value(new ConfigOptionFloats { 0. });
1791 
1792     def = this->add("retract_lift_below", coFloats);
1793     def->label = L("Below Z");
1794     def->full_label = L("Only lift Z below");
1795     def->tooltip = L("If you set this to a positive value, Z lift will only take place below "
1796                    "the specified absolute Z. You can tune this setting for limiting lift "
1797                    "to the first layers.");
1798     def->sidetext = L("mm");
1799     def->mode = comAdvanced;
1800     def->set_default_value(new ConfigOptionFloats { 0. });
1801 
1802     def = this->add("retract_restart_extra", coFloats);
1803     def->label = L("Extra length on restart");
1804     def->tooltip = L("When the retraction is compensated after the travel move, the extruder will push "
1805                    "this additional amount of filament. This setting is rarely needed.");
1806     def->sidetext = L("mm");
1807     def->mode = comAdvanced;
1808     def->set_default_value(new ConfigOptionFloats { 0. });
1809 
1810     def = this->add("retract_restart_extra_toolchange", coFloats);
1811     def->label = L("Extra length on restart");
1812     def->tooltip = L("When the retraction is compensated after changing tool, the extruder will push "
1813                    "this additional amount of filament.");
1814     def->sidetext = L("mm");
1815     def->mode = comExpert;
1816     def->set_default_value(new ConfigOptionFloats { 0. });
1817 
1818     def = this->add("retract_speed", coFloats);
1819     def->label = L("Retraction Speed");
1820     def->full_label = L("Retraction Speed");
1821     def->tooltip = L("The speed for retractions (it only applies to the extruder motor).");
1822     def->sidetext = L("mm/s");
1823     def->mode = comAdvanced;
1824     def->set_default_value(new ConfigOptionFloats { 40. });
1825 
1826     def = this->add("deretract_speed", coFloats);
1827     def->label = L("Deretraction Speed");
1828     def->full_label = L("Deretraction Speed");
1829     def->tooltip = L("The speed for loading of a filament into extruder after retraction "
1830                    "(it only applies to the extruder motor). If left to zero, the retraction speed is used.");
1831     def->sidetext = L("mm/s");
1832     def->mode = comAdvanced;
1833     def->set_default_value(new ConfigOptionFloats { 0. });
1834 
1835     def = this->add("seam_position", coEnum);
1836     def->label = L("Seam position");
1837     def->category = L("Layers and Perimeters");
1838     def->tooltip = L("Position of perimeters starting points.");
1839     def->enum_keys_map = &ConfigOptionEnum<SeamPosition>::get_enum_values();
1840     def->enum_values.push_back("random");
1841     def->enum_values.push_back("nearest");
1842     def->enum_values.push_back("aligned");
1843     def->enum_values.push_back("rear");
1844     def->enum_labels.push_back(L("Random"));
1845     def->enum_labels.push_back(L("Nearest"));
1846     def->enum_labels.push_back(L("Aligned"));
1847     def->enum_labels.push_back(L("Rear"));
1848     def->mode = comSimple;
1849     def->set_default_value(new ConfigOptionEnum<SeamPosition>(spAligned));
1850 
1851 #if 0
1852     def = this->add("seam_preferred_direction", coFloat);
1853 //    def->gui_type = "slider";
1854     def->label = L("Direction");
1855     def->sidetext = L("°");
1856     def->full_label = L("Preferred direction of the seam");
1857     def->tooltip = L("Seam preferred direction");
1858     def->min = 0;
1859     def->max = 360;
1860     def->set_default_value(new ConfigOptionFloat(0));
1861 
1862     def = this->add("seam_preferred_direction_jitter", coFloat);
1863 //    def->gui_type = "slider";
1864     def->label = L("Jitter");
1865     def->sidetext = L("°");
1866     def->full_label = L("Seam preferred direction jitter");
1867     def->tooltip = L("Preferred direction of the seam - jitter");
1868     def->min = 0;
1869     def->max = 360;
1870     def->set_default_value(new ConfigOptionFloat(30));
1871 #endif
1872 
1873     def = this->add("skirt_distance", coFloat);
1874     def->label = L("Distance from object");
1875     def->tooltip = L("Distance between skirt and object(s). Set this to zero to attach the skirt "
1876                    "to the object(s) and get a brim for better adhesion.");
1877     def->sidetext = L("mm");
1878     def->min = 0;
1879     def->set_default_value(new ConfigOptionFloat(6));
1880 
1881     def = this->add("skirt_height", coInt);
1882     def->label = L("Skirt height");
1883     def->tooltip = L("Height of skirt expressed in layers. Set this to a tall value to use skirt "
1884                    "as a shield against drafts.");
1885     def->sidetext = L("layers");
1886     def->mode = comAdvanced;
1887     def->set_default_value(new ConfigOptionInt(1));
1888 
1889     def = this->add("draft_shield", coBool);
1890     def->label = L("Draft shield");
1891     def->tooltip = L("If enabled, the skirt will be as tall as a highest printed object. "
1892     				 "This is useful to protect an ABS or ASA print from warping and detaching from print bed due to wind draft.");
1893     def->mode = comAdvanced;
1894     def->set_default_value(new ConfigOptionBool(false));
1895 
1896     def = this->add("skirts", coInt);
1897     def->label = L("Loops (minimum)");
1898     def->full_label = L("Skirt Loops");
1899     def->tooltip = L("Number of loops for the skirt. If the Minimum Extrusion Length option is set, "
1900                    "the number of loops might be greater than the one configured here. Set this to zero "
1901                    "to disable skirt completely.");
1902     def->min = 0;
1903     def->mode = comAdvanced;
1904     def->set_default_value(new ConfigOptionInt(1));
1905 
1906     def = this->add("slowdown_below_layer_time", coInts);
1907     def->label = L("Slow down if layer print time is below");
1908     def->tooltip = L("If layer print time is estimated below this number of seconds, print moves "
1909                    "speed will be scaled down to extend duration to this value.");
1910     def->sidetext = L("approximate seconds");
1911     def->min = 0;
1912     def->max = 1000;
1913     def->mode = comExpert;
1914     def->set_default_value(new ConfigOptionInts { 5 });
1915 
1916     def = this->add("small_perimeter_speed", coFloatOrPercent);
1917     def->label = L("Small perimeters");
1918     def->category = L("Speed");
1919     def->tooltip = L("This separate setting will affect the speed of perimeters having radius <= 6.5mm "
1920                    "(usually holes). If expressed as percentage (for example: 80%) it will be calculated "
1921                    "on the perimeters speed setting above. Set to zero for auto.");
1922     def->sidetext = L("mm/s or %");
1923     def->ratio_over = "perimeter_speed";
1924     def->min = 0;
1925     def->mode = comAdvanced;
1926     def->set_default_value(new ConfigOptionFloatOrPercent(15, false));
1927 
1928     def = this->add("solid_infill_below_area", coFloat);
1929     def->label = L("Solid infill threshold area");
1930     def->category = L("Infill");
1931     def->tooltip = L("Force solid infill for regions having a smaller area than the specified threshold.");
1932     def->sidetext = L("mm²");
1933     def->min = 0;
1934     def->mode = comExpert;
1935     def->set_default_value(new ConfigOptionFloat(70));
1936 
1937     def = this->add("solid_infill_extruder", coInt);
1938     def->label = L("Solid infill extruder");
1939     def->category = L("Extruders");
1940     def->tooltip = L("The extruder to use when printing solid infill.");
1941     def->min = 1;
1942     def->mode = comAdvanced;
1943     def->set_default_value(new ConfigOptionInt(1));
1944 
1945     def = this->add("solid_infill_every_layers", coInt);
1946     def->label = L("Solid infill every");
1947     def->category = L("Infill");
1948     def->tooltip = L("This feature allows to force a solid layer every given number of layers. "
1949                    "Zero to disable. You can set this to any value (for example 9999); "
1950                    "Slic3r will automatically choose the maximum possible number of layers "
1951                    "to combine according to nozzle diameter and layer height.");
1952     def->sidetext = L("layers");
1953     def->min = 0;
1954     def->mode = comExpert;
1955     def->set_default_value(new ConfigOptionInt(0));
1956 
1957     def = this->add("solid_infill_extrusion_width", coFloatOrPercent);
1958     def->label = L("Solid infill");
1959     def->category = L("Extrusion Width");
1960     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for infill for solid surfaces. "
1961                    "If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
1962                    "If expressed as percentage (for example 90%) it will be computed over layer height.");
1963     def->sidetext = L("mm or %");
1964     def->min = 0;
1965     def->mode = comAdvanced;
1966     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
1967 
1968     def = this->add("solid_infill_speed", coFloatOrPercent);
1969     def->label = L("Solid infill");
1970     def->category = L("Speed");
1971     def->tooltip = L("Speed for printing solid regions (top/bottom/internal horizontal shells). "
1972                    "This can be expressed as a percentage (for example: 80%) over the default "
1973                    "infill speed above. Set to zero for auto.");
1974     def->sidetext = L("mm/s or %");
1975     def->ratio_over = "infill_speed";
1976     def->aliases = { "solid_infill_feed_rate" };
1977     def->min = 0;
1978     def->mode = comAdvanced;
1979     def->set_default_value(new ConfigOptionFloatOrPercent(20, false));
1980 
1981     def = this->add("solid_layers", coInt);
1982     def->label = L("Solid layers");
1983     def->tooltip = L("Number of solid layers to generate on top and bottom surfaces.");
1984     def->shortcut.push_back("top_solid_layers");
1985     def->shortcut.push_back("bottom_solid_layers");
1986     def->min = 0;
1987 
1988     def = this->add("solid_min_thickness", coFloat);
1989     def->label = L("Minimum thickness of a top / bottom shell");
1990     def->tooltip = L("Minimum thickness of a top / bottom shell");
1991     def->shortcut.push_back("top_solid_min_thickness");
1992     def->shortcut.push_back("bottom_solid_min_thickness");
1993     def->min = 0;
1994 
1995     def = this->add("spiral_vase", coBool);
1996     def->label = L("Spiral vase");
1997     def->tooltip = L("This feature will raise Z gradually while printing a single-walled object "
1998                    "in order to remove any visible seam. This option requires a single perimeter, "
1999                    "no infill, no top solid layers and no support material. You can still set "
2000                    "any number of bottom solid layers as well as skirt/brim loops. "
2001                    "It won't work when printing more than one single object.");
2002     def->set_default_value(new ConfigOptionBool(false));
2003 
2004     def = this->add("standby_temperature_delta", coInt);
2005     def->label = L("Temperature variation");
2006     def->tooltip = L("Temperature difference to be applied when an extruder is not active. "
2007                    "Enables a full-height \"sacrificial\" skirt on which the nozzles are periodically wiped.");
2008     def->sidetext = "∆°C";
2009     def->min = -max_temp;
2010     def->max = max_temp;
2011     def->mode = comExpert;
2012     def->set_default_value(new ConfigOptionInt(-5));
2013 
2014     def = this->add("start_gcode", coString);
2015     def->label = L("Start G-code");
2016     def->tooltip = L("This start procedure is inserted at the beginning, after bed has reached "
2017                    "the target temperature and extruder just started heating, and before extruder "
2018                    "has finished heating. If PrusaSlicer detects M104 or M190 in your custom codes, "
2019                    "such commands will not be prepended automatically so you're free to customize "
2020                    "the order of heating commands and other custom actions. Note that you can use "
2021                    "placeholder variables for all PrusaSlicer settings, so you can put "
2022                    "a \"M109 S[first_layer_temperature]\" command wherever you want.");
2023     def->multiline = true;
2024     def->full_width = true;
2025     def->height = 12;
2026     def->mode = comExpert;
2027     def->set_default_value(new ConfigOptionString("G28 ; home all axes\nG1 Z5 F5000 ; lift nozzle\n"));
2028 
2029     def = this->add("start_filament_gcode", coStrings);
2030     def->label = L("Start G-code");
2031     def->tooltip = L("This start procedure is inserted at the beginning, after any printer start gcode (and "
2032                    "after any toolchange to this filament in case of multi-material printers). "
2033                    "This is used to override settings for a specific filament. If PrusaSlicer detects "
2034                    "M104, M109, M140 or M190 in your custom codes, such commands will "
2035                    "not be prepended automatically so you're free to customize the order "
2036                    "of heating commands and other custom actions. Note that you can use placeholder variables "
2037                    "for all PrusaSlicer settings, so you can put a \"M109 S[first_layer_temperature]\" command "
2038                    "wherever you want. If you have multiple extruders, the gcode is processed "
2039                    "in extruder order.");
2040     def->multiline = true;
2041     def->full_width = true;
2042     def->height = 12;
2043     def->mode = comExpert;
2044     def->set_default_value(new ConfigOptionStrings { "; Filament gcode\n" });
2045 
2046     def = this->add("color_change_gcode", coString);
2047     def->label = L("Color change G-code");
2048     def->tooltip = L("This G-code will be used as a code for the color change");
2049     def->multiline = true;
2050     def->full_width = true;
2051     def->height = 12;
2052     def->mode = comExpert;
2053     def->set_default_value(new ConfigOptionString("M600"));
2054 
2055     def = this->add("pause_print_gcode", coString);
2056     def->label = L("Pause Print G-code");
2057     def->tooltip = L("This G-code will be used as a code for the pause print");
2058     def->multiline = true;
2059     def->full_width = true;
2060     def->height = 12;
2061     def->mode = comExpert;
2062     def->set_default_value(new ConfigOptionString("M601"));
2063 
2064     def = this->add("template_custom_gcode", coString);
2065     def->label = L("Custom G-code");
2066     def->tooltip = L("This G-code will be used as a custom code");
2067     def->multiline = true;
2068     def->full_width = true;
2069     def->height = 12;
2070     def->mode = comExpert;
2071     def->set_default_value(new ConfigOptionString(""));
2072 
2073     def = this->add("single_extruder_multi_material", coBool);
2074     def->label = L("Single Extruder Multi Material");
2075     def->tooltip = L("The printer multiplexes filaments into a single hot end.");
2076     def->mode = comExpert;
2077     def->set_default_value(new ConfigOptionBool(false));
2078 
2079     def = this->add("single_extruder_multi_material_priming", coBool);
2080     def->label = L("Prime all printing extruders");
2081     def->tooltip = L("If enabled, all printing extruders will be primed at the front edge of the print bed at the start of the print.");
2082     def->mode = comAdvanced;
2083     def->set_default_value(new ConfigOptionBool(true));
2084 
2085     def = this->add("wipe_tower_no_sparse_layers", coBool);
2086     def->label = L("No sparse layers (EXPERIMENTAL)");
2087     def->tooltip = L("If enabled, the wipe tower will not be printed on layers with no toolchanges. "
2088                      "On layers with a toolchange, extruder will travel downward to print the wipe tower. "
2089                      "User is responsible for ensuring there is no collision with the print.");
2090     def->mode = comAdvanced;
2091     def->set_default_value(new ConfigOptionBool(false));
2092 
2093     def = this->add("support_material", coBool);
2094     def->label = L("Generate support material");
2095     def->category = L("Support material");
2096     def->tooltip = L("Enable support material generation.");
2097     def->set_default_value(new ConfigOptionBool(false));
2098 
2099     def = this->add("support_material_auto", coBool);
2100     def->label = L("Auto generated supports");
2101     def->category = L("Support material");
2102     def->tooltip = L("If checked, supports will be generated automatically based on the overhang threshold value."\
2103                      " If unchecked, supports will be generated inside the \"Support Enforcer\" volumes only.");
2104     def->mode = comSimple;
2105     def->set_default_value(new ConfigOptionBool(true));
2106 
2107     def = this->add("support_material_xy_spacing", coFloatOrPercent);
2108     def->label = L("XY separation between an object and its support");
2109     def->category = L("Support material");
2110     def->tooltip = L("XY separation between an object and its support. If expressed as percentage "
2111                    "(for example 50%), it will be calculated over external perimeter width.");
2112     def->sidetext = L("mm or %");
2113     def->ratio_over = "external_perimeter_extrusion_width";
2114     def->min = 0;
2115     def->mode = comAdvanced;
2116     // Default is half the external perimeter width.
2117     def->set_default_value(new ConfigOptionFloatOrPercent(50, true));
2118 
2119     def = this->add("support_material_angle", coFloat);
2120     def->label = L("Pattern angle");
2121     def->category = L("Support material");
2122     def->tooltip = L("Use this setting to rotate the support material pattern on the horizontal plane.");
2123     def->sidetext = L("°");
2124     def->min = 0;
2125     def->max = 359;
2126     def->mode = comExpert;
2127     def->set_default_value(new ConfigOptionFloat(0));
2128 
2129     def = this->add("support_material_buildplate_only", coBool);
2130     def->label = L("Support on build plate only");
2131     def->category = L("Support material");
2132     def->tooltip = L("Only create support if it lies on a build plate. Don't create support on a print.");
2133     def->mode = comSimple;
2134     def->set_default_value(new ConfigOptionBool(false));
2135 
2136     def = this->add("support_material_contact_distance", coFloat);
2137     def->gui_type = "f_enum_open";
2138     def->label = L("Contact Z distance");
2139     def->category = L("Support material");
2140     def->tooltip = L("The vertical distance between object and support material interface. "
2141                    "Setting this to 0 will also prevent Slic3r from using bridge flow and speed "
2142                    "for the first object layer.");
2143     def->sidetext = L("mm");
2144 //    def->min = 0;
2145     def->enum_values.push_back("0");
2146     def->enum_values.push_back("0.2");
2147     def->enum_labels.push_back(L("0 (soluble)"));
2148     def->enum_labels.push_back(L("0.2 (detachable)"));
2149     def->mode = comAdvanced;
2150     def->set_default_value(new ConfigOptionFloat(0.2));
2151 
2152     def = this->add("support_material_enforce_layers", coInt);
2153     def->label = L("Enforce support for the first");
2154     def->category = L("Support material");
2155     def->tooltip = L("Generate support material for the specified number of layers counting from bottom, "
2156                    "regardless of whether normal support material is enabled or not and regardless "
2157                    "of any angle threshold. This is useful for getting more adhesion of objects "
2158                    "having a very thin or poor footprint on the build plate.");
2159     def->sidetext = L("layers");
2160     def->full_label = L("Enforce support for the first n layers");
2161     def->min = 0;
2162     def->mode = comExpert;
2163     def->set_default_value(new ConfigOptionInt(0));
2164 
2165     def = this->add("support_material_extruder", coInt);
2166     def->label = L("Support material/raft/skirt extruder");
2167     def->category = L("Extruders");
2168     def->tooltip = L("The extruder to use when printing support material, raft and skirt "
2169                    "(1+, 0 to use the current extruder to minimize tool changes).");
2170     def->min = 0;
2171     def->mode = comAdvanced;
2172     def->set_default_value(new ConfigOptionInt(1));
2173 
2174     def = this->add("support_material_extrusion_width", coFloatOrPercent);
2175     def->label = L("Support material");
2176     def->category = L("Extrusion Width");
2177     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for support material. "
2178                    "If left zero, default extrusion width will be used if set, otherwise nozzle diameter will be used. "
2179                    "If expressed as percentage (for example 90%) it will be computed over layer height.");
2180     def->sidetext = L("mm or %");
2181     def->min = 0;
2182     def->mode = comAdvanced;
2183     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
2184 
2185     def = this->add("support_material_interface_contact_loops", coBool);
2186     def->label = L("Interface loops");
2187     def->category = L("Support material");
2188     def->tooltip = L("Cover the top contact layer of the supports with loops. Disabled by default.");
2189     def->mode = comExpert;
2190     def->set_default_value(new ConfigOptionBool(false));
2191 
2192     def = this->add("support_material_interface_extruder", coInt);
2193     def->label = L("Support material/raft interface extruder");
2194     def->category = L("Extruders");
2195     def->tooltip = L("The extruder to use when printing support material interface "
2196                    "(1+, 0 to use the current extruder to minimize tool changes). This affects raft too.");
2197     def->min = 0;
2198     def->mode = comAdvanced;
2199     def->set_default_value(new ConfigOptionInt(1));
2200 
2201     def = this->add("support_material_interface_layers", coInt);
2202     def->label = L("Interface layers");
2203     def->category = L("Support material");
2204     def->tooltip = L("Number of interface layers to insert between the object(s) and support material.");
2205     def->sidetext = L("layers");
2206     def->min = 0;
2207     def->mode = comAdvanced;
2208     def->set_default_value(new ConfigOptionInt(3));
2209 
2210     def = this->add("support_material_interface_spacing", coFloat);
2211     def->label = L("Interface pattern spacing");
2212     def->category = L("Support material");
2213     def->tooltip = L("Spacing between interface lines. Set zero to get a solid interface.");
2214     def->sidetext = L("mm");
2215     def->min = 0;
2216     def->mode = comAdvanced;
2217     def->set_default_value(new ConfigOptionFloat(0));
2218 
2219     def = this->add("support_material_interface_speed", coFloatOrPercent);
2220     def->label = L("Support material interface");
2221     def->category = L("Support material");
2222     def->tooltip = L("Speed for printing support material interface layers. If expressed as percentage "
2223                    "(for example 50%) it will be calculated over support material speed.");
2224     def->sidetext = L("mm/s or %");
2225     def->ratio_over = "support_material_speed";
2226     def->min = 0;
2227     def->mode = comAdvanced;
2228     def->set_default_value(new ConfigOptionFloatOrPercent(100, true));
2229 
2230     def = this->add("support_material_pattern", coEnum);
2231     def->label = L("Pattern");
2232     def->category = L("Support material");
2233     def->tooltip = L("Pattern used to generate support material.");
2234     def->enum_keys_map = &ConfigOptionEnum<SupportMaterialPattern>::get_enum_values();
2235     def->enum_values.push_back("rectilinear");
2236     def->enum_values.push_back("rectilinear-grid");
2237     def->enum_values.push_back("honeycomb");
2238     def->enum_labels.push_back(L("Rectilinear"));
2239     def->enum_labels.push_back(L("Rectilinear grid"));
2240     def->enum_labels.push_back(L("Honeycomb"));
2241     def->mode = comAdvanced;
2242     def->set_default_value(new ConfigOptionEnum<SupportMaterialPattern>(smpRectilinear));
2243 
2244     def = this->add("support_material_spacing", coFloat);
2245     def->label = L("Pattern spacing");
2246     def->category = L("Support material");
2247     def->tooltip = L("Spacing between support material lines.");
2248     def->sidetext = L("mm");
2249     def->min = 0;
2250     def->mode = comAdvanced;
2251     def->set_default_value(new ConfigOptionFloat(2.5));
2252 
2253     def = this->add("support_material_speed", coFloat);
2254     def->label = L("Support material");
2255     def->category = L("Support material");
2256     def->tooltip = L("Speed for printing support material.");
2257     def->sidetext = L("mm/s");
2258     def->min = 0;
2259     def->mode = comAdvanced;
2260     def->set_default_value(new ConfigOptionFloat(60));
2261 
2262     def = this->add("support_material_synchronize_layers", coBool);
2263     def->label = L("Synchronize with object layers");
2264     def->category = L("Support material");
2265     def->tooltip = L("Synchronize support layers with the object print layers. This is useful "
2266                    "with multi-material printers, where the extruder switch is expensive.");
2267     def->mode = comExpert;
2268     def->set_default_value(new ConfigOptionBool(false));
2269 
2270     def = this->add("support_material_threshold", coInt);
2271     def->label = L("Overhang threshold");
2272     def->category = L("Support material");
2273     def->tooltip = L("Support material will not be generated for overhangs whose slope angle "
2274                    "(90° = vertical) is above the given threshold. In other words, this value "
2275                    "represent the most horizontal slope (measured from the horizontal plane) "
2276                    "that you can print without support material. Set to zero for automatic detection "
2277                    "(recommended).");
2278     def->sidetext = L("°");
2279     def->min = 0;
2280     def->max = 90;
2281     def->mode = comAdvanced;
2282     def->set_default_value(new ConfigOptionInt(0));
2283 
2284     def = this->add("support_material_with_sheath", coBool);
2285     def->label = L("With sheath around the support");
2286     def->category = L("Support material");
2287     def->tooltip = L("Add a sheath (a single perimeter line) around the base support. This makes "
2288                    "the support more reliable, but also more difficult to remove.");
2289     def->mode = comExpert;
2290     def->set_default_value(new ConfigOptionBool(true));
2291 
2292     def = this->add("temperature", coInts);
2293     def->label = L("Other layers");
2294     def->tooltip = L("Nozzle temperature for layers after the first one. Set this to zero to disable "
2295                      "temperature control commands in the output G-code.");
2296     def->sidetext = L("°C");
2297     def->full_label = L("Nozzle temperature");
2298     def->min = 0;
2299     def->max = max_temp;
2300     def->set_default_value(new ConfigOptionInts { 200 });
2301 
2302     def = this->add("thin_walls", coBool);
2303     def->label = L("Detect thin walls");
2304     def->category = L("Layers and Perimeters");
2305     def->tooltip = L("Detect single-width walls (parts where two extrusions don't fit and we need "
2306                    "to collapse them into a single trace).");
2307     def->mode = comAdvanced;
2308     def->set_default_value(new ConfigOptionBool(true));
2309 
2310     def = this->add("threads", coInt);
2311     def->label = L("Threads");
2312     def->tooltip = L("Threads are used to parallelize long-running tasks. Optimal threads number "
2313                    "is slightly above the number of available cores/processors.");
2314     def->readonly = true;
2315     def->min = 1;
2316     {
2317         int threads = (unsigned int)boost::thread::hardware_concurrency();
2318         def->set_default_value(new ConfigOptionInt(threads > 0 ? threads : 2));
2319         def->cli = ConfigOptionDef::nocli;
2320     }
2321 
2322     def = this->add("toolchange_gcode", coString);
2323     def->label = L("Tool change G-code");
2324     def->tooltip = L("This custom code is inserted before every toolchange. Placeholder variables for all PrusaSlicer settings "
2325                      "as well as {previous_extruder} and {next_extruder} can be used. When a tool-changing command "
2326                      "which changes to the correct extruder is included (such as T{next_extruder}), PrusaSlicer will emit no other such command. "
2327                      "It is therefore possible to script custom behaviour both before and after the toolchange.");
2328     def->multiline = true;
2329     def->full_width = true;
2330     def->height = 5;
2331     def->mode = comExpert;
2332     def->set_default_value(new ConfigOptionString(""));
2333 
2334     def = this->add("top_infill_extrusion_width", coFloatOrPercent);
2335     def->label = L("Top solid infill");
2336     def->category = L("Extrusion Width");
2337     def->tooltip = L("Set this to a non-zero value to set a manual extrusion width for infill for top surfaces. "
2338                    "You may want to use thinner extrudates to fill all narrow regions and get a smoother finish. "
2339                    "If left zero, default extrusion width will be used if set, otherwise nozzle diameter will be used. "
2340                    "If expressed as percentage (for example 90%) it will be computed over layer height.");
2341     def->sidetext = L("mm or %");
2342     def->min = 0;
2343     def->mode = comAdvanced;
2344     def->set_default_value(new ConfigOptionFloatOrPercent(0, false));
2345 
2346     def = this->add("top_solid_infill_speed", coFloatOrPercent);
2347     def->label = L("Top solid infill");
2348     def->category = L("Speed");
2349     def->tooltip = L("Speed for printing top solid layers (it only applies to the uppermost "
2350                    "external layers and not to their internal solid layers). You may want "
2351                    "to slow down this to get a nicer surface finish. This can be expressed "
2352                    "as a percentage (for example: 80%) over the solid infill speed above. "
2353                    "Set to zero for auto.");
2354     def->sidetext = L("mm/s or %");
2355     def->ratio_over = "solid_infill_speed";
2356     def->min = 0;
2357     def->mode = comAdvanced;
2358     def->set_default_value(new ConfigOptionFloatOrPercent(15, false));
2359 
2360     def = this->add("top_solid_layers", coInt);
2361     //TRN To be shown in Print Settings "Top solid layers"
2362     def->label = L("Top");
2363     def->category = L("Layers and Perimeters");
2364     def->tooltip = L("Number of solid layers to generate on top surfaces.");
2365     def->full_label = L("Top solid layers");
2366     def->min = 0;
2367     def->set_default_value(new ConfigOptionInt(3));
2368 
2369     def = this->add("top_solid_min_thickness", coFloat);
2370     //TRN To be shown in Print Settings "Top solid layers"
2371     def->label = L("Top");
2372     def->category = L("Layers and Perimeters");
2373     def->tooltip = L("The number of top solid layers is increased above top_solid_layers if necessary to satisfy "
2374     				 "minimum thickness of top shell."
2375     				 " This is useful to prevent pillowing effect when printing with variable layer height.");
2376     def->full_label = L("Minimum top shell thickness");
2377     def->sidetext = L("mm");
2378     def->min = 0;
2379     def->set_default_value(new ConfigOptionFloat(0.));
2380 
2381     def = this->add("travel_speed", coFloat);
2382     def->label = L("Travel");
2383     def->tooltip = L("Speed for travel moves (jumps between distant extrusion points).");
2384     def->sidetext = L("mm/s");
2385     def->aliases = { "travel_feed_rate" };
2386     def->min = 1;
2387     def->mode = comAdvanced;
2388     def->set_default_value(new ConfigOptionFloat(130));
2389 
2390     def = this->add("use_firmware_retraction", coBool);
2391     def->label = L("Use firmware retraction");
2392     def->tooltip = L("This experimental setting uses G10 and G11 commands to have the firmware "
2393                    "handle the retraction. This is only supported in recent Marlin.");
2394     def->mode = comExpert;
2395     def->set_default_value(new ConfigOptionBool(false));
2396 
2397     def = this->add("use_relative_e_distances", coBool);
2398     def->label = L("Use relative E distances");
2399     def->tooltip = L("If your firmware requires relative E values, check this, "
2400                    "otherwise leave it unchecked. Most firmwares use absolute values.");
2401     def->mode = comExpert;
2402     def->set_default_value(new ConfigOptionBool(false));
2403 
2404     def = this->add("use_volumetric_e", coBool);
2405     def->label = L("Use volumetric E");
2406     def->tooltip = L("This experimental setting uses outputs the E values in cubic millimeters "
2407                    "instead of linear millimeters. If your firmware doesn't already know "
2408                    "filament diameter(s), you can put commands like 'M200 D[filament_diameter_0] T0' "
2409                    "in your start G-code in order to turn volumetric mode on and use the filament "
2410                    "diameter associated to the filament selected in Slic3r. This is only supported "
2411                    "in recent Marlin.");
2412     def->mode = comExpert;
2413     def->set_default_value(new ConfigOptionBool(false));
2414 
2415     def = this->add("variable_layer_height", coBool);
2416     def->label = L("Enable variable layer height feature");
2417     def->tooltip = L("Some printers or printer setups may have difficulties printing "
2418                    "with a variable layer height. Enabled by default.");
2419     def->mode = comExpert;
2420     def->set_default_value(new ConfigOptionBool(true));
2421 
2422     def = this->add("wipe", coBools);
2423     def->label = L("Wipe while retracting");
2424     def->tooltip = L("This flag will move the nozzle while retracting to minimize the possible blob "
2425                    "on leaky extruders.");
2426     def->mode = comAdvanced;
2427     def->set_default_value(new ConfigOptionBools { false });
2428 
2429     def = this->add("wipe_tower", coBool);
2430     def->label = L("Enable");
2431     def->tooltip = L("Multi material printers may need to prime or purge extruders on tool changes. "
2432                    "Extrude the excess material into the wipe tower.");
2433     def->mode = comAdvanced;
2434     def->set_default_value(new ConfigOptionBool(false));
2435 
2436     def = this->add("wiping_volumes_extruders", coFloats);
2437     def->label = L("Purging volumes - load/unload volumes");
2438     def->tooltip = L("This vector saves required volumes to change from/to each tool used on the "
2439                      "wipe tower. These values are used to simplify creation of the full purging "
2440                      "volumes below.");
2441     def->set_default_value(new ConfigOptionFloats { 70.f, 70.f, 70.f, 70.f, 70.f, 70.f, 70.f, 70.f, 70.f, 70.f  });
2442 
2443     def = this->add("wiping_volumes_matrix", coFloats);
2444     def->label = L("Purging volumes - matrix");
2445     def->tooltip = L("This matrix describes volumes (in cubic milimetres) required to purge the"
2446                      " new filament on the wipe tower for any given pair of tools.");
2447     def->set_default_value(new ConfigOptionFloats {   0.f, 140.f, 140.f, 140.f, 140.f,
2448                                                     140.f,   0.f, 140.f, 140.f, 140.f,
2449                                                     140.f, 140.f,   0.f, 140.f, 140.f,
2450                                                     140.f, 140.f, 140.f,   0.f, 140.f,
2451                                                     140.f, 140.f, 140.f, 140.f,   0.f });
2452 
2453     def = this->add("wipe_tower_x", coFloat);
2454     def->label = L("Position X");
2455     def->tooltip = L("X coordinate of the left front corner of a wipe tower");
2456     def->sidetext = L("mm");
2457     def->mode = comAdvanced;
2458     def->set_default_value(new ConfigOptionFloat(180.));
2459 
2460     def = this->add("wipe_tower_y", coFloat);
2461     def->label = L("Position Y");
2462     def->tooltip = L("Y coordinate of the left front corner of a wipe tower");
2463     def->sidetext = L("mm");
2464     def->mode = comAdvanced;
2465     def->set_default_value(new ConfigOptionFloat(140.));
2466 
2467     def = this->add("wipe_tower_width", coFloat);
2468     def->label = L("Width");
2469     def->tooltip = L("Width of a wipe tower");
2470     def->sidetext = L("mm");
2471     def->mode = comAdvanced;
2472     def->set_default_value(new ConfigOptionFloat(60.));
2473 
2474     def = this->add("wipe_tower_rotation_angle", coFloat);
2475     def->label = L("Wipe tower rotation angle");
2476     def->tooltip = L("Wipe tower rotation angle with respect to x-axis.");
2477     def->sidetext = L("°");
2478     def->mode = comAdvanced;
2479     def->set_default_value(new ConfigOptionFloat(0.));
2480 
2481     def = this->add("wipe_into_infill", coBool);
2482     def->category = L("Wipe options");
2483     def->label = L("Wipe into this object's infill");
2484     def->tooltip = L("Purging after toolchange will done inside this object's infills. "
2485                      "This lowers the amount of waste but may result in longer print time "
2486                      " due to additional travel moves.");
2487     def->set_default_value(new ConfigOptionBool(false));
2488 
2489     def = this->add("wipe_into_objects", coBool);
2490     def->category = L("Wipe options");
2491     def->label = L("Wipe into this object");
2492     def->tooltip = L("Object will be used to purge the nozzle after a toolchange to save material "
2493                      "that would otherwise end up in the wipe tower and decrease print time. "
2494                      "Colours of the objects will be mixed as a result.");
2495     def->set_default_value(new ConfigOptionBool(false));
2496 
2497     def = this->add("wipe_tower_bridging", coFloat);
2498     def->label = L("Maximal bridging distance");
2499     def->tooltip = L("Maximal distance between supports on sparse infill sections.");
2500     def->sidetext = L("mm");
2501     def->mode = comAdvanced;
2502     def->set_default_value(new ConfigOptionFloat(10.));
2503 
2504     def = this->add("xy_size_compensation", coFloat);
2505     def->label = L("XY Size Compensation");
2506     def->category = L("Advanced");
2507     def->tooltip = L("The object will be grown/shrunk in the XY plane by the configured value "
2508                    "(negative = inwards, positive = outwards). This might be useful "
2509                    "for fine-tuning hole sizes.");
2510     def->sidetext = L("mm");
2511     def->mode = comExpert;
2512     def->set_default_value(new ConfigOptionFloat(0));
2513 
2514     def = this->add("z_offset", coFloat);
2515     def->label = L("Z offset");
2516     def->tooltip = L("This value will be added (or subtracted) from all the Z coordinates "
2517                    "in the output G-code. It is used to compensate for bad Z endstop position: "
2518                    "for example, if your endstop zero actually leaves the nozzle 0.3mm far "
2519                    "from the print bed, set this to -0.3 (or fix your endstop).");
2520     def->sidetext = L("mm");
2521     def->mode = comAdvanced;
2522     def->set_default_value(new ConfigOptionFloat(0));
2523 
2524     // Declare retract values for filament profile, overriding the printer's extruder profile.
2525     for (const char *opt_key : {
2526         // floats
2527         "retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed", "deretract_speed", "retract_restart_extra", "retract_before_travel",
2528         // bools
2529         "retract_layer_change", "wipe",
2530         // percents
2531         "retract_before_wipe"}) {
2532         auto it_opt = options.find(opt_key);
2533         assert(it_opt != options.end());
2534         def = this->add_nullable(std::string("filament_") + opt_key, it_opt->second.type);
2535         def->label 		= it_opt->second.label;
2536         def->full_label = it_opt->second.full_label;
2537         def->tooltip 	= it_opt->second.tooltip;
2538         def->sidetext   = it_opt->second.sidetext;
2539         def->mode       = it_opt->second.mode;
2540         switch (def->type) {
2541         case coFloats   : def->set_default_value(new ConfigOptionFloatsNullable  (static_cast<const ConfigOptionFloats*  >(it_opt->second.default_value.get())->values)); break;
2542         case coPercents : def->set_default_value(new ConfigOptionPercentsNullable(static_cast<const ConfigOptionPercents*>(it_opt->second.default_value.get())->values)); break;
2543         case coBools    : def->set_default_value(new ConfigOptionBoolsNullable   (static_cast<const ConfigOptionBools*   >(it_opt->second.default_value.get())->values)); break;
2544         default: assert(false);
2545         }
2546     }
2547 }
2548 
init_extruder_option_keys()2549 void PrintConfigDef::init_extruder_option_keys()
2550 {
2551     // ConfigOptionFloats, ConfigOptionPercents, ConfigOptionBools, ConfigOptionStrings
2552     m_extruder_option_keys = {
2553         "nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset",
2554         "retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed", "deretract_speed",
2555         "retract_before_wipe", "retract_restart_extra", "retract_before_travel", "wipe",
2556         "retract_layer_change", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour",
2557         "default_filament_profile"
2558     };
2559 
2560     m_extruder_retract_keys = {
2561         "deretract_speed",
2562         "retract_before_travel",
2563         "retract_before_wipe",
2564         "retract_layer_change",
2565         "retract_length",
2566         "retract_lift",
2567         "retract_lift_above",
2568         "retract_lift_below",
2569         "retract_restart_extra",
2570         "retract_speed",
2571         "wipe"
2572     };
2573     assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end()));
2574 }
2575 
init_sla_params()2576 void PrintConfigDef::init_sla_params()
2577 {
2578     ConfigOptionDef* def;
2579 
2580     // SLA Printer settings
2581 
2582     def = this->add("display_width", coFloat);
2583     def->label = L("Display width");
2584     def->tooltip = L("Width of the display");
2585     def->min = 1;
2586     def->set_default_value(new ConfigOptionFloat(120.));
2587 
2588     def = this->add("display_height", coFloat);
2589     def->label = L("Display height");
2590     def->tooltip = L("Height of the display");
2591     def->min = 1;
2592     def->set_default_value(new ConfigOptionFloat(68.));
2593 
2594     def = this->add("display_pixels_x", coInt);
2595     def->full_label = L("Number of pixels in");
2596     def->label = ("X");
2597     def->tooltip = L("Number of pixels in X");
2598     def->min = 100;
2599     def->set_default_value(new ConfigOptionInt(2560));
2600 
2601     def = this->add("display_pixels_y", coInt);
2602     def->label = ("Y");
2603     def->tooltip = L("Number of pixels in Y");
2604     def->min = 100;
2605     def->set_default_value(new ConfigOptionInt(1440));
2606 
2607     def = this->add("display_mirror_x", coBool);
2608     def->full_label = L("Display horizontal mirroring");
2609     def->label = L("Mirror horizontally");
2610     def->tooltip = L("Enable horizontal mirroring of output images");
2611     def->mode = comExpert;
2612     def->set_default_value(new ConfigOptionBool(true));
2613 
2614     def = this->add("display_mirror_y", coBool);
2615     def->full_label = L("Display vertical mirroring");
2616     def->label = L("Mirror vertically");
2617     def->tooltip = L("Enable vertical mirroring of output images");
2618     def->mode = comExpert;
2619     def->set_default_value(new ConfigOptionBool(false));
2620 
2621     def = this->add("display_orientation", coEnum);
2622     def->label = L("Display orientation");
2623     def->tooltip = L("Set the actual LCD display orientation inside the SLA printer."
2624                      " Portrait mode will flip the meaning of display width and height parameters"
2625                      " and the output images will be rotated by 90 degrees.");
2626     def->enum_keys_map = &ConfigOptionEnum<SLADisplayOrientation>::get_enum_values();
2627     def->enum_values.push_back("landscape");
2628     def->enum_values.push_back("portrait");
2629     def->enum_labels.push_back(L("Landscape"));
2630     def->enum_labels.push_back(L("Portrait"));
2631     def->mode = comExpert;
2632     def->set_default_value(new ConfigOptionEnum<SLADisplayOrientation>(sladoPortrait));
2633 
2634     def = this->add("fast_tilt_time", coFloat);
2635     def->label = L("Fast");
2636     def->full_label = L("Fast tilt");
2637     def->tooltip = L("Time of the fast tilt");
2638     def->sidetext = L("s");
2639     def->min = 0;
2640     def->mode = comExpert;
2641     def->set_default_value(new ConfigOptionFloat(5.));
2642 
2643     def = this->add("slow_tilt_time", coFloat);
2644     def->label = L("Slow");
2645     def->full_label = L("Slow tilt");
2646     def->tooltip = L("Time of the slow tilt");
2647     def->sidetext = L("s");
2648     def->min = 0;
2649     def->mode = comExpert;
2650     def->set_default_value(new ConfigOptionFloat(8.));
2651 
2652     def = this->add("area_fill", coFloat);
2653     def->label = L("Area fill");
2654     def->tooltip = L("The percentage of the bed area. \nIf the print area exceeds the specified value, \nthen a slow tilt will be used, otherwise - a fast tilt");
2655     def->sidetext = L("%");
2656     def->min = 0;
2657     def->mode = comExpert;
2658     def->set_default_value(new ConfigOptionFloat(50.));
2659 
2660     def = this->add("relative_correction", coFloats);
2661     def->label = L("Printer scaling correction");
2662     def->full_label = L("Printer scaling correction");
2663     def->tooltip  = L("Printer scaling correction");
2664     def->min = 0;
2665     def->mode = comExpert;
2666     def->set_default_value(new ConfigOptionFloats( { 1., 1. } ));
2667 
2668     def = this->add("absolute_correction", coFloat);
2669     def->label = L("Printer absolute correction");
2670     def->full_label = L("Printer absolute correction");
2671     def->tooltip  = L("Will inflate or deflate the sliced 2D polygons according "
2672                       "to the sign of the correction.");
2673     def->mode = comExpert;
2674     def->set_default_value(new ConfigOptionFloat(0.0));
2675 
2676     def = this->add("elefant_foot_min_width", coFloat);
2677     def->label = L("Elephant foot minimum width");
2678     def->category = L("Advanced");
2679     def->tooltip = L("Minimum width of features to maintain when doing elephant foot compensation.");
2680     def->sidetext = L("mm");
2681     def->min = 0;
2682     def->mode = comAdvanced;
2683     def->set_default_value(new ConfigOptionFloat(0.2));
2684 
2685     def = this->add("gamma_correction", coFloat);
2686     def->label = L("Printer gamma correction");
2687     def->full_label = L("Printer gamma correction");
2688     def->tooltip  = L("This will apply a gamma correction to the rasterized 2D "
2689                       "polygons. A gamma value of zero means thresholding with "
2690                       "the threshold in the middle. This behaviour eliminates "
2691                       "antialiasing without losing holes in polygons.");
2692     def->min = 0;
2693     def->max = 1;
2694     def->mode = comExpert;
2695     def->set_default_value(new ConfigOptionFloat(1.0));
2696 
2697 
2698     // SLA Material settings.
2699     def = this->add("material_type", coString);
2700     def->label = L("SLA material type");
2701     def->tooltip = L("SLA material type");
2702     def->gui_type = "f_enum_open";   // TODO: ???
2703     def->gui_flags = "show_value";
2704     def->enum_values.push_back("Tough");
2705     def->enum_values.push_back("Flexible");
2706     def->enum_values.push_back("Casting");
2707     def->enum_values.push_back("Dental");
2708     def->enum_values.push_back("Heat-resistant");
2709     def->set_default_value(new ConfigOptionString("Tough"));
2710 
2711     def = this->add("initial_layer_height", coFloat);
2712     def->label = L("Initial layer height");
2713     def->tooltip = L("Initial layer height");
2714     def->sidetext = L("mm");
2715     def->min = 0;
2716     def->set_default_value(new ConfigOptionFloat(0.3));
2717 
2718     def = this->add("bottle_volume", coFloat);
2719     def->label = L("Bottle volume");
2720     def->tooltip = L("Bottle volume");
2721     def->sidetext = L("ml");
2722     def->min = 50;
2723     def->set_default_value(new ConfigOptionFloat(1000.0));
2724 
2725     def = this->add("bottle_weight", coFloat);
2726     def->label = L("Bottle weight");
2727     def->tooltip = L("Bottle weight");
2728     def->sidetext = L("kg");
2729     def->min = 0;
2730     def->set_default_value(new ConfigOptionFloat(1.0));
2731 
2732     def = this->add("material_density", coFloat);
2733     def->label = L("Density");
2734     def->tooltip = L("Density");
2735     def->sidetext = L("g/ml");
2736     def->min = 0;
2737     def->set_default_value(new ConfigOptionFloat(1.0));
2738 
2739     def = this->add("bottle_cost", coFloat);
2740     def->label = L("Cost");
2741     def->tooltip = L("Cost");
2742     def->sidetext = L("money/bottle");
2743     def->min = 0;
2744     def->set_default_value(new ConfigOptionFloat(0.0));
2745 
2746     def = this->add("faded_layers", coInt);
2747     def->label = L("Faded layers");
2748     def->tooltip = L("Number of the layers needed for the exposure time fade from initial exposure time to the exposure time");
2749     def->min = 3;
2750     def->max = 20;
2751     def->mode = comExpert;
2752     def->set_default_value(new ConfigOptionInt(10));
2753 
2754     def = this->add("min_exposure_time", coFloat);
2755     def->label = L("Minimum exposure time");
2756     def->tooltip = L("Minimum exposure time");
2757     def->sidetext = L("s");
2758     def->min = 0;
2759     def->mode = comExpert;
2760     def->set_default_value(new ConfigOptionFloat(0));
2761 
2762     def = this->add("max_exposure_time", coFloat);
2763     def->label = L("Maximum exposure time");
2764     def->tooltip = L("Maximum exposure time");
2765     def->sidetext = L("s");
2766     def->min = 0;
2767     def->mode = comExpert;
2768     def->set_default_value(new ConfigOptionFloat(100));
2769 
2770     def = this->add("exposure_time", coFloat);
2771     def->label = L("Exposure time");
2772     def->tooltip = L("Exposure time");
2773     def->sidetext = L("s");
2774     def->min = 0;
2775     def->set_default_value(new ConfigOptionFloat(10));
2776 
2777     def = this->add("min_initial_exposure_time", coFloat);
2778     def->label = L("Minimum initial exposure time");
2779     def->tooltip = L("Minimum initial exposure time");
2780     def->sidetext = L("s");
2781     def->min = 0;
2782     def->mode = comExpert;
2783     def->set_default_value(new ConfigOptionFloat(0));
2784 
2785     def = this->add("max_initial_exposure_time", coFloat);
2786     def->label = L("Maximum initial exposure time");
2787     def->tooltip = L("Maximum initial exposure time");
2788     def->sidetext = L("s");
2789     def->min = 0;
2790     def->mode = comExpert;
2791     def->set_default_value(new ConfigOptionFloat(150));
2792 
2793     def = this->add("initial_exposure_time", coFloat);
2794     def->label = L("Initial exposure time");
2795     def->tooltip = L("Initial exposure time");
2796     def->sidetext = L("s");
2797     def->min = 0;
2798     def->set_default_value(new ConfigOptionFloat(15));
2799 
2800     def = this->add("material_correction", coFloats);
2801     def->full_label = L("Correction for expansion");
2802     def->tooltip  = L("Correction for expansion");
2803     def->min = 0;
2804     def->mode = comExpert;
2805     def->set_default_value(new ConfigOptionFloats( { 1. , 1. } ));
2806 
2807     def = this->add("material_notes", coString);
2808     def->label = L("SLA print material notes");
2809     def->tooltip = L("You can put your notes regarding the SLA print material here.");
2810     def->multiline = true;
2811     def->full_width = true;
2812     def->height = 13;
2813     def->mode = comAdvanced;
2814     def->set_default_value(new ConfigOptionString(""));
2815 
2816     def = this->add("material_vendor", coString);
2817     def->set_default_value(new ConfigOptionString(L("(Unknown)")));
2818     def->cli = ConfigOptionDef::nocli;
2819 
2820     def = this->add("default_sla_material_profile", coString);
2821     def->label = L("Default SLA material profile");
2822     def->tooltip = L("Default print profile associated with the current printer profile. "
2823                    "On selection of the current printer profile, this print profile will be activated.");
2824     def->set_default_value(new ConfigOptionString());
2825     def->cli = ConfigOptionDef::nocli;
2826 
2827     def = this->add("sla_material_settings_id", coString);
2828     def->set_default_value(new ConfigOptionString(""));
2829     def->cli = ConfigOptionDef::nocli;
2830 
2831     def = this->add("default_sla_print_profile", coString);
2832     def->label = L("Default SLA material profile");
2833     def->tooltip = L("Default print profile associated with the current printer profile. "
2834                    "On selection of the current printer profile, this print profile will be activated.");
2835     def->set_default_value(new ConfigOptionString());
2836     def->cli = ConfigOptionDef::nocli;
2837 
2838     def = this->add("sla_print_settings_id", coString);
2839     def->set_default_value(new ConfigOptionString(""));
2840     def->cli = ConfigOptionDef::nocli;
2841 
2842     def = this->add("supports_enable", coBool);
2843     def->label = L("Generate supports");
2844     def->category = L("Supports");
2845     def->tooltip = L("Generate supports for the models");
2846     def->mode = comSimple;
2847     def->set_default_value(new ConfigOptionBool(true));
2848 
2849     def = this->add("support_head_front_diameter", coFloat);
2850     def->label = L("Pinhead front diameter");
2851     def->category = L("Supports");
2852     def->tooltip = L("Diameter of the pointing side of the head");
2853     def->sidetext = L("mm");
2854     def->min = 0;
2855     def->mode = comAdvanced;
2856     def->set_default_value(new ConfigOptionFloat(0.4));
2857 
2858     def = this->add("support_head_penetration", coFloat);
2859     def->label = L("Head penetration");
2860     def->category = L("Supports");
2861     def->tooltip = L("How much the pinhead has to penetrate the model surface");
2862     def->sidetext = L("mm");
2863     def->mode = comAdvanced;
2864     def->min = 0;
2865     def->set_default_value(new ConfigOptionFloat(0.2));
2866 
2867     def = this->add("support_head_width", coFloat);
2868     def->label = L("Pinhead width");
2869     def->category = L("Supports");
2870     def->tooltip = L("Width from the back sphere center to the front sphere center");
2871     def->sidetext = L("mm");
2872     def->min = 0;
2873     def->max = 20;
2874     def->mode = comAdvanced;
2875     def->set_default_value(new ConfigOptionFloat(1.0));
2876 
2877     def = this->add("support_pillar_diameter", coFloat);
2878     def->label = L("Pillar diameter");
2879     def->category = L("Supports");
2880     def->tooltip = L("Diameter in mm of the support pillars");
2881     def->sidetext = L("mm");
2882     def->min = 0;
2883     def->max = 15;
2884     def->mode = comSimple;
2885     def->set_default_value(new ConfigOptionFloat(1.0));
2886 
2887     def = this->add("support_small_pillar_diameter_percent", coPercent);
2888     def->label = L("Small pillar diameter percent");
2889     def->category = L("Supports");
2890     def->tooltip = L("The percentage of smaller pillars compared to the normal pillar diameter "
2891                      "which are used in problematic areas where a normal pilla cannot fit.");
2892     def->sidetext = L("%");
2893     def->min = 1;
2894     def->max = 100;
2895     def->mode = comExpert;
2896     def->set_default_value(new ConfigOptionPercent(50));
2897 
2898     def = this->add("support_max_bridges_on_pillar", coInt);
2899     def->label = L("Max bridges on a pillar");
2900     def->tooltip = L(
2901         "Maximum number of bridges that can be placed on a pillar. Bridges "
2902         "hold support point pinheads and connect to pillars as small branches.");
2903     def->min = 0;
2904     def->max = 50;
2905     def->mode = comExpert;
2906     def->set_default_value(new ConfigOptionInt(3));
2907 
2908     def = this->add("support_pillar_connection_mode", coEnum);
2909     def->label = L("Pillar connection mode");
2910     def->tooltip = L("Controls the bridge type between two neighboring pillars."
2911                      " Can be zig-zag, cross (double zig-zag) or dynamic which"
2912                      " will automatically switch between the first two depending"
2913                      " on the distance of the two pillars.");
2914     def->enum_keys_map = &ConfigOptionEnum<SLAPillarConnectionMode>::get_enum_values();
2915     def->enum_values.push_back("zigzag");
2916     def->enum_values.push_back("cross");
2917     def->enum_values.push_back("dynamic");
2918     def->enum_labels.push_back(L("Zig-Zag"));
2919     def->enum_labels.push_back(L("Cross"));
2920     def->enum_labels.push_back(L("Dynamic"));
2921     def->mode = comAdvanced;
2922     def->set_default_value(new ConfigOptionEnum<SLAPillarConnectionMode>(slapcmDynamic));
2923 
2924     def = this->add("support_buildplate_only", coBool);
2925     def->label = L("Support on build plate only");
2926     def->category = L("Supports");
2927     def->tooltip = L("Only create support if it lies on a build plate. Don't create support on a print.");
2928     def->mode = comSimple;
2929     def->set_default_value(new ConfigOptionBool(false));
2930 
2931     def = this->add("support_pillar_widening_factor", coFloat);
2932     def->label = L("Pillar widening factor");
2933     def->category = L("Supports");
2934     def->tooltip = L("Merging bridges or pillars into another pillars can "
2935                      "increase the radius. Zero means no increase, one means "
2936                      "full increase.");
2937     def->min = 0;
2938     def->max = 1;
2939     def->mode = comExpert;
2940     def->set_default_value(new ConfigOptionFloat(0.0));
2941 
2942     def = this->add("support_base_diameter", coFloat);
2943     def->label = L("Support base diameter");
2944     def->category = L("Supports");
2945     def->tooltip = L("Diameter in mm of the pillar base");
2946     def->sidetext = L("mm");
2947     def->min = 0;
2948     def->max = 30;
2949     def->mode = comAdvanced;
2950     def->set_default_value(new ConfigOptionFloat(4.0));
2951 
2952     def = this->add("support_base_height", coFloat);
2953     def->label = L("Support base height");
2954     def->category = L("Supports");
2955     def->tooltip = L("The height of the pillar base cone");
2956     def->sidetext = L("mm");
2957     def->min = 0;
2958     def->mode = comAdvanced;
2959     def->set_default_value(new ConfigOptionFloat(1.0));
2960 
2961     def = this->add("support_base_safety_distance", coFloat);
2962     def->label = L("Support base safety distance");
2963     def->category = L("Supports");
2964     def->tooltip  = L(
2965         "The minimum distance of the pillar base from the model in mm. "
2966         "Makes sense in zero elevation mode where a gap according "
2967         "to this parameter is inserted between the model and the pad.");
2968     def->sidetext = L("mm");
2969     def->min = 0;
2970     def->max = 10;
2971     def->mode = comExpert;
2972     def->set_default_value(new ConfigOptionFloat(1));
2973 
2974     def = this->add("support_critical_angle", coFloat);
2975     def->label = L("Critical angle");
2976     def->category = L("Supports");
2977     def->tooltip = L("The default angle for connecting support sticks and junctions.");
2978     def->sidetext = L("°");
2979     def->min = 0;
2980     def->max = 90;
2981     def->mode = comExpert;
2982     def->set_default_value(new ConfigOptionFloat(45));
2983 
2984     def = this->add("support_max_bridge_length", coFloat);
2985     def->label = L("Max bridge length");
2986     def->category = L("Supports");
2987     def->tooltip = L("The max length of a bridge");
2988     def->sidetext = L("mm");
2989     def->min = 0;
2990     def->mode = comAdvanced;
2991     def->set_default_value(new ConfigOptionFloat(15.0));
2992 
2993     def = this->add("support_max_pillar_link_distance", coFloat);
2994     def->label = L("Max pillar linking distance");
2995     def->category = L("Supports");
2996     def->tooltip = L("The max distance of two pillars to get linked with each other."
2997                      " A zero value will prohibit pillar cascading.");
2998     def->sidetext = L("mm");
2999     def->min = 0;   // 0 means no linking
3000     def->mode = comAdvanced;
3001     def->set_default_value(new ConfigOptionFloat(10.0));
3002 
3003     def = this->add("support_object_elevation", coFloat);
3004     def->label = L("Object elevation");
3005     def->category = L("Supports");
3006     def->tooltip = L("How much the supports should lift up the supported object. "
3007                      "If \"Pad around object\" is enabled, this value is ignored.");
3008     def->sidetext = L("mm");
3009     def->min = 0;
3010     def->max = 150; // This is the max height of print on SL1
3011     def->mode = comAdvanced;
3012     def->set_default_value(new ConfigOptionFloat(5.0));
3013 
3014     def = this->add("support_points_density_relative", coInt);
3015     def->label = L("Support points density");
3016     def->category = L("Supports");
3017     def->tooltip = L("This is a relative measure of support points density.");
3018     def->sidetext = L("%");
3019     def->min = 0;
3020     def->set_default_value(new ConfigOptionInt(100));
3021 
3022     def = this->add("support_points_minimal_distance", coFloat);
3023     def->label = L("Minimal distance of the support points");
3024     def->category = L("Supports");
3025     def->tooltip = L("No support points will be placed closer than this threshold.");
3026     def->sidetext = L("mm");
3027     def->min = 0;
3028     def->set_default_value(new ConfigOptionFloat(1.f));
3029 
3030     def = this->add("pad_enable", coBool);
3031     def->label = L("Use pad");
3032     def->category = L("Pad");
3033     def->tooltip = L("Add a pad underneath the supported model");
3034     def->mode = comSimple;
3035     def->set_default_value(new ConfigOptionBool(true));
3036 
3037     def = this->add("pad_wall_thickness", coFloat);
3038     def->label = L("Pad wall thickness");
3039     def->category = L("Pad");
3040      def->tooltip = L("The thickness of the pad and its optional cavity walls.");
3041     def->sidetext = L("mm");
3042     def->min = 0;
3043     def->max = 30;
3044     def->mode = comSimple;
3045     def->set_default_value(new ConfigOptionFloat(2.0));
3046 
3047     def = this->add("pad_wall_height", coFloat);
3048     def->label = L("Pad wall height");
3049     def->tooltip = L("Defines the pad cavity depth. Set to zero to disable the cavity. "
3050                      "Be careful when enabling this feature, as some resins may "
3051                      "produce an extreme suction effect inside the cavity, "
3052                      "which makes peeling the print off the vat foil difficult.");
3053     def->category = L("Pad");
3054 //     def->tooltip = L("");
3055     def->sidetext = L("mm");
3056     def->min = 0;
3057     def->max = 30;
3058     def->mode = comExpert;
3059     def->set_default_value(new ConfigOptionFloat(0.));
3060 
3061     def = this->add("pad_brim_size", coFloat);
3062     def->label = L("Pad brim size");
3063     def->tooltip = L("How far should the pad extend around the contained geometry");
3064     def->category = L("Pad");
3065     //     def->tooltip = L("");
3066     def->sidetext = L("mm");
3067     def->min = 0;
3068     def->max = 30;
3069     def->mode = comAdvanced;
3070     def->set_default_value(new ConfigOptionFloat(1.6));
3071 
3072     def = this->add("pad_max_merge_distance", coFloat);
3073     def->label = L("Max merge distance");
3074     def->category = L("Pad");
3075      def->tooltip = L("Some objects can get along with a few smaller pads "
3076                       "instead of a single big one. This parameter defines "
3077                       "how far the center of two smaller pads should be. If they"
3078                       "are closer, they will get merged into one pad.");
3079     def->sidetext = L("mm");
3080     def->min = 0;
3081     def->mode = comExpert;
3082     def->set_default_value(new ConfigOptionFloat(50.0));
3083 
3084     // This is disabled on the UI. I hope it will never be enabled.
3085 //    def = this->add("pad_edge_radius", coFloat);
3086 //    def->label = L("Pad edge radius");
3087 //    def->category = L("Pad");
3088 ////     def->tooltip = L("");
3089 //    def->sidetext = L("mm");
3090 //    def->min = 0;
3091 //    def->mode = comAdvanced;
3092 //    def->set_default_value(new ConfigOptionFloat(1.0));
3093 
3094     def = this->add("pad_wall_slope", coFloat);
3095     def->label = L("Pad wall slope");
3096     def->category = L("Pad");
3097     def->tooltip = L("The slope of the pad wall relative to the bed plane. "
3098                      "90 degrees means straight walls.");
3099     def->sidetext = L("°");
3100     def->min = 45;
3101     def->max = 90;
3102     def->mode = comAdvanced;
3103     def->set_default_value(new ConfigOptionFloat(90.0));
3104 
3105     def = this->add("pad_around_object", coBool);
3106     def->label = L("Pad around object");
3107     def->category = L("Pad");
3108     def->tooltip = L("Create pad around object and ignore the support elevation");
3109     def->mode = comSimple;
3110     def->set_default_value(new ConfigOptionBool(false));
3111 
3112     def = this->add("pad_around_object_everywhere", coBool);
3113     def->label = L("Pad around object everywhere");
3114     def->category = L("Pad");
3115     def->tooltip = L("Force pad around object everywhere");
3116     def->mode = comSimple;
3117     def->set_default_value(new ConfigOptionBool(false));
3118 
3119     def = this->add("pad_object_gap", coFloat);
3120     def->label = L("Pad object gap");
3121     def->category = L("Pad");
3122     def->tooltip  = L("The gap between the object bottom and the generated "
3123                       "pad in zero elevation mode.");
3124     def->sidetext = L("mm");
3125     def->min = 0;
3126     def->max = 10;
3127     def->mode = comExpert;
3128     def->set_default_value(new ConfigOptionFloat(1));
3129 
3130     def = this->add("pad_object_connector_stride", coFloat);
3131     def->label = L("Pad object connector stride");
3132     def->category = L("Pad");
3133     def->tooltip = L("Distance between two connector sticks which connect the object and the generated pad.");
3134     def->sidetext = L("mm");
3135     def->min = 0;
3136     def->mode = comExpert;
3137     def->set_default_value(new ConfigOptionFloat(10));
3138 
3139     def = this->add("pad_object_connector_width", coFloat);
3140     def->label = L("Pad object connector width");
3141     def->category = L("Pad");
3142     def->tooltip  = L("Width of the connector sticks which connect the object and the generated pad.");
3143     def->sidetext = L("mm");
3144     def->min = 0;
3145     def->mode = comExpert;
3146     def->set_default_value(new ConfigOptionFloat(0.5));
3147 
3148     def = this->add("pad_object_connector_penetration", coFloat);
3149     def->label = L("Pad object connector penetration");
3150     def->category = L("Pad");
3151     def->tooltip  = L(
3152         "How much should the tiny connectors penetrate into the model body.");
3153     def->sidetext = L("mm");
3154     def->min = 0;
3155     def->mode = comExpert;
3156     def->set_default_value(new ConfigOptionFloat(0.3));
3157 
3158     def = this->add("hollowing_enable", coBool);
3159     def->label = L("Enable hollowing");
3160     def->category = L("Hollowing");
3161     def->tooltip = L("Hollow out a model to have an empty interior");
3162     def->mode = comSimple;
3163     def->set_default_value(new ConfigOptionBool(false));
3164 
3165     def = this->add("hollowing_min_thickness", coFloat);
3166     def->label = L("Wall thickness");
3167     def->category = L("Hollowing");
3168     def->tooltip  = L("Minimum wall thickness of a hollowed model.");
3169     def->sidetext = L("mm");
3170     def->min = 1;
3171     def->max = 10;
3172     def->mode = comSimple;
3173     def->set_default_value(new ConfigOptionFloat(3.));
3174 
3175     def = this->add("hollowing_quality", coFloat);
3176     def->label = L("Accuracy");
3177     def->category = L("Hollowing");
3178     def->tooltip  = L("Performance vs accuracy of calculation. Lower values may produce unwanted artifacts.");
3179     def->min = 0;
3180     def->max = 1;
3181     def->mode = comExpert;
3182     def->set_default_value(new ConfigOptionFloat(0.5));
3183 
3184     def = this->add("hollowing_closing_distance", coFloat);
3185     def->label = L("Closing distance");
3186     def->category = L("Hollowing");
3187     def->tooltip  = L(
3188         "Hollowing is done in two steps: first, an imaginary interior is "
3189         "calculated deeper (offset plus the closing distance) in the object and "
3190         "then it's inflated back to the specified offset. A greater closing "
3191         "distance makes the interior more rounded. At zero, the interior will "
3192         "resemble the exterior the most.");
3193     def->sidetext = L("mm");
3194     def->min = 0;
3195     def->max = 10;
3196     def->mode = comExpert;
3197     def->set_default_value(new ConfigOptionFloat(2.0));
3198 }
3199 
handle_legacy(t_config_option_key & opt_key,std::string & value)3200 void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &value)
3201 {
3202     // handle legacy options
3203     if (opt_key == "extrusion_width_ratio" || opt_key == "bottom_layer_speed_ratio"
3204         || opt_key == "first_layer_height_ratio") {
3205         boost::replace_first(opt_key, "_ratio", "");
3206         if (opt_key == "bottom_layer_speed") opt_key = "first_layer_speed";
3207         try {
3208             float v = boost::lexical_cast<float>(value);
3209             if (v != 0)
3210                 value = boost::lexical_cast<std::string>(v*100) + "%";
3211         } catch (boost::bad_lexical_cast &) {
3212             value = "0";
3213         }
3214     } else if (opt_key == "gcode_flavor" && value == "makerbot") {
3215         value = "makerware";
3216     } else if (opt_key == "fill_density" && value.find("%") == std::string::npos) {
3217         try {
3218             // fill_density was turned into a percent value
3219             float v = boost::lexical_cast<float>(value);
3220             value = boost::lexical_cast<std::string>(v*100) + "%";
3221         } catch (boost::bad_lexical_cast &) {}
3222     } else if (opt_key == "randomize_start" && value == "1") {
3223         opt_key = "seam_position";
3224         value = "random";
3225     } else if (opt_key == "bed_size" && !value.empty()) {
3226         opt_key = "bed_shape";
3227         ConfigOptionPoint p;
3228         p.deserialize(value, ForwardCompatibilitySubstitutionRule::Disable);
3229         std::ostringstream oss;
3230         oss << "0x0," << p.value(0) << "x0," << p.value(0) << "x" << p.value(1) << ",0x" << p.value(1);
3231         value = oss.str();
3232     } else if ((opt_key == "perimeter_acceleration" && value == "25")
3233         || (opt_key == "infill_acceleration" && value == "50")) {
3234         /*  For historical reasons, the world's full of configs having these very low values;
3235             to avoid unexpected behavior we need to ignore them. Banning these two hard-coded
3236             values is a dirty hack and will need to be removed sometime in the future, but it
3237             will avoid lots of complaints for now. */
3238         value = "0";
3239     } else if (opt_key == "support_material_pattern" && value == "pillars") {
3240         // Slic3r PE does not support the pillars. They never worked well.
3241         value = "rectilinear";
3242     } else if (opt_key == "skirt_height" && value == "-1") {
3243     	// PrusaSlicer no more accepts skirt_height == -1 to print a draft shield to the top of the highest object.
3244     	// A new "draft_shield" boolean config value is used instead.
3245     	opt_key = "draft_shield";
3246     	value = "1";
3247     } else if (opt_key == "octoprint_host") {
3248         opt_key = "print_host";
3249     } else if (opt_key == "octoprint_cafile") {
3250         opt_key = "printhost_cafile";
3251     } else if (opt_key == "octoprint_apikey") {
3252         opt_key = "printhost_apikey";
3253     }
3254 
3255     // Ignore the following obsolete configuration keys:
3256     static std::set<std::string> ignore = {
3257         "duplicate_x", "duplicate_y", "gcode_arcs", "multiply_x", "multiply_y",
3258         "support_material_tool", "acceleration", "adjust_overhang_flow",
3259         "standby_temperature", "scale", "rotate", "duplicate", "duplicate_grid",
3260         "start_perimeters_at_concave_points", "start_perimeters_at_non_overhang", "randomize_start",
3261         "seal_position", "vibration_limit", "bed_size",
3262         "print_center", "g0", "threads", "pressure_advance", "wipe_tower_per_color_wipe"
3263 #ifndef HAS_PRESSURE_EQUALIZER
3264         , "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
3265 #endif /* HAS_PRESSURE_EQUALIZER */
3266         "serial_port", "serial_speed"
3267     };
3268 
3269     // In PrusaSlicer 2.3.0-alpha0 the "monotonous" infill was introduced, which was later renamed to "monotonic".
3270     if (value == "monotonous" && (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern" || opt_key == "fill_pattern"))
3271         value = "monotonic";
3272 
3273     if (ignore.find(opt_key) != ignore.end()) {
3274         opt_key = "";
3275         return;
3276     }
3277 
3278     if (! print_config_def.has(opt_key)) {
3279         opt_key = "";
3280         return;
3281     }
3282 }
3283 
3284 const PrintConfigDef print_config_def;
3285 
full_print_config()3286 DynamicPrintConfig DynamicPrintConfig::full_print_config()
3287 {
3288 	return DynamicPrintConfig((const PrintRegionConfig&)FullPrintConfig::defaults());
3289 }
3290 
DynamicPrintConfig(const StaticPrintConfig & rhs)3291 DynamicPrintConfig::DynamicPrintConfig(const StaticPrintConfig& rhs) : DynamicConfig(rhs, rhs.keys_ref())
3292 {
3293 }
3294 
new_from_defaults_keys(const std::vector<std::string> & keys)3295 DynamicPrintConfig* DynamicPrintConfig::new_from_defaults_keys(const std::vector<std::string> &keys)
3296 {
3297     auto *out = new DynamicPrintConfig();
3298     out->apply_only(FullPrintConfig::defaults(), keys);
3299     return out;
3300 }
3301 
min_object_distance(const ConfigBase & cfg)3302 double min_object_distance(const ConfigBase &cfg)
3303 {
3304     double ret = 0.;
3305 
3306     if (printer_technology(cfg) == ptSLA) ret = 6.;
3307     else {
3308         auto ecr_opt = cfg.option<ConfigOptionFloat>("extruder_clearance_radius");
3309         auto dd_opt  = cfg.option<ConfigOptionFloat>("duplicate_distance");
3310         auto co_opt  = cfg.option<ConfigOptionBool>("complete_objects");
3311 
3312         if (!ecr_opt || !dd_opt || !co_opt) ret = 0.;
3313         else {
3314             // min object distance is max(duplicate_distance, clearance_radius)
3315             ret = (co_opt->value && ecr_opt->value > dd_opt->value) ?
3316                       ecr_opt->value : dd_opt->value;
3317         }
3318     }
3319 
3320     return ret;
3321 }
3322 
printer_technology(const ConfigBase & cfg)3323 PrinterTechnology printer_technology(const ConfigBase &cfg)
3324 {
3325     const ConfigOptionEnum<PrinterTechnology> *opt = cfg.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology");
3326 
3327     if (opt) return opt->value;
3328 
3329     const ConfigOptionBool *export_opt = cfg.option<ConfigOptionBool>("export_sla");
3330     if (export_opt && export_opt->getBool()) return ptSLA;
3331 
3332     export_opt = cfg.option<ConfigOptionBool>("export_gcode");
3333     if (export_opt && export_opt->getBool()) return ptFFF;
3334 
3335     return ptUnknown;
3336 }
3337 
normalize_fdm()3338 void DynamicPrintConfig::normalize_fdm()
3339 {
3340     if (this->has("extruder")) {
3341         int extruder = this->option("extruder")->getInt();
3342         this->erase("extruder");
3343         if (extruder != 0) {
3344             if (!this->has("infill_extruder"))
3345                 this->option("infill_extruder", true)->setInt(extruder);
3346             if (!this->has("perimeter_extruder"))
3347                 this->option("perimeter_extruder", true)->setInt(extruder);
3348             // Don't propagate the current extruder to support.
3349             // For non-soluble supports, the default "0" extruder means to use the active extruder,
3350             // for soluble supports one certainly does not want to set the extruder to non-soluble.
3351             // if (!this->has("support_material_extruder"))
3352             //     this->option("support_material_extruder", true)->setInt(extruder);
3353             // if (!this->has("support_material_interface_extruder"))
3354             //     this->option("support_material_interface_extruder", true)->setInt(extruder);
3355         }
3356     }
3357 
3358     if (!this->has("solid_infill_extruder") && this->has("infill_extruder"))
3359         this->option("solid_infill_extruder", true)->setInt(this->option("infill_extruder")->getInt());
3360 
3361     if (this->has("spiral_vase") && this->opt<ConfigOptionBool>("spiral_vase", true)->value) {
3362         {
3363             // this should be actually done only on the spiral layers instead of all
3364             auto* opt = this->opt<ConfigOptionBools>("retract_layer_change", true);
3365             opt->values.assign(opt->values.size(), false);  // set all values to false
3366             // Disable retract on layer change also for filament overrides.
3367             auto* opt_n = this->opt<ConfigOptionBoolsNullable>("filament_retract_layer_change", true);
3368             opt_n->values.assign(opt_n->values.size(), false);  // Set all values to false.
3369         }
3370         {
3371             this->opt<ConfigOptionInt>("perimeters", true)->value       = 1;
3372             this->opt<ConfigOptionInt>("top_solid_layers", true)->value = 0;
3373             this->opt<ConfigOptionPercent>("fill_density", true)->value = 0;
3374         }
3375     }
3376 }
3377 
set_num_extruders(unsigned int num_extruders)3378 void DynamicPrintConfig::set_num_extruders(unsigned int num_extruders)
3379 {
3380     const auto &defaults = FullPrintConfig::defaults();
3381     for (const std::string &key : print_config_def.extruder_option_keys()) {
3382         if (key == "default_filament_profile")
3383             // Don't resize this field, as it is presented to the user at the "Dependencies" page of the Printer profile and we don't want to present
3384             // empty fields there, if not defined by the system profile.
3385             continue;
3386         auto *opt = this->option(key, false);
3387         assert(opt != nullptr);
3388         assert(opt->is_vector());
3389         if (opt != nullptr && opt->is_vector())
3390             static_cast<ConfigOptionVectorBase*>(opt)->resize(num_extruders, defaults.option(key));
3391     }
3392 }
3393 
validate()3394 std::string DynamicPrintConfig::validate()
3395 {
3396     // Full print config is initialized from the defaults.
3397     const ConfigOption *opt = this->option("printer_technology", false);
3398     auto printer_technology = (opt == nullptr) ? ptFFF : static_cast<PrinterTechnology>(dynamic_cast<const ConfigOptionEnumGeneric*>(opt)->value);
3399     switch (printer_technology) {
3400     case ptFFF:
3401     {
3402         FullPrintConfig fpc;
3403         fpc.apply(*this, true);
3404         // Verify this print options through the FullPrintConfig.
3405         return fpc.validate();
3406     }
3407     default:
3408         //FIXME no validation on SLA data?
3409         return std::string();
3410     }
3411 }
3412 
3413 //FIXME localize this function.
validate()3414 std::string FullPrintConfig::validate()
3415 {
3416     // --layer-height
3417     if (this->get_abs_value("layer_height") <= 0)
3418         return "Invalid value for --layer-height";
3419     if (fabs(fmod(this->get_abs_value("layer_height"), SCALING_FACTOR)) > 1e-4)
3420         return "--layer-height must be a multiple of print resolution";
3421 
3422     // --first-layer-height
3423     if (this->get_abs_value("first_layer_height") <= 0)
3424         return "Invalid value for --first-layer-height";
3425 
3426     // --filament-diameter
3427     for (double fd : this->filament_diameter.values)
3428         if (fd < 1)
3429             return "Invalid value for --filament-diameter";
3430 
3431     // --nozzle-diameter
3432     for (double nd : this->nozzle_diameter.values)
3433         if (nd < 0.005)
3434             return "Invalid value for --nozzle-diameter";
3435 
3436     // --perimeters
3437     if (this->perimeters.value < 0)
3438         return "Invalid value for --perimeters";
3439 
3440     // --solid-layers
3441     if (this->top_solid_layers < 0)
3442         return "Invalid value for --top-solid-layers";
3443     if (this->bottom_solid_layers < 0)
3444         return "Invalid value for --bottom-solid-layers";
3445 
3446     if (this->use_firmware_retraction.value &&
3447         this->gcode_flavor.value != gcfSmoothie &&
3448         this->gcode_flavor.value != gcfRepRapSprinter &&
3449         this->gcode_flavor.value != gcfRepRapFirmware &&
3450         this->gcode_flavor.value != gcfMarlin &&
3451         this->gcode_flavor.value != gcfMachinekit &&
3452         this->gcode_flavor.value != gcfRepetier)
3453         return "--use-firmware-retraction is only supported by Marlin, Smoothie, RepRapFirmware, Repetier and Machinekit firmware";
3454 
3455     if (this->use_firmware_retraction.value)
3456         for (unsigned char wipe : this->wipe.values)
3457              if (wipe)
3458                 return "--use-firmware-retraction is not compatible with --wipe";
3459 
3460     // --gcode-flavor
3461     if (! print_config_def.get("gcode_flavor")->has_enum_value(this->gcode_flavor.serialize()))
3462         return "Invalid value for --gcode-flavor";
3463 
3464     // --fill-pattern
3465     if (! print_config_def.get("fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
3466         return "Invalid value for --fill-pattern";
3467 
3468     // --top-fill-pattern
3469     if (! print_config_def.get("top_fill_pattern")->has_enum_value(this->top_fill_pattern.serialize()))
3470         return "Invalid value for --top-fill-pattern";
3471 
3472     // --bottom-fill-pattern
3473     if (! print_config_def.get("bottom_fill_pattern")->has_enum_value(this->bottom_fill_pattern.serialize()))
3474         return "Invalid value for --bottom-fill-pattern";
3475 
3476     // --fill-density
3477     if (fabs(this->fill_density.value - 100.) < EPSILON &&
3478         ! print_config_def.get("top_fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
3479         return "The selected fill pattern is not supposed to work at 100% density";
3480 
3481     // --infill-every-layers
3482     if (this->infill_every_layers < 1)
3483         return "Invalid value for --infill-every-layers";
3484 
3485     // --skirt-height
3486     if (this->skirt_height < 0)
3487         return "Invalid value for --skirt-height";
3488 
3489     // --bridge-flow-ratio
3490     if (this->bridge_flow_ratio <= 0)
3491         return "Invalid value for --bridge-flow-ratio";
3492 
3493     // extruder clearance
3494     if (this->extruder_clearance_radius <= 0)
3495         return "Invalid value for --extruder-clearance-radius";
3496     if (this->extruder_clearance_height <= 0)
3497         return "Invalid value for --extruder-clearance-height";
3498 
3499     // --extrusion-multiplier
3500     for (double em : this->extrusion_multiplier.values)
3501         if (em <= 0)
3502             return "Invalid value for --extrusion-multiplier";
3503 
3504     // --default-acceleration
3505     if ((this->perimeter_acceleration != 0. || this->infill_acceleration != 0. || this->bridge_acceleration != 0. || this->first_layer_acceleration != 0.) &&
3506         this->default_acceleration == 0.)
3507         return "Invalid zero value for --default-acceleration when using other acceleration settings";
3508 
3509     // --spiral-vase
3510     if (this->spiral_vase) {
3511         // Note that we might want to have more than one perimeter on the bottom
3512         // solid layers.
3513         if (this->perimeters > 1)
3514             return "Can't make more than one perimeter when spiral vase mode is enabled";
3515         else if (this->perimeters < 1)
3516             return "Can't make less than one perimeter when spiral vase mode is enabled";
3517         if (this->fill_density > 0)
3518             return "Spiral vase mode can only print hollow objects, so you need to set Fill density to 0";
3519         if (this->top_solid_layers > 0)
3520             return "Spiral vase mode is not compatible with top solid layers";
3521         if (this->support_material || this->support_material_enforce_layers > 0)
3522             return "Spiral vase mode is not compatible with support material";
3523     }
3524 
3525     // extrusion widths
3526     {
3527         double max_nozzle_diameter = 0.;
3528         for (double dmr : this->nozzle_diameter.values)
3529             max_nozzle_diameter = std::max(max_nozzle_diameter, dmr);
3530         const char *widths[] = { "external_perimeter", "perimeter", "infill", "solid_infill", "top_infill", "support_material", "first_layer" };
3531         for (size_t i = 0; i < sizeof(widths) / sizeof(widths[i]); ++ i) {
3532             std::string key(widths[i]);
3533             key += "_extrusion_width";
3534             if (this->get_abs_value(key, max_nozzle_diameter) > 10. * max_nozzle_diameter)
3535                 return std::string("Invalid extrusion width (too large): ") + key;
3536         }
3537     }
3538 
3539     // Out of range validation of numeric values.
3540     for (const std::string &opt_key : this->keys()) {
3541         const ConfigOption      *opt    = this->optptr(opt_key);
3542         assert(opt != nullptr);
3543         const ConfigOptionDef   *optdef = print_config_def.get(opt_key);
3544         assert(optdef != nullptr);
3545         bool out_of_range = false;
3546         switch (opt->type()) {
3547         case coFloat:
3548         case coPercent:
3549         case coFloatOrPercent:
3550         {
3551             auto *fopt = static_cast<const ConfigOptionFloat*>(opt);
3552             out_of_range = fopt->value < optdef->min || fopt->value > optdef->max;
3553             break;
3554         }
3555         case coFloats:
3556         case coPercents:
3557             for (double v : static_cast<const ConfigOptionVector<double>*>(opt)->values)
3558                 if (v < optdef->min || v > optdef->max) {
3559                     out_of_range = true;
3560                     break;
3561                 }
3562             break;
3563         case coInt:
3564         {
3565             auto *iopt = static_cast<const ConfigOptionInt*>(opt);
3566             out_of_range = iopt->value < optdef->min || iopt->value > optdef->max;
3567             break;
3568         }
3569         case coInts:
3570             for (int v : static_cast<const ConfigOptionVector<int>*>(opt)->values)
3571                 if (v < optdef->min || v > optdef->max) {
3572                     out_of_range = true;
3573                     break;
3574                 }
3575             break;
3576         default:;
3577         }
3578         if (out_of_range)
3579             return std::string("Value out of range: " + opt_key);
3580     }
3581 
3582     // The configuration is valid.
3583     return "";
3584 }
3585 
3586 // Declare the static caches for each StaticPrintConfig derived class.
3587 StaticPrintConfig::StaticCache<class Slic3r::PrintObjectConfig> PrintObjectConfig::s_cache_PrintObjectConfig;
3588 StaticPrintConfig::StaticCache<class Slic3r::PrintRegionConfig> PrintRegionConfig::s_cache_PrintRegionConfig;
3589 StaticPrintConfig::StaticCache<class Slic3r::MachineEnvelopeConfig> MachineEnvelopeConfig::s_cache_MachineEnvelopeConfig;
3590 StaticPrintConfig::StaticCache<class Slic3r::GCodeConfig>       GCodeConfig::s_cache_GCodeConfig;
3591 StaticPrintConfig::StaticCache<class Slic3r::PrintConfig>       PrintConfig::s_cache_PrintConfig;
3592 StaticPrintConfig::StaticCache<class Slic3r::FullPrintConfig>   FullPrintConfig::s_cache_FullPrintConfig;
3593 
3594 StaticPrintConfig::StaticCache<class Slic3r::SLAMaterialConfig>     SLAMaterialConfig::s_cache_SLAMaterialConfig;
3595 StaticPrintConfig::StaticCache<class Slic3r::SLAPrintConfig>        SLAPrintConfig::s_cache_SLAPrintConfig;
3596 StaticPrintConfig::StaticCache<class Slic3r::SLAPrintObjectConfig>  SLAPrintObjectConfig::s_cache_SLAPrintObjectConfig;
3597 StaticPrintConfig::StaticCache<class Slic3r::SLAPrinterConfig>      SLAPrinterConfig::s_cache_SLAPrinterConfig;
3598 StaticPrintConfig::StaticCache<class Slic3r::SLAFullPrintConfig>    SLAFullPrintConfig::s_cache_SLAFullPrintConfig;
3599 
CLIActionsConfigDef()3600 CLIActionsConfigDef::CLIActionsConfigDef()
3601 {
3602     ConfigOptionDef* def;
3603 
3604     // Actions:
3605     def = this->add("export_obj", coBool);
3606     def->label = L("Export OBJ");
3607     def->tooltip = L("Export the model(s) as OBJ.");
3608     def->set_default_value(new ConfigOptionBool(false));
3609 
3610 /*
3611     def = this->add("export_svg", coBool);
3612     def->label = L("Export SVG");
3613     def->tooltip = L("Slice the model and export solid slices as SVG.");
3614     def->set_default_value(new ConfigOptionBool(false));
3615 */
3616 
3617     def = this->add("export_sla", coBool);
3618     def->label = L("Export SLA");
3619     def->tooltip = L("Slice the model and export SLA printing layers as PNG.");
3620     def->cli = "export-sla|sla";
3621     def->set_default_value(new ConfigOptionBool(false));
3622 
3623     def = this->add("export_3mf", coBool);
3624     def->label = L("Export 3MF");
3625     def->tooltip = L("Export the model(s) as 3MF.");
3626     def->set_default_value(new ConfigOptionBool(false));
3627 
3628     def = this->add("export_amf", coBool);
3629     def->label = L("Export AMF");
3630     def->tooltip = L("Export the model(s) as AMF.");
3631     def->set_default_value(new ConfigOptionBool(false));
3632 
3633     def = this->add("export_stl", coBool);
3634     def->label = L("Export STL");
3635     def->tooltip = L("Export the model(s) as STL.");
3636     def->set_default_value(new ConfigOptionBool(false));
3637 
3638     def = this->add("export_gcode", coBool);
3639     def->label = L("Export G-code");
3640     def->tooltip = L("Slice the model and export toolpaths as G-code.");
3641     def->cli = "export-gcode|gcode|g";
3642     def->set_default_value(new ConfigOptionBool(false));
3643 
3644     def = this->add("gcodeviewer", coBool);
3645     def->label = L("G-code viewer");
3646     def->tooltip = L("Visualize an already sliced and saved G-code");
3647     def->cli = "gcodeviewer";
3648     def->set_default_value(new ConfigOptionBool(false));
3649 
3650     def = this->add("slice", coBool);
3651     def->label = L("Slice");
3652     def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value.");
3653     def->cli = "slice|s";
3654     def->set_default_value(new ConfigOptionBool(false));
3655 
3656     def = this->add("help", coBool);
3657     def->label = L("Help");
3658     def->tooltip = L("Show this help.");
3659     def->cli = "help|h";
3660     def->set_default_value(new ConfigOptionBool(false));
3661 
3662     def = this->add("help_fff", coBool);
3663     def->label = L("Help (FFF options)");
3664     def->tooltip = L("Show the full list of print/G-code configuration options.");
3665     def->set_default_value(new ConfigOptionBool(false));
3666 
3667     def = this->add("help_sla", coBool);
3668     def->label = L("Help (SLA options)");
3669     def->tooltip = L("Show the full list of SLA print configuration options.");
3670     def->set_default_value(new ConfigOptionBool(false));
3671 
3672     def = this->add("info", coBool);
3673     def->label = L("Output Model Info");
3674     def->tooltip = L("Write information about the model to the console.");
3675     def->set_default_value(new ConfigOptionBool(false));
3676 
3677     def = this->add("save", coString);
3678     def->label = L("Save config file");
3679     def->tooltip = L("Save configuration to the specified file.");
3680     def->set_default_value(new ConfigOptionString());
3681 }
3682 
CLITransformConfigDef()3683 CLITransformConfigDef::CLITransformConfigDef()
3684 {
3685     ConfigOptionDef* def;
3686 
3687     // Transform options:
3688     def = this->add("align_xy", coPoint);
3689     def->label = L("Align XY");
3690     def->tooltip = L("Align the model to the given point.");
3691     def->set_default_value(new ConfigOptionPoint(Vec2d(100,100)));
3692 
3693     def = this->add("cut", coFloat);
3694     def->label = L("Cut");
3695     def->tooltip = L("Cut model at the given Z.");
3696     def->set_default_value(new ConfigOptionFloat(0));
3697 
3698 /*
3699     def = this->add("cut_grid", coFloat);
3700     def->label = L("Cut");
3701     def->tooltip = L("Cut model in the XY plane into tiles of the specified max size.");
3702     def->set_default_value(new ConfigOptionPoint());
3703 
3704     def = this->add("cut_x", coFloat);
3705     def->label = L("Cut");
3706     def->tooltip = L("Cut model at the given X.");
3707     def->set_default_value(new ConfigOptionFloat(0));
3708 
3709     def = this->add("cut_y", coFloat);
3710     def->label = L("Cut");
3711     def->tooltip = L("Cut model at the given Y.");
3712     def->set_default_value(new ConfigOptionFloat(0));
3713 */
3714 
3715     def = this->add("center", coPoint);
3716     def->label = L("Center");
3717     def->tooltip = L("Center the print around the given center.");
3718     def->set_default_value(new ConfigOptionPoint(Vec2d(100,100)));
3719 
3720     def = this->add("dont_arrange", coBool);
3721     def->label = L("Don't arrange");
3722     def->tooltip = L("Do not rearrange the given models before merging and keep their original XY coordinates.");
3723 
3724     def = this->add("duplicate", coInt);
3725     def->label = L("Duplicate");
3726     def->tooltip =L("Multiply copies by this factor.");
3727     def->min = 1;
3728 
3729     def = this->add("duplicate_grid", coPoint);
3730     def->label = L("Duplicate by grid");
3731     def->tooltip = L("Multiply copies by creating a grid.");
3732 
3733     def = this->add("merge", coBool);
3734     def->label = L("Merge");
3735     def->tooltip = L("Arrange the supplied models in a plate and merge them in a single model in order to perform actions once.");
3736     def->cli = "merge|m";
3737 
3738     def = this->add("repair", coBool);
3739     def->label = L("Repair");
3740     def->tooltip = L("Try to repair any non-manifold meshes (this option is implicitly added whenever we need to slice the model to perform the requested action).");
3741 
3742     def = this->add("rotate", coFloat);
3743     def->label = L("Rotate");
3744     def->tooltip = L("Rotation angle around the Z axis in degrees.");
3745     def->set_default_value(new ConfigOptionFloat(0));
3746 
3747     def = this->add("rotate_x", coFloat);
3748     def->label = L("Rotate around X");
3749     def->tooltip = L("Rotation angle around the X axis in degrees.");
3750     def->set_default_value(new ConfigOptionFloat(0));
3751 
3752     def = this->add("rotate_y", coFloat);
3753     def->label = L("Rotate around Y");
3754     def->tooltip = L("Rotation angle around the Y axis in degrees.");
3755     def->set_default_value(new ConfigOptionFloat(0));
3756 
3757     def = this->add("scale", coFloatOrPercent);
3758     def->label = L("Scale");
3759     def->tooltip = L("Scaling factor or percentage.");
3760     def->set_default_value(new ConfigOptionFloatOrPercent(1, false));
3761 
3762     def = this->add("split", coBool);
3763     def->label = L("Split");
3764     def->tooltip = L("Detect unconnected parts in the given model(s) and split them into separate objects.");
3765 
3766     def = this->add("scale_to_fit", coPoint3);
3767     def->label = L("Scale to Fit");
3768     def->tooltip = L("Scale to fit the given volume.");
3769     def->set_default_value(new ConfigOptionPoint3(Vec3d(0,0,0)));
3770 }
3771 
CLIMiscConfigDef()3772 CLIMiscConfigDef::CLIMiscConfigDef()
3773 {
3774     ConfigOptionDef* def;
3775 
3776     def = this->add("ignore_nonexistent_config", coBool);
3777     def->label = "Ignore non-existent config files";
3778     def->tooltip = "Do not fail if a file supplied to --load does not exist.";
3779 
3780     def = this->add("config_compatibility", coEnum);
3781     def->label = "Forward-compatibility rule when loading configurations from config files and project files (3MF, AMF).";
3782     def->tooltip = "This version of PrusaSlicer may not understand configurations produced by newest PrusaSlicer versions. "
3783                      "For example, newer PrusaSlicer may extend the list of supported firmware flavors. One may decide to "
3784                      "bail out or to substitute an unknown value with a default silently or verbosely.";
3785     def->enum_keys_map = &ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>::get_enum_values();
3786     def->enum_values.push_back("disable");
3787     def->enum_values.push_back("enable");
3788     def->enum_values.push_back("enable_silent");
3789     def->enum_labels.push_back("Bail out on unknown configuration values");
3790     def->enum_labels.push_back("Enable reading unknown configuration values by verbosely substituting them with defaults.");
3791     def->enum_labels.push_back("Enable reading unknown configuration values by silently substituting them with defaults.");
3792     def->set_default_value(new ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>(ForwardCompatibilitySubstitutionRule::Enable));
3793 
3794     def = this->add("load", coStrings);
3795     def->label = "Load config file";
3796     def->tooltip = "Load configuration from the specified file. It can be used more than once to load options from multiple files.";
3797 
3798     def = this->add("output", coString);
3799     def->label = "Output File";
3800     def->tooltip = "The file where the output will be written (if not specified, it will be based on the input file).";
3801     def->cli = "output|o";
3802 
3803     def = this->add("single_instance", coBool);
3804     def->label = "Single instance mode";
3805     def->tooltip = "If enabled, the command line arguments are sent to an existing instance of GUI PrusaSlicer, "
3806                      "or an existing PrusaSlicer window is activated. "
3807                      "Overrides the \"single_instance\" configuration value from application preferences.";
3808 
3809 /*
3810     def = this->add("autosave", coString);
3811     def->label = "Autosave";
3812     def->tooltip = "Automatically export current configuration to the specified file.";
3813 */
3814 
3815     def = this->add("datadir", coString);
3816     def->label = "Data directory";
3817     def->tooltip = "Load and store settings at the given directory. This is useful for maintaining different profiles or including configurations from a network storage.";
3818 
3819     def = this->add("loglevel", coInt);
3820     def->label = "Logging level";
3821     def->tooltip = "Sets logging sensitivity. 0:fatal, 1:error, 2:warning, 3:info, 4:debug, 5:trace\n"
3822                      "For example. loglevel=2 logs fatal, error and warning level messages.";
3823     def->min = 0;
3824 
3825 #if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(SLIC3R_GUI)
3826     def = this->add("sw_renderer", coBool);
3827     def->label = "Render with a software renderer";
3828     def->tooltip = "Render with a software renderer. The bundled MESA software renderer is loaded instead of the default OpenGL driver.";
3829     def->min = 0;
3830 #endif /* _MSC_VER */
3831 }
3832 
3833 const CLIActionsConfigDef    cli_actions_config_def;
3834 const CLITransformConfigDef  cli_transform_config_def;
3835 const CLIMiscConfigDef       cli_misc_config_def;
3836 
3837 DynamicPrintAndCLIConfig::PrintAndCLIConfigDef DynamicPrintAndCLIConfig::s_def;
3838 
handle_legacy(t_config_option_key & opt_key,std::string & value) const3839 void DynamicPrintAndCLIConfig::handle_legacy(t_config_option_key &opt_key, std::string &value) const
3840 {
3841     if (cli_actions_config_def  .options.find(opt_key) == cli_actions_config_def  .options.end() &&
3842         cli_transform_config_def.options.find(opt_key) == cli_transform_config_def.options.end() &&
3843         cli_misc_config_def     .options.find(opt_key) == cli_misc_config_def     .options.end()) {
3844         PrintConfigDef::handle_legacy(opt_key, value);
3845     }
3846 }
3847 
3848 uint64_t ModelConfig::s_last_timestamp = 1;
3849 
to_points(const std::vector<Vec2d> & dpts)3850 static Points to_points(const std::vector<Vec2d> &dpts)
3851 {
3852     Points pts; pts.reserve(dpts.size());
3853     for (auto &v : dpts)
3854         pts.emplace_back( coord_t(scale_(v.x())), coord_t(scale_(v.y())) );
3855     return pts;
3856 }
3857 
get_bed_shape(const DynamicPrintConfig & config)3858 Points get_bed_shape(const DynamicPrintConfig &config)
3859 {
3860     const auto *bed_shape_opt = config.opt<ConfigOptionPoints>("bed_shape");
3861     if (!bed_shape_opt) {
3862 
3863         // Here, it is certain that the bed shape is missing, so an infinite one
3864         // has to be used, but still, the center of bed can be queried
3865         if (auto center_opt = config.opt<ConfigOptionPoint>("center"))
3866             return { scaled(center_opt->value) };
3867 
3868         return {};
3869     }
3870 
3871     return to_points(bed_shape_opt->values);
3872 }
3873 
get_bed_shape(const PrintConfig & cfg)3874 Points get_bed_shape(const PrintConfig &cfg)
3875 {
3876     return to_points(cfg.bed_shape.values);
3877 }
3878 
get_bed_shape(const SLAPrinterConfig & cfg)3879 Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.bed_shape.values); }
3880 
3881 } // namespace Slic3r
3882 
3883 #include <cereal/types/polymorphic.hpp>
3884 CEREAL_REGISTER_TYPE(Slic3r::DynamicPrintConfig)
3885 CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::DynamicConfig, Slic3r::DynamicPrintConfig)
3886