mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-15 06:31:48 +08:00
New --rotate-x and --rotate-y CLI options
This commit is contained in:
parent
c79444a3d7
commit
d0f22196ad
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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.";
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user