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

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

Inheritance diagram for Slic3r::CLITransformConfigDef:
Collaboration diagram for Slic3r::CLITransformConfigDef:

Public Member Functions

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

◆ CLITransformConfigDef()

Slic3r::CLITransformConfigDef::CLITransformConfigDef ( )
12926{
12927 ConfigOptionDef* def;
12928
12929 // Transform options:
12930 /*def = this->add("align_xy", coPoint);
12931 def->label = L("Align XY");
12932 def->tooltip = L("Align the model to the given point.");
12933 def->set_default_value(new ConfigOptionPoint(Vec2d(100,100)));
12934
12935 def = this->add("cut", coFloat);
12936 def->label = L("Cut");
12937 def->tooltip = L("Cut model at the given Z.");
12938 def->set_default_value(new ConfigOptionFloat(0));*/
12939
12940/*
12941 def = this->add("cut_grid", coFloat);
12942 def->label = L("Cut");
12943 def->tooltip = L("Cut model in the XY plane into tiles of the specified max size.");
12944 def->set_default_value(new ConfigOptionPoint());
12945
12946 def = this->add("cut_x", coFloat);
12947 def->label = L("Cut");
12948 def->tooltip = L("Cut model at the given X.");
12949 def->set_default_value(new ConfigOptionFloat(0));
12950
12951 def = this->add("cut_y", coFloat);
12952 def->label = L("Cut");
12953 def->tooltip = L("Cut model at the given Y.");
12954 def->set_default_value(new ConfigOptionFloat(0));
12955*/
12956
12957 /*def = this->add("center", coPoint);
12958 def->label = L("Center");
12959 def->tooltip = L("Center the print around the given center.");
12960 def->set_default_value(new ConfigOptionPoint(Vec2d(100,100)));*/
12961
12962 def = this->add("arrange", coInt);
12963 def->label = L("Arrange Options");
12964 def->tooltip = L("Arrange options: 0-disable, 1-enable, others-auto");
12965 def->cli_params = "option";
12966 //def->cli = "arrange|a";
12967 def->set_default_value(new ConfigOptionInt(0));
12968
12969 def = this->add("repetitions", coInt);
12970 def->label = L("Repetition count");
12971 def->tooltip = L("Repetition count of the whole model.");
12972 def->cli_params = "count";
12973 def->set_default_value(new ConfigOptionInt(1));
12974
12975 def = this->add("ensure_on_bed", coBool);
12976 def->label = L("Ensure on bed");
12977 def->tooltip = L("Lift the object above the bed when it is partially below. Disabled by default.");
12978 def->set_default_value(new ConfigOptionBool(false));
12979
12980 /*def = this->add("copy", coInt);
12981 def->label = L("Copy");
12982 def->tooltip =L("Duplicate copies of model.");
12983 def->min = 1;
12984 def->set_default_value(new ConfigOptionInt(1));*/
12985
12986 /*def = this->add("duplicate_grid", coPoint);
12987 def->label = L("Duplicate by grid");
12988 def->tooltip = L("Multiply copies by creating a grid.");*/
12989
12990 def = this->add("assemble", coBool);
12991 def->label = L("Assemble");
12992 def->tooltip = L("Arrange the supplied models in a plate and merge them in a single model in order to perform actions once.");
12993 //def->cli = "merge|m";
12994 def->set_default_value(new ConfigOptionBool(false));
12995
12996 def = this->add("convert_unit", coBool);
12997 def->label = L("Convert Unit");
12998 def->tooltip = L("Convert the units of model.");
12999 def->set_default_value(new ConfigOptionBool(false));
13000
13001 def = this->add("orient", coInt);
13002 def->label = L("Orient Options");
13003 def->tooltip = L("Orient options: 0-disable, 1-enable, others-auto");
13004 //def->cli = "orient|o";
13005 def->set_default_value(new ConfigOptionInt(0));
13006
13007 def = this->add("repair", coBool);
13008 def->label = L("Repair");
13009 def->tooltip = L("Repair the meshes of the models as Fix Model does: close holes and cracks, orient them outward and "
13010 "remove self-intersections.");
13011 def->set_default_value(new ConfigOptionBool(false));
13012
13013 def = this->add("rotate", coFloat);
13014 def->label = L("Rotate");
13015 def->tooltip = L("Rotation angle around the Z axis in degrees.");
13016 def->sidetext = u8"°"; // degrees, don't need translation
13017 def->set_default_value(new ConfigOptionFloat(0));
13018
13019 def = this->add("rotate_x", coFloat);
13020 def->label = L("Rotate around X");
13021 def->tooltip = L("Rotation angle around the X axis in degrees.");
13022 def->sidetext = u8"°"; // degrees, don't need translation
13023 def->set_default_value(new ConfigOptionFloat(0));
13024
13025 def = this->add("rotate_y", coFloat);
13026 def->label = L("Rotate around Y");
13027 def->tooltip = L("Rotation angle around the Y axis in degrees.");
13028 def->sidetext = u8"°"; // degrees, don't need translation
13029 def->set_default_value(new ConfigOptionFloat(0));
13030
13031 // The --ground-* options choose from the faces the "Lay on Face" gizmo offers. Like the other
13032 // transforms they run in command-line order, so they see the rotations given before them.
13033 def = this->add("ground_largest_face", coBool);
13034 def->label = L("Ground largest face");
13035 def->tooltip = L("Lay each object on the largest face of its convex hull and drop it onto the bed. Of equally large "
13036 "faces, the one already facing down is kept. Objects without a face large enough to rest on are left "
13037 "as they are. Transforms run in command-line order, so rotations given before this option are respected. "
13038 "--orient 1 runs after all transforms and replaces the orientation.");
13039 def->set_default_value(new ConfigOptionBool(false));
13040
13041 def = this->add("ground_face_normal", coString);
13042 def->label = L("Ground face by normal");
13043 def->tooltip = L("Lay each object on the convex hull face whose outward normal is closest to the direction NX,NY,NZ "
13044 "and drop it onto the bed. The direction is in object coordinates, which include the rotations given "
13045 "before this option and match the plate axes unless the input file rotates the object. For example, "
13046 "1,0,0 stands the object on its +X side. --orient 1 runs after all transforms and replaces the orientation.");
13047 def->cli_params = "NX,NY,NZ";
13048 def->set_default_value(new ConfigOptionString(""));
13049
13050 def = this->add("ground_face_point", coString);
13051 def->label = L("Ground face at point");
13052 def->tooltip = L("Lay each object on the convex hull face that contains the point X,Y,Z and drop it onto the bed. "
13053 "The point is in object coordinates, which include the rotations given before this option; "
13054 "--inspect-mesh reports face centers in them. Objects without such a face are left as they are, and "
13055 "the run fails if no object has one. --orient 1 runs after all transforms and replaces the orientation.");
13056 def->cli_params = "X,Y,Z";
13057 def->set_default_value(new ConfigOptionString(""));
13058
13059 def = this->add("scale", coFloat);
13060 def->label = L("Scale");
13061 def->tooltip = L("Scale the model by a float factor.");
13062 def->cli_params = "factor";
13063 def->set_default_value(new ConfigOptionFloat(1.f));
13064
13065 /*def = this->add("split", coBool);
13066 def->label = L("Split");
13067 def->tooltip = L("Detect unconnected parts in the given models and split them into separate objects.");
13068
13069 def = this->add("scale_to_fit", coPoint3);
13070 def->label = L("Scale to Fit");
13071 def->tooltip = L("Scale to fit the given volume.");
13072 def->set_default_value(new ConfigOptionPoint3(Vec3d(0,0,0)));*/
13073}
#define L(s)
Definition ExtrusionEntity.cpp:25
ConfigOptionDef * add(const t_config_option_key &opt_key, ConfigOptionType type)
Definition Config.cpp:363
zaa_minimize_perimeter_height ConfigOptionFloat
Definition PrintConfig.hpp:1954
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702
@ coString
Definition Config.hpp:192
@ coInt
Definition Config.hpp:188
@ coBool
Definition Config.hpp:210
@ coFloat
Definition Config.hpp:184

References Slic3r::ConfigDef::add(), Slic3r::ConfigOptionDef::cli_params, Slic3r::coBool, Slic3r::coFloat, Slic3r::coInt, Slic3r::ConfigOptionFloat, Slic3r::ConfigOptionString, Slic3r::coString, L, Slic3r::ConfigOptionDef::label, Slic3r::ConfigOptionDef::set_default_value(), Slic3r::ConfigOptionDef::sidetext, 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: