Resurrected --dont-arrange command line parameter,

fixed command line print parameter validation.
This commit is contained in:
bubnikv 2018-09-25 09:55:15 +02:00
parent a9f52955a0
commit c3dc562ab0
4 changed files with 49 additions and 21 deletions

View file

@ -812,6 +812,14 @@ public:
bool operator==(const ConfigOptionEnum<T> &rhs) const { return this->value == rhs.value; }
int getInt() const override { return (int)this->value; }
bool operator==(const ConfigOption &rhs) const override
{
if (rhs.type() != this->type())
throw std::runtime_error("ConfigOptionEnum<T>: Comparing incompatible types");
// rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
return this->value == (T)rhs.getInt();
}
void set(const ConfigOption *rhs) override {
if (rhs->type() != this->type())
throw std::runtime_error("ConfigOptionEnum<T>: Assigning an incompatible type");
@ -887,6 +895,14 @@ public:
ConfigOptionEnumGeneric& operator=(const ConfigOption *opt) { this->set(opt); return *this; }
bool operator==(const ConfigOptionEnumGeneric &rhs) const { return this->value == rhs.value; }
bool operator==(const ConfigOption &rhs) const override
{
if (rhs.type() != this->type())
throw std::runtime_error("ConfigOptionEnumGeneric: Comparing incompatible types");
// rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
return this->value == rhs.getInt();
}
void set(const ConfigOption *rhs) override {
if (rhs->type() != this->type())
throw std::runtime_error("ConfigOptionEnumGeneric: Assigning an incompatible type");

View file

@ -2612,6 +2612,13 @@ CLIConfigDef::CLIConfigDef()
def->cli = "cut";
def->default_value = new ConfigOptionFloat(0);
def = this->add("dont_arrange", coBool);
def->label = L("Dont arrange");
def->tooltip = L("Don't arrange the objects on the build plate. The model coordinates "
"define the absolute positions on the build plate. "
"The option --center will be ignored.");
def->default_value = new ConfigOptionBool(false);
def = this->add("datadir", coString);
def->label = L("User data directory");
def->tooltip = L("Load and store settings at the given directory. "
@ -2707,10 +2714,10 @@ CLIConfigDef::CLIConfigDef()
def->default_value = new ConfigOptionPoint3(Pointf3(0,0,0));
*/
def = this->add("center", coPoint);
def->label = L("Center");
def = this->add("print_center", coPoint);
def->label = L("Print center");
def->tooltip = L("Center the print around the given center (default: 100, 100).");
def->cli = "center";
def->cli = "print-center";
def->default_value = new ConfigOptionPoint(Vec2d(100,100));
}

View file

@ -983,6 +983,7 @@ class CLIConfig : public virtual ConfigBase, public StaticConfig
public:
ConfigOptionFloat cut;
ConfigOptionString datadir;
ConfigOptionBool dont_arrange;
ConfigOptionBool export_3mf;
ConfigOptionBool gui;
ConfigOptionBool info;
@ -990,13 +991,13 @@ public:
ConfigOptionStrings load;
ConfigOptionBool no_gui;
ConfigOptionString output;
ConfigOptionPoint print_center;
ConfigOptionFloat rotate;
ConfigOptionFloat rotate_x;
ConfigOptionFloat rotate_y;
ConfigOptionString save;
ConfigOptionFloat scale;
// ConfigOptionPoint3 scale_to_fit;
ConfigOptionPoint center;
ConfigOptionBool slice;
CLIConfig() : ConfigBase(), StaticConfig()
@ -1011,6 +1012,7 @@ public:
{
OPT_PTR(cut);
OPT_PTR(datadir);
OPT_PTR(dont_arrange);
OPT_PTR(export_3mf);
OPT_PTR(gui);
OPT_PTR(help);
@ -1018,6 +1020,7 @@ public:
OPT_PTR(load);
OPT_PTR(no_gui);
OPT_PTR(output);
OPT_PTR(print_center);
OPT_PTR(rotate);
OPT_PTR(rotate_x);
OPT_PTR(rotate_y);