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

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

Inheritance diagram for Slic3r::CLIMiscConfigDef:
Collaboration diagram for Slic3r::CLIMiscConfigDef:

Public Member Functions

 CLIMiscConfigDef ()
bool has (const t_config_option_key &opt_key) const
const ConfigOptionDef * get (const t_config_option_key &opt_key) const
std::vector< std::string > keys () const
bool empty ()
std::ostream & print_cli_help (std::ostream &out, bool show_defaults, std::function< bool(const ConfigOptionDef &)> filter=[](const ConfigOptionDef &){ return true;}) const

Public Attributes

t_optiondef_map options
std::map< size_t, const ConfigOptionDef * > by_serialization_key_ordinal

Protected Member Functions

ConfigOptionDef * add (const t_config_option_key &opt_key, ConfigOptionType type)
ConfigOptionDef * add_nullable (const t_config_option_key &opt_key, ConfigOptionType type)

Detailed Description

Constructor & Destructor Documentation

◆ CLIMiscConfigDef()

Slic3r::CLIMiscConfigDef::CLIMiscConfigDef ( )
13076{
13077 ConfigOptionDef* def;
13078
13079 /*def = this->add("ignore_nonexistent_config", coBool);
13080 def->label = L("Ignore non-existent config files");
13081 def->tooltip = L("Do not fail if a file supplied to --load does not exist.");
13082
13083 def = this->add("config_compatibility", coEnum);
13084 def->label = L("Forward-compatibility rule when loading configurations from config files and project files (3MF, AMF).");
13085 def->tooltip = L("This version of OrcaSlicer may not understand configurations produced by the newest OrcaSlicer versions. "
13086 "For example, newer OrcaSlicer may extend the list of supported firmware flavors. One may decide to "
13087 "bail out or to substitute an unknown value with a default silently or verbosely.");
13088 def->enum_keys_map = &ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>::get_enum_values();
13089 def->enum_values.push_back("disable");
13090 def->enum_values.push_back("enable");
13091 def->enum_values.push_back("enable_silent");
13092 def->enum_labels.push_back(L("Bail out on unknown configuration values"));
13093 def->enum_labels.push_back(L("Enable reading unknown configuration values by verbosely substituting them with defaults."));
13094 def->enum_labels.push_back(L("Enable reading unknown configuration values by silently substituting them with defaults."));
13095 def->set_default_value(new ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>(ForwardCompatibilitySubstitutionRule::Enable));*/
13096
13097 /*def = this->add("load", coStrings);
13098 def->label = L("Load config file");
13099 def->tooltip = L("Load configuration from the specified file. It can be used more than once to load options from multiple files.");*/
13100
13101 def = this->add("load_settings", coStrings);
13102 def->label = L("Load General Settings");
13103 def->tooltip = L("Load process/machine settings from the specified file.");
13104 def->cli_params = "\"setting1.json;setting2.json\"";
13105 def->set_default_value(new ConfigOptionStrings());
13106
13107 def = this->add("load_filaments", coStrings);
13108 def->label = L("Load Filament Settings");
13109 def->tooltip = L("Load filament settings from the specified file list.");
13110 def->cli_params = "\"filament1.json;filament2.json;...\"";
13111 def->set_default_value(new ConfigOptionStrings());
13112
13113 def = this->add("skip_objects", coInts);
13114 def->label = L("Skip Objects");
13115 def->tooltip = L("Skip some objects in this print.");
13116 def->cli_params = "\"3,5,10,77\"";
13117 def->set_default_value(new ConfigOptionInts());
13118
13119 def = this->add("clone_objects", coInts);
13120 def->label = L("Clone Objects");
13121 def->tooltip = L("Clone objects in the load list.");
13122 def->cli_params = "\"1,3,1,10\"";
13123 def->set_default_value(new ConfigOptionInts());
13124
13125 def = this->add("uptodate_settings", coStrings);
13126 def->label = L("Load uptodate process/machine settings when using uptodate");
13127 def->tooltip = L("load up-to-date process/machine settings from the specified file when using up-to-date");
13128 def->cli_params = "\"setting1.json;setting2.json\"";
13129 def->set_default_value(new ConfigOptionStrings());
13130
13131 def = this->add("uptodate_filaments", coStrings);
13132 def->label = L("Load uptodate filament settings when using uptodate");
13133 def->tooltip = L("Load uptodate filament settings from the specified file when using uptodate.");
13134 def->cli_params = "\"filament1.json;filament2.json;...\"";
13135 def->set_default_value(new ConfigOptionStrings());
13136
13137 def = this->add("downward_check", coBool);
13138 def->label = L("Downward machines check");
13139 def->tooltip = L("If enabled, check whether current machine downward compatible with the machines in the list.");
13140 def->set_default_value(new ConfigOptionBool(false));
13141
13142 def = this->add("downward_settings", coStrings);
13143 def->label = L("Downward machines settings");
13144 def->tooltip = L("The machine settings list needs to do downward checking.");
13145 def->cli_params = "\"machine1.json;machine2.json;...\"";
13146 def->set_default_value(new ConfigOptionStrings());
13147
13148 def = this->add("load_assemble_list", coString);
13149 def->label = L("Load assemble list");
13150 def->tooltip = L("Load assemble object list from config file.");
13151 def->cli_params = "assemble_list.json";
13152 def->set_default_value(new ConfigOptionString());
13153
13154 /*def = this->add("output", coString);
13155 def->label = L("Output File");
13156 def->tooltip = L("The file where the output will be written (if not specified, it will be based on the input file).");
13157 def->cli = "output|o";
13158
13159 def = this->add("single_instance", coBool);
13160 def->label = L("Single instance mode");
13161 def->tooltip = L("If enabled, the command line arguments are sent to an existing instance of GUI OrcaSlicer, "
13162 "or an existing OrcaSlicer window is activated. "
13163 "Overrides the \"single_instance\" configuration value from application preferences.");*/
13164
13165/*
13166 def = this->add("autosave", coString);
13167 def->label = L("Autosave");
13168 def->tooltip = L("Automatically export current configuration to the specified file.");
13169*/
13170
13171 def = this->add("datadir", coString);
13172 def->label = L("Data directory");
13173 def->tooltip = L("Load and store settings at the given directory. This is useful for maintaining different profiles or including configurations from a network storage.");
13174
13175
13176 def = this->add("outputdir", coString);
13177 def->label = L("Output directory");
13178 def->tooltip = L("This is the output directory for exported files.");
13179 def->cli_params = "dir";
13180 def->set_default_value(new ConfigOptionString());
13181
13182 def = this->add("export_statistics", coBool);
13183 def->label = L("Export statistics");
13184 def->tooltip = L("Write the statistics of each sliced plate as JSON, as plate_N.statistics.json next to its G-code in the output "
13185 "directory and inside the 3MF of --export-3mf: print time, filament and feature totals, and the same per layer "
13186 "and per object.");
13187 def->set_default_value(new ConfigOptionBool(false));
13188
13189 def = this->add("debug", coInt);
13190 def->label = L("Debug level");
13191 def->tooltip = L("Sets debug logging level. 0:fatal, 1:error, 2:warning, 3:info, 4:debug, 5:trace\n");
13192 def->min = 0;
13193 def->cli_params = "level";
13194 def->set_default_value(new ConfigOptionInt(1));
13195
13196 def = this->add("logfile", coString);
13197 def->label = L("Log file");
13198 def->tooltip = L("Redirects debug logging to file.\n");
13199 def->cli_params = "file";
13200 def->set_default_value(new ConfigOptionString());
13201
13202 def = this->add("enable_timelapse", coBool);
13203 def->label = L("Enable timelapse for print");
13204 def->tooltip = L("If enabled, this slicing will be considered using timelapse.");
13205 def->set_default_value(new ConfigOptionBool(false));
13206
13207#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(SLIC3R_GUI)
13208 /*def = this->add("sw_renderer", coBool);
13209 def->label = L("Render with a software renderer");
13210 def->tooltip = L("Render with a software renderer. The bundled MESA software renderer is loaded instead of the default OpenGL driver.");
13211 def->min = 0;*/
13212#endif /* _MSC_VER */
13213
13214 def = this->add("load_custom_gcodes", coString);
13215 def->label = L("Load custom G-code");
13216 def->tooltip = L("Load custom G-code from json.");
13217 def->cli_params = "custom_gcode_toolchange.json";
13218 def->set_default_value(new ConfigOptionString());
13219
13220 def = this->add("load_filament_ids", coInts);
13221 def->label = L("Load filament IDs");
13222 def->tooltip = L("Load filament IDs for each object.");
13223 def->cli_params = "\"1,2,3,1\"";
13224 def->set_default_value(new ConfigOptionInts());
13225
13226 def = this->add("allow_multicolor_oneplate", coBool);
13227 def->label = L("Allow multiple colors on one plate");
13228 def->tooltip = L("If enabled, Arrange will allow multiple colors on one plate.");
13229 def->set_default_value(new ConfigOptionBool(true));
13230
13231 def = this->add("allow_rotations", coBool);
13232 def->label = L("Allow rotation when arranging");
13233 def->tooltip = L("If enabled, Arrange will allow rotation when placing objects.");
13234 def->set_default_value(new ConfigOptionBool(false));
13235
13236 def = this->add("align_to_y_axis", coBool);
13237 def->label = L("Align to Y axis when arranging");
13238 def->tooltip = L("If enabled, Arrange will turn each object so its long side runs along the Y axis before placing it. "
13239 "When not given, it is on for i3 printers and off for the others, as in the GUI.");
13240 def->set_default_value(new ConfigOptionBool(false));
13241
13242 def = this->add("avoid_extrusion_cali_region", coBool);
13243 def->label = L("Avoid extrusion calibrate region when arranging");
13244 def->tooltip = L("If enabled, Arrange will avoid extrusion calibrate region when placing objects.");
13245 def->set_default_value(new ConfigOptionBool(false));
13246
13247 def = this->add("skip_modified_gcodes", coBool);
13248 def->label = L("Skip modified G-code in 3MF");
13249 def->tooltip = L("Skip the modified G-code in 3MF from printer or filament presets.");
13250 def->set_default_value(new ConfigOptionBool(false));
13251
13252 def = this->add("makerlab_name", coString);
13253 def->label = L("MakerLab name");
13254 def->tooltip = L("MakerLab name to generate this 3MF.");
13255 def->cli_params = "name";
13256 def->set_default_value(new ConfigOptionString());
13257
13258 def = this->add("makerlab_version", coString);
13259 def->label = L("MakerLab version");
13260 def->tooltip = L("MakerLab version to generate this 3MF.");
13261 def->cli_params = "version";
13262 def->set_default_value(new ConfigOptionString());
13263
13264 def = this->add("metadata_name", coStrings);
13265 def->label = L("Metadata name list");
13266 def->tooltip = L("Metadata name list added into 3MF.");
13267 def->cli_params = "\"name1;name2;...\"";
13268 def->set_default_value(new ConfigOptionStrings());
13269
13270 def = this->add("metadata_value", coStrings);
13271 def->label = L("Metadata value list");
13272 def->tooltip = L("Metadata value list added into 3MF.");
13273 def->cli_params = "\"value1;value2;...\"";
13274 def->set_default_value(new ConfigOptionStrings());
13275
13276 def = this->add("allow_newer_file", coBool);
13277 def->label = L("Allow 3MF with newer version to be sliced");
13278 def->tooltip = L("Allow 3MF with newer version to be sliced.");
13279 def->set_default_value(new ConfigOptionBool(false));
13280
13281 def = this->add("allow_mix_temp", coBool);
13282 // internal use only, don't need translation
13283 def->label = "Allow filaments with high/low temperature to be printed together";
13284 def->tooltip = "Allow filaments with high/low temperature to be printed together.";
13285 def->set_default_value(new ConfigOptionBool(false));
13286}
#define L(s)
Definition ExtrusionEntity.cpp:25
ConfigOptionDef * add(const t_config_option_key &opt_key, ConfigOptionType type)
Definition Config.cpp:363
ConfigOptionIntsTempl< false > ConfigOptionInts
Definition Config.hpp:1154
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702
@ coString
Definition Config.hpp:192
@ coInts
Definition Config.hpp:190
@ coInt
Definition Config.hpp:188
@ coBool
Definition Config.hpp:210
@ coStrings
Definition Config.hpp:194

