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

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

Inheritance diagram for Slic3r::CustomGcodeSpecificConfigDef:
Collaboration diagram for Slic3r::CustomGcodeSpecificConfigDef:

Public Member Functions

 CustomGcodeSpecificConfigDef ()
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

◆ CustomGcodeSpecificConfigDef()

Slic3r::CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef ( )
13675{
13676 ConfigOptionDef* def;
13677
13678// Common Defs
13679 def = this->add("layer_num", coInt);
13680 def->label = L("Layer number");
13681 def->tooltip = L("Index of the current layer. The index is zero-based (first layer has index 0). Before the first "
13682 "layer starts, it is -1. In extrusion role change G-code, the index is one-based (first layer has index 1).");
13683
13684 def = this->add("layer_z", coFloat);
13685 def->label = L("Layer Z");
13686 def->tooltip = L("Height of the current layer above the print bed, measured to the top of the layer.");
13687
13688 def = this->add("max_layer_z", coFloat);
13689 def->label = L("Maximal layer Z");
13690 def->tooltip = L("Height of the last layer above the print bed.");
13691
13692 def = this->add("filament_extruder_id", coInt);
13693 def->label = L("Filament extruder ID");
13694 def->tooltip = L("In filament start G-code, the index of the filament that is being loaded. In filament end G-code, "
13695 "the index of the filament that is being unloaded. The index is zero-based (first filament has "
13696 "index 0). At a tool change, filament end G-code gets the extruder index instead, unless the Type 1 "
13697 "wipe tower does the tool change. Machine end G-code gets the value from the last filament end "
13698 "G-code at the end of the print.");
13699
13700 new_def("current_filament_id", coInt, L("Current filament ID"), L("Index of the currently active filament. The index is zero-based (first filament has index 0)."));
13701 new_def("current_extruder_id", coInt, L("Current extruder ID"), L("Index of the currently active physical extruder. The index is zero-based (first extruder has index 0)."));
13702 new_def("current_nozzle_id", coInt, L("Current nozzle ID"), L("Index of the currently active nozzle. The index is zero-based (first nozzle has index 0)."));
13703 new_def("nozzle_diameter_at_nozzle_id", coFloats, L("Nozzle diameters"), L("Nozzle diameters indexed by nozzle ID."));
13704 new_def("nozzle_volume_types", coStrings, L("Nozzle volume types"),
13705 // TRN The quoted values are G-code identifiers; keep them in English.
13706 L("Nozzle volume types indexed by nozzle ID, such as \"Standard\" or \"High Flow\"."));
13707 new_def("retraction_distance_when_cut", coFloat, L("Retraction distance when cut"), L("Retraction distance used when cutting filament."));
13708 new_def("long_retraction_when_cut", coBool, L("Long retraction when cut"), L("Whether long retraction is used when cutting filament."));
13709
13710// layer_change_gcode
13711 new_def("most_used_physical_extruder_id", coInt, L("Most-used physical extruder ID"), L("Index of the physical extruder used most often on the current layer. The index is zero-based (first extruder has index 0)."));
13712 new_def("curr_y_acceleration_limit", coFloat, L("Current Y acceleration limit"), L("Current Y-axis acceleration limit after the bed-mass adjustment."));
13713 new_def("curr_accumulated_mass", coFloat, L("Current accumulated mass"), L("Accumulated printed mass at the current layer."));
13714 new_def("previous_layer_mass", coFloat, L("Previous layer mass"), L("Printed mass of the previous layer."));
13715 new_def("curr_layer_mass", coFloat, L("Previous layer mass"), L("Same as previous_layer_mass. Bambu Studio uses this name."));
13716
13717// time_lapse_gcode
13718 new_def("curr_physical_extruder_id", coInt, L("Current physical extruder ID"), L("Index of the physical extruder active for the current layer. The index is zero-based (first extruder has index 0)."));
13719 new_def("timelapse_pos_x", coInt, L("Timelapse position X"), L("Selected X position for timelapse capture."));
13720 new_def("timelapse_pos_y", coInt, L("Timelapse position Y"), L("Selected Y position for timelapse capture."));
13721 new_def("has_timelapse_safe_pos", coBool, L("Has timelapse safe position"), L("Whether a safe timelapse position was found."));
13722 new_def("timelapse_inline_photo", coBool, L("Timelapse inline photo"), L("Whether the photo is taken where the nozzle already is, without moving to a safe timelapse position first."));
13723 new_def("farthest_point_timelapse_enabled", coBool, L("Farthest-point timelapse enabled"), L("Whether farthest-point timelapse positioning is active."));
13724 new_def("clear_to_x0", coBool, L("Clear path to X0"), L("Whether the nozzle can move to X0 at the current height without hitting another printed object."));
13725
13726// change_filament_gcode
13727 new_def("previous_extruder", coInt, L("Previous extruder"), L("Index of the filament that is being unloaded. The index is zero-based (first filament has index 0). At the start of the print, when no filament is loaded yet, it is -1."));
13728 new_def("next_extruder", coInt, L("Next extruder"), L("Index of the filament that is being loaded. The index is zero-based (first filament has index 0)."));
13729 new_def("current_hotend", coInt, L("Current hotend"), L("Hotend of the outgoing filament, given as its zero-based extruder index. On Bambu printers it is -1, or the nozzle ID when a filament moves between nozzles across layers."));
13730 new_def("next_hotend", coInt, L("Next hotend"), L("Hotend of the incoming filament, given as its zero-based extruder index. On Bambu printers it is -1, or the nozzle ID when a filament moves between nozzles across layers."));
13731 new_def("next_nozzle_id", coInt, L("Next nozzle ID"), L("Index of the nozzle associated with the incoming filament. The index is zero-based (first nozzle has index 0)."));
13732 new_def("next_filament_id", coInt, L("Next filament ID"), L("Index of the incoming filament. The index is zero-based (first filament has index 0)."));
13733 new_def("old_extruder_variant", coString, L("Old extruder variant"),
13734 // TRN The quoted value is a G-code identifier; keep it in English.
13735 L("Extruder type and nozzle volume type of the outgoing extruder, such as \"Direct Drive High Flow\"."));
13736 new_def("new_extruder_variant", coString, L("New extruder variant"),
13737 // TRN The quoted value is a G-code identifier; keep it in English.
13738 L("Extruder type and nozzle volume type of the incoming extruder, such as \"Direct Drive High Flow\"."));
13739 new_def("filament_retract_length_nc", coFloat, L("Filament nozzle-change retract length"), L("Nozzle-change retraction length of the outgoing filament."));
13740 new_def("new_extruder_retracted_length", coFloat, L("New extruder retracted length"), L("Retraction length still applied to the incoming extruder from when it was parked."));
13741 new_def("outer_wall_volumetric_speed", coFloat, L("Outer wall volumetric speed"), L("Volumetric speed used for the outer wall."));
13742 new_def("relative_e_axis", coBool, L("Relative e-axis"), L("Indicates if relative positioning is being used."));
13743 new_def("toolchange_count", coInt, L("Toolchange count"), L("The number of toolchanges throughout the print."));
13744 new_def("toolchange_z", coFloat, L("Toolchange Z"), L("The Z position during the toolchange."));
13745 new_def("fan_speed", coNone, "", ""); //Option is no longer used and is zeroed by placeholder parser for compatability
13746 new_def("old_retract_length", coFloat, L("Old retract length"), L("The retraction length of the previous filament."));
13747 new_def("new_retract_length", coFloat, L("New retract length"), L("The retraction length of the new filament."));
13748 new_def("old_retract_length_toolchange", coFloat, L("Old retract length toolchange"), L("The toolchange retraction length of the previous filament."));
13749 new_def("new_retract_length_toolchange", coFloat, L("New retract length toolchange"), L("The toolchange retraction length of the new filament."));
13750 new_def("old_filament_temp", coInt, L("Old filament temp"), L("The old filament temp."));
13751 new_def("new_filament_temp", coInt, L("New filament temp"), L("The new filament temp."));
13752 new_def("x_after_toolchange", coFloat, L("X after toolchange"), L("The X pos after toolchange."));
13753 new_def("y_after_toolchange", coFloat, L("Y after toolchange"), L("The Y pos after toolchange."));
13754 new_def("z_after_toolchange", coFloat, L("Z after toolchange"), L("The Z pos after toolchange."));
13755 new_def("first_flush_volume", coFloat, L("First flush volume"), L("First half of the planned purge length, in mm of filament."));
13756 new_def("second_flush_volume", coFloat, L("Second flush volume"), L("Second half of the planned purge length, in mm of filament."));
13757 new_def("old_filament_e_feedrate", coInt, L("Old filament e feedrate"), L("The old filament extruder feedrate."));
13758 new_def("new_filament_e_feedrate", coInt, L("New filament e feedrate"), L("The new filament extruder feedrate."));
13759 new_def("travel_point_1_x", coFloat, L("Travel point 1 X"), L("The travel point 1 X."));
13760 new_def("travel_point_1_y", coFloat, L("Travel point 1 Y"), L("The travel point 1 Y."));
13761 new_def("travel_point_2_x", coFloat, L("Travel point 2 X"), L("The travel point 2 X."));
13762 new_def("travel_point_2_y", coFloat, L("Travel point 2 Y"), L("The travel point 2 Y."));
13763 new_def("travel_point_3_x", coFloat, L("Travel point 3 X"), L("The travel point 3 X."));
13764 new_def("travel_point_3_y", coFloat, L("Travel point 3 Y"), L("The travel point 3 Y."));
13765 new_def("flush_length_1", coFloat, L("Flush Length 1"), L("The first flush length."));
13766 new_def("flush_length_2", coFloat, L("Flush Length 2"), L("The second flush length."));
13767 new_def("flush_length_3", coFloat, L("Flush Length 3"), L("The third flush length."));
13768 new_def("flush_length_4", coFloat, L("Flush Length 4"), L("The fourth flush length."));
13769 new_def("flush_length", coFloat, L("Flush length"), L("Total flush length."));
13770 new_def("flush_volumetric_speeds", coFloats, L("Flush volumetric speeds"), L("Flush volumetric speeds for each filament."));
13771 new_def("flush_temperatures", coInts, L("Flush temperatures"), L("Flush temperatures for each filament."));
13772 new_def("filament_cooling_before_tower", coFloats, L("Filament cooling before tower"), L("Temperature drop before entering the wipe tower."));
13773 new_def("wipe_avoid_perimeter", coBool, L("Avoid wipe perimeter"), L("Whether travel should avoid the wipe perimeter."));
13774 new_def("wipe_avoid_pos_x", coFloat, L("Wipe tower avoidance X"), L("X position just beside the wipe tower that the nozzle moves to so it stays clear of the tower."));
13775 new_def("is_prime_tower_interface", coBool, L("Prime tower interface"), L("Whether the current purge is for the prime tower interface layer (where different materials meet)."));
13776 new_def("filament_tower_interface_purge_volume", coFloat, L("Interface layer purge length"), L("Purge length for prime tower interface layer (where different materials meet)."));
13777 new_def("filament_tower_interface_print_temp", coInt, L("Interface layer print temperature"), L("Print temperature for prime tower interface layer (where different materials meet)."));
13778 new_def("wipe_tower_wait_pos_x", coFloat, L("Wipe tower wait position X"), L("X coordinate of the nozzle's wipe-tower wait position, 2 mm outside the tower edge."));
13779 new_def("wipe_tower_wait_pos_y", coFloat, L("Wipe tower wait position Y"), L("Y coordinate of the nozzle's wipe-tower wait position."));
13780 new_def("wipe_tower_wait_pos_valid", coBool, L("Wipe tower wait position valid"), L("Whether the wait position is set, which is the case when the print has a wipe tower."));
13781 new_def("wipe_tower_center_pos_x", coFloat, L("Wipe tower wait position X"), L("Same as wipe_tower_wait_pos_x. Bambu Studio uses this name."));
13782 new_def("wipe_tower_center_pos_y", coFloat, L("Wipe tower wait position Y"), L("Same as wipe_tower_wait_pos_y. Bambu Studio uses this name."));
13783 new_def("wipe_tower_center_pos_valid", coBool, L("Wipe tower wait position valid"), L("Same as wipe_tower_wait_pos_valid. Bambu Studio uses this name."));
13784 new_def("temperature", coInts, L("Temperature"), L("Nozzle temperatures indexed by filament."));
13785 new_def("nozzle_temperature", coInts, L("Nozzle temperature"), L("Nozzle temperatures indexed by filament."));
13786 new_def("first_layer_temperature", coInts, L("First layer temperature"), L("First-layer nozzle temperatures indexed by filament."));
13787 new_def("nozzle_temperature_initial_layer", coInts, L("First layer nozzle temperature"), L("First-layer nozzle temperatures indexed by filament."));
13788
13789// change_extrusion_role_gcode
13790 // The whole tooltip is one literal so that the GUI can look it up in the catalog.
13791 def = this->add("extrusion_role", coString);
13792 def->label = L("Extrusion role");
13793 // TRN The quoted values are G-code identifiers; keep them in English.
13794 def->tooltip = L("The new extrusion role/type that is going to be used\nPossible values:\n[\"Perimeter\", \"ExternalPerimeter\", "
13795 "\"OverhangPerimeter\", \"InternalInfill\", \"SolidInfill\", \"TopSolidInfill\", \"BottomSurface\", \"BridgeInfill\", \"GapFill\", \"Ironing\", "
13796 "\"Skirt\", \"Brim\", \"SupportMaterial\", \"SupportMaterialInterface\", \"SupportTransition\", \"WipeTower\", \"Mixed\"]");
13797
13798 def = this->add("last_extrusion_role", coString);
13799 def->label = L("Last extrusion role");
13800 // TRN The quoted values are G-code identifiers; keep them in English.
13801 def->tooltip = L("The previously used extrusion role/type\nPossible values:\n[\"Perimeter\", \"ExternalPerimeter\", "
13802 "\"OverhangPerimeter\", \"InternalInfill\", \"SolidInfill\", \"TopSolidInfill\", \"BottomSurface\", \"BridgeInfill\", \"GapFill\", \"Ironing\", "
13803 "\"Skirt\", \"Brim\", \"SupportMaterial\", \"SupportMaterialInterface\", \"SupportTransition\", \"WipeTower\", \"Mixed\"]");
13804}
#define L(s)
Definition ExtrusionEntity.cpp:25
#define new_def(OPT_KEY, TYPE, LABEL, TOOLTIP)
Definition PrintConfig.cpp:13307
ConfigOptionDef * add(const t_config_option_key &opt_key, ConfigOptionType type)
Definition Config.cpp:363
@ coString
Definition Config.hpp:192
@ coInts
Definition Config.hpp:190
@ coInt
Definition Config.hpp:188
@ coNone
Definition Config.hpp:182
@ coBool
Definition Config.hpp:210
@ coFloat
Definition Config.hpp:184
@ coStrings
Definition Config.hpp:194
@ coFloats
Definition Config.hpp:186

References Slic3r::ConfigDef::add(), Slic3r::coBool, Slic3r::coFloat, Slic3r::coFloats, Slic3r::coInt, Slic3r::coInts, Slic3r::coNone, Slic3r::coString, Slic3r::coStrings, L, Slic3r::ConfigOptionDef::label, new_def, 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: