mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Reworked pull request
Centering model on bed, using bed shape from config (if available). #2424 thanks @luketaverne
This commit is contained in:
parent
e1c6bd174a
commit
f75c022445
1 changed files with 5 additions and 1 deletions
|
@ -167,6 +167,7 @@ int CLI::run(int argc, char **argv)
|
||||||
// sla_print_config.apply(m_print_config, true);
|
// sla_print_config.apply(m_print_config, true);
|
||||||
|
|
||||||
// Loop through transform options.
|
// Loop through transform options.
|
||||||
|
bool user_center_specified = false;
|
||||||
for (auto const &opt_key : m_transforms) {
|
for (auto const &opt_key : m_transforms) {
|
||||||
if (opt_key == "merge") {
|
if (opt_key == "merge") {
|
||||||
Model m;
|
Model m;
|
||||||
|
@ -209,6 +210,7 @@ int CLI::run(int argc, char **argv)
|
||||||
for (auto &model : m_models)
|
for (auto &model : m_models)
|
||||||
model.duplicate_objects_grid(x, y, (distance > 0) ? distance : 6); // TODO: this is not the right place for setting a default
|
model.duplicate_objects_grid(x, y, (distance > 0) ? distance : 6); // TODO: this is not the right place for setting a default
|
||||||
} else if (opt_key == "center") {
|
} else if (opt_key == "center") {
|
||||||
|
user_center_specified = true;
|
||||||
for (auto &model : m_models) {
|
for (auto &model : m_models) {
|
||||||
model.add_default_instances();
|
model.add_default_instances();
|
||||||
// this affects instances:
|
// this affects instances:
|
||||||
|
@ -403,7 +405,9 @@ int CLI::run(int argc, char **argv)
|
||||||
if (! m_config.opt_bool("dont_arrange")) {
|
if (! m_config.opt_bool("dont_arrange")) {
|
||||||
//FIXME make the min_object_distance configurable.
|
//FIXME make the min_object_distance configurable.
|
||||||
model.arrange_objects(fff_print.config().min_object_distance());
|
model.arrange_objects(fff_print.config().min_object_distance());
|
||||||
model.center_instances_around_point(m_config.option<ConfigOptionPoint>("center")->value);
|
model.center_instances_around_point((! user_center_specified && m_print_config.has("bed_shape")) ?
|
||||||
|
BoundingBoxf(m_print_config.opt<ConfigOptionPoints>("bed_shape")->values).center() :
|
||||||
|
m_config.option<ConfigOptionPoint>("center")->value);
|
||||||
}
|
}
|
||||||
if (printer_technology == ptFFF) {
|
if (printer_technology == ptFFF) {
|
||||||
for (auto* mo : model.objects)
|
for (auto* mo : model.objects)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue