diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index 56008e9b61..bf385fce25 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -2012,18 +2012,35 @@ int CLI::run(int argc, char **argv) } } else if (opt_key == "orient") { - for (auto& model : m_models) - for (ModelObject* o : model.objects) - { - // coconut: always orient instance instead of object - for (ModelInstance* mi : o->instances) + //BBS: orient 0 means disable, 1 means force orient, others means auto + int orient_option = m_config.option("orient")->value; + + if (orient_option == 0) + { + orients_requirement.clear(); + for (auto& model : m_models) + for (ModelObject* o : model.objects) { - orientation::orient(mi); + orients_requirement.insert(std::pair(o->id().id, false)); + BOOST_LOG_TRIVIAL(info) << "object "<name <<", id :" << o->id().id << ", no need to orient when setting orient to 0\n"; } - BOOST_LOG_TRIVIAL(info) << "orient object, name=" << o->name <<",id="<id().id<id().id] = false; - } + } + else if (orient_option == 1) + { + //force orient + orients_requirement.clear(); + for (auto& model : m_models) + for (ModelObject* o : model.objects) + { + orients_requirement.insert(std::pair(o->id().id, true)); + BOOST_LOG_TRIVIAL(info) << "object "<name <<", id :" << o->id().id << ", need to orient when setting orient to 1\n"; + } + } + else + { + //auto arrange, keep the original logic + } + BOOST_LOG_TRIVIAL(info) << boost::format("orient_option %1%")%orient_option; } else if (opt_key == "copy") { for (auto &model : m_models) { @@ -2777,10 +2794,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.) //BBS: current only support models on bed, 0407 sinking supported - //if (m_config.opt_bool("ensure_on_bed")) - // for (auto &model : m_models) - // for (auto &o : model.objects) - // o->ensure_on_bed(); + if (m_config.opt_bool("ensure_on_bed")) + { + BOOST_LOG_TRIVIAL(info) << "ensure_on_bed: need to ensure each object on beds"; + for (auto &model : m_models) + for (auto &o : model.objects) + o->ensure_on_bed(); + } // loop through action options bool export_to_3mf = false, load_slicedata = false, export_slicedata = false, export_slicedata_error = false; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 0a2fc4b9f0..cfad2c2105 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -5094,12 +5094,12 @@ CLITransformConfigDef::CLITransformConfigDef() def->cli_params = "count"; def->set_default_value(new ConfigOptionInt(1)); - /*def = this->add("ensure_on_bed", coBool); + def = this->add("ensure_on_bed", coBool); def->label = L("Ensure on bed"); - def->tooltip = L("Lift the object above the bed when it is partially below. Enabled by default, use --no-ensure-on-bed to disable."); - def->set_default_value(new ConfigOptionBool(true)); + def->tooltip = L("Lift the object above the bed when it is partially below. Disabled by default"); + def->set_default_value(new ConfigOptionBool(false)); - def = this->add("copy", coInt); + /*def = this->add("copy", coInt); def->label = L("Copy"); def->tooltip =L("Duplicate copies of model"); def->min = 1; @@ -5119,18 +5119,18 @@ CLITransformConfigDef::CLITransformConfigDef() def->tooltip = L("Convert the units of model"); def->set_default_value(new ConfigOptionBool(false)); - def = this->add("orient", coBool); - def->label = L("Orient"); - def->tooltip = L("Orient the model"); + def = this->add("orient", coInt); + def->label = L("Orient Options"); + def->tooltip = L("Orient options: 0-disable, 1-enable, others-auto"); //def->cli = "orient|o"; - def->set_default_value(new ConfigOptionBool(false)); + def->set_default_value(new ConfigOptionInt(0)); /*def = this->add("repair", coBool); def->label = L("Repair"); def->tooltip = L("Repair the model's meshes if it is non-manifold mesh"); def->set_default_value(new ConfigOptionBool(false));*/ - /*def = this->add("rotate", coFloat); + def = this->add("rotate", coFloat); def->label = L("Rotate"); def->tooltip = L("Rotation angle around the Z axis in degrees."); def->set_default_value(new ConfigOptionFloat(0)); @@ -5143,7 +5143,7 @@ CLITransformConfigDef::CLITransformConfigDef() def = this->add("rotate_y", coFloat); def->label = L("Rotate around Y"); def->tooltip = L("Rotation angle around the Y axis in degrees."); - def->set_default_value(new ConfigOptionFloat(0));*/ + def->set_default_value(new ConfigOptionFloat(0)); def = this->add("scale", coFloat); def->label = L("Scale");