Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2021-08-04 13:15:20 +0300
committerLukas Matena <lukasmatena@seznam.cz>2021-08-04 13:15:37 +0300
commitbc81c22ea9327577f8f2fb558fb7bcadbb8eabda (patch)
tree17c24e0f95e9a4174df5f8f2f00e8a66f6316d8e /src/PrusaSlicer.cpp
parentd0d3c5ad164266dbaf48e58a00c92f8197a2fb18 (diff)
CLI: Ensure that objects are on bed by default, new CLI config option:
'dont-ensure-on-bed' (which allows to override). This was the original behaviour in Slic3r and Sli3rPE, probably broken long ago when CLI was ported from Perl. Also, --scale-to-fit should now work again (#5772)
Diffstat (limited to 'src/PrusaSlicer.cpp')
-rw-r--r--src/PrusaSlicer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp
index b3e6841c9..21b161456 100644
--- a/src/PrusaSlicer.cpp
+++ b/src/PrusaSlicer.cpp
@@ -258,6 +258,7 @@ int CLI::run(int argc, char **argv)
Points bed = get_bed_shape(m_print_config);
ArrangeParams arrange_cfg;
arrange_cfg.min_obj_distance = scaled(min_object_distance(m_print_config));
+ bool user_ensure_on_bed = true;
for (auto const &opt_key : m_transforms) {
if (opt_key == "merge") {
@@ -330,6 +331,10 @@ int CLI::run(int argc, char **argv)
}
} else if (opt_key == "dont_arrange") {
// do nothing - this option alters other transform options
+ } else if (opt_key == "dont_ensure_on_bed") {
+ // Remember that we saw this so we don't lift objects from the bed
+ // after the other transformations are processed.
+ user_ensure_on_bed = false;
} else if (opt_key == "rotate") {
for (auto &model : m_models)
for (auto &o : model.objects)
@@ -432,6 +437,13 @@ int CLI::run(int argc, char **argv)
}
}
+ // All transforms have been dealt with. Now ensure that the objects are on bed.
+ // (Unless the user said otherwise.)
+ if (user_ensure_on_bed)
+ for (auto &model : m_models)
+ for (auto &o : model.objects)
+ o->ensure_on_bed();
+
// loop through action options
for (auto const &opt_key : m_actions) {
if (opt_key == "help") {