References Slic3r::ConfigDef::add(), Slic3r::ConfigOptionDef::cli_params, Slic3r::coBool, Slic3r::coInt, Slic3r::coInts, Slic3r::ConfigOptionString, Slic3r::coString, Slic3r::coStrings, L, Slic3r::ConfigOptionDef::label, Slic3r::ConfigOptionDef::min, Slic3r::ConfigOptionDef::set_default_value(), and Slic3r::ConfigOptionDef::tooltip.

Here is the call graph for this function:

Member Function Documentation

◆ add()

ConfigOptionDef * Slic3r::ConfigDef::add ( const t_config_option_key & opt_key,
ConfigOptionType type )
protectedinherited
364{
365 static size_t serialization_key_ordinal_last = 0;
366 ConfigOptionDef *opt = &this->options[opt_key];
367 opt->opt_key = opt_key;
368 opt->type = type;
369 opt->serialization_key_ordinal = ++ serialization_key_ordinal_last;
370 this->by_serialization_key_ordinal[opt->serialization_key_ordinal] = opt;
371 return opt;
372}
std::map< size_t, const ConfigOptionDef * > by_serialization_key_ordinal
Definition Config.hpp:2659
t_optiondef_map options
Definition Config.hpp:2658

References by_serialization_key_ordinal, and options.

