diff --git a/src/slic3r.cpp b/src/slic3r.cpp index 725c20de6a..82f5366919 100644 --- a/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -89,7 +89,10 @@ main(const int argc, const char **argv) if (cli_config.scale_to_fit.is_positive_volume()) (*o)->scale_to_fit(cli_config.scale_to_fit.value); + // TODO: honor option order? (*o)->scale(cli_config.scale.value); + (*o)->rotate(Geometry::deg2rad(cli_config.rotate_x.value), X); + (*o)->rotate(Geometry::deg2rad(cli_config.rotate_y.value), Y); (*o)->rotate(Geometry::deg2rad(cli_config.rotate.value), Z); } diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index a494228a91..0fe0722185 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -617,6 +617,7 @@ ModelObject::scale(float factor) void ModelObject::scale(const Pointf3 &versor) { + if (versor.x == 1 && versor.y == 1 && versor.z == 1) return; for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) { (*v)->mesh.scale(versor); } @@ -643,6 +644,7 @@ ModelObject::scale_to_fit(const Sizef3 &size) void ModelObject::rotate(float angle, const Axis &axis) { + if (angle == 0) return; for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) { (*v)->mesh.rotate(angle, axis); } diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index c6e56ee917..7a4067d3e8 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -1464,6 +1464,18 @@ CLIConfigDef::CLIConfigDef() def->cli = "rotate"; def->default_value = new ConfigOptionFloat(0); + def = this->add("rotate_x", coFloat); + def->label = "Rotate around X"; + def->tooltip = "Rotation angle around the X axis in degrees (0-360, default: 0)."; + def->cli = "rotate-x"; + def->default_value = new ConfigOptionFloat(0); + + def = this->add("rotate_y", coFloat); + def->label = "Rotate around Y"; + def->tooltip = "Rotation angle around the Y axis in degrees (0-360, default: 0)."; + def->cli = "rotate-y"; + def->default_value = new ConfigOptionFloat(0); + def = this->add("save", coString); def->label = "Save config file"; def->tooltip = "Save configuration to the specified file."; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 2c7fa2d58c..dff798a75d 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -600,6 +600,8 @@ class CLIConfig ConfigOptionStrings load; ConfigOptionString output; ConfigOptionFloat rotate; + ConfigOptionFloat rotate_x; + ConfigOptionFloat rotate_y; ConfigOptionString save; ConfigOptionFloat scale; ConfigOptionPoint3 scale_to_fit; @@ -621,6 +623,8 @@ class CLIConfig OPT_PTR(load); OPT_PTR(output); OPT_PTR(rotate); + OPT_PTR(rotate_x); + OPT_PTR(rotate_y); OPT_PTR(save); OPT_PTR(scale); OPT_PTR(scale_to_fit);