Referenced by Slic3r::CLIMiscConfigDef::CLIMiscConfigDef(), Slic3r::CLITransformConfigDef::CLITransformConfigDef(), Slic3r::CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef(), Slic3r::DimensionsConfigDef::DimensionsConfigDef(), Slic3r::ObjectsInfoConfigDef::ObjectsInfoConfigDef(), Slic3r::OtherPresetsConfigDef::OtherPresetsConfigDef(), Slic3r::OtherSlicingStatesConfigDef::OtherSlicingStatesConfigDef(), Slic3r::PrintStatisticsConfigDef::PrintStatisticsConfigDef(), Slic3r::ReadOnlySlicingStatesConfigDef::ReadOnlySlicingStatesConfigDef(), Slic3r::ReadWriteSlicingStatesConfigDef::ReadWriteSlicingStatesConfigDef(), Slic3r::TimestampsConfigDef::TimestampsConfigDef(), add_nullable(), Slic3r::PrintConfigDef::init_common_params(), Slic3r::PrintConfigDef::init_fff_params(), and Slic3r::PrintConfigDef::init_sla_params().

Here is the caller graph for this function:

◆ add_nullable()

ConfigOptionDef * Slic3r::ConfigDef::add_nullable ( const t_config_option_key & opt_key,
ConfigOptionType type )
protectedinherited
375{
376 ConfigOptionDef *def = this->add(opt_key, type);
377 def->nullable = true;
378 return def;
379}

References add(), and Slic3r::ConfigOptionDef::nullable.

Referenced by Slic3r::PrintConfigDef::init_fff_params().

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

◆ empty()

bool Slic3r::ConfigDef::empty ( )
inlineinherited
2673{ return options.empty(); }

References options.

◆ get()

const ConfigOptionDef * Slic3r::ConfigDef::get ( const t_config_option_key & opt_key) const
inlineinherited

◆ has()

bool Slic3r::ConfigDef::has ( const t_config_option_key & opt_key) const
inlineinherited
2661{ return this->options.count(opt_key) > 0; }

Referenced by Slic3r::GUI::EditGCodeDialog::selection_changed().

Here is the caller graph for this function:

◆ keys()

std::vector< std::string > Slic3r::ConfigDef::keys ( ) const
inlineinherited
2666 {
2667 std::vector<std::string> out;
2668 out.reserve(options.size());
2669 for(auto const& kvp : options)
2670 out.push_back(kvp.first);
2671 return out;
2672 }

References options.

◆ print_cli_help()

std::ostream & Slic3r::ConfigDef::print_cli_help ( std::ostream & out,
bool show_defaults,
std::function< bool(const ConfigOptionDef &)> filter = [](const ConfigOptionDef &){ return true; } ) const
inherited
382{
383 // prepare a function for wrapping text
384 auto wrap = [](std::string text, size_t line_length) -> std::string {
385 std::istringstream words(text);
386 std::ostringstream wrapped;
387 std::string word;
388
389 if (words >> word) {
390 wrapped << word;
391 size_t space_left = line_length - word.length();
392 while (words >> word) {
393 if (space_left < word.length() + 1) {
394 wrapped << '\n' << word;
395 space_left = line_length - word.length();
396 } else {
397 wrapped << ' ' << word;
398 space_left -= word.length() + 1;
399 }
400 }
401 }
402 return wrapped.str();
403 };
404
405 // get the unique categories
406 std::set<std::string> categories;
407 for (const auto& opt : this->options) {
408 const ConfigOptionDef& def = opt.second;
409 if (filter(def))
410 categories.insert(def.category);
411 }
412
413 for (auto category : categories) {
414 if (category != "") {
415 out << category << ":" << std::endl;
416 } else if (categories.size() > 1) {
417 out << "Misc options:" << std::endl;
418 }
419
420 for (const auto& opt : this->options) {
421 const ConfigOptionDef& def = opt.second;
422 if (def.category != category || def.cli == ConfigOptionDef::nocli || !filter(def))
423 continue;
424
425 // get all possible variations: --foo, --foobar, -f...
426 std::vector<std::string> cli_args = def.cli_args(opt.first);
427 if (cli_args.empty())
428 continue;
429
430 for (auto& arg : cli_args) {
431 arg.insert(0, (arg.size() == 1) ? "-" : "--");
432 //BBS: refine the print help format
433 if (!def.cli_params.empty())
434 arg += " " + def.cli_params;
435 /*if ( def.type == coInt || def.type == coInts) {
436 arg += " int_value";
437 } else if (def.type == coFloat || def.type == coFloatOrPercent || def.type == coFloats) {
438 arg += " float_value";
439 } else if (def.type == coPoint) {
440 arg += " X,Y";
441 } else if (def.type == coPoint3) {
442 arg += " X,Y,Z";
443 } else if (def.type == coString || def.type == coStrings) {
444 arg += " filename_lists";
445 }*/
446 }
447
448 // left: command line options
449 const std::string cli = boost::algorithm::join(cli_args, ", ");
450 out << " " << std::left << std::setw(20) << cli;
451
452 // right: option description
453 std::string descr = def.tooltip;
454 bool show_defaults_this = show_defaults || def.opt_key == "config_compatibility";
455 if (show_defaults_this && def.default_value && def.type != coBool
456 && (def.type != coString || !def.default_value->serialize().empty())) {
457 descr += " (";
458 if (!def.sidetext.empty()) {
459 descr += def.sidetext + ", ";
460 } else if (!def.enum_values.empty()) {
461 descr += boost::algorithm::join(def.enum_values, ", ") + "; ";
462 }
463 descr += "default: " + def.default_value->serialize() + ")";
464 }
465
466 // wrap lines of description
467 descr = wrap(descr, 80);
468 std::vector<std::string> lines;
469 boost::split(lines, descr, boost::is_any_of("\n"));
470
471 // if command line options are too long, print description in new line
472 for (size_t i = 0; i < lines.size(); ++i) {
473 if (i == 0 && cli.size() > 19)
474 out << std::endl;
475 if (i > 0 || cli.size() > 19)
476 out << std::string(21, ' ');
477 out << lines[i] << std::endl;
478 }
479 }
480 }
481 return out;
482}
static const constexpr char * nocli
Definition Config.hpp:2636

References Slic3r::ConfigOptionDef::category, Slic3r::ConfigOptionDef::cli, Slic3r::ConfigOptionDef::cli_args(), Slic3r::ConfigOptionDef::cli_params, Slic3r::coBool, Slic3r::coString, Slic3r::ConfigOptionDef::default_value, Slic3r::ConfigOptionDef::enum_values, Slic3r::ConfigOptionDef::nocli, Slic3r::ConfigOptionDef::opt_key, options, Slic3r::ConfigOptionDef::sidetext, Slic3r::ConfigOptionDef::tooltip, and Slic3r::ConfigOptionDef::type.

Here is the call graph for this function:

Member Data Documentation

◆ by_serialization_key_ordinal

std::map<size_t, const ConfigOptionDef*> Slic3r::ConfigDef::by_serialization_key_ordinal
inherited

◆ options


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