mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
ENH: CLI: add support of rotate
JIRA: STUDIO-4183 Change-Id: I091cc3142ce867d2ac75ba27b3cb2e4e569c9681 (cherry picked from commit 7eab9ba9f22dc8f00e13caf27c7cf72b8675562a)
This commit is contained in:
parent
4eea84f24a
commit
c00caad244
2 changed files with 44 additions and 24 deletions
|
@ -2012,18 +2012,35 @@ int CLI::run(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opt_key == "orient") {
|
else if (opt_key == "orient") {
|
||||||
for (auto& model : m_models)
|
//BBS: orient 0 means disable, 1 means force orient, others means auto
|
||||||
for (ModelObject* o : model.objects)
|
int orient_option = m_config.option<ConfigOptionInt>("orient")->value;
|
||||||
{
|
|
||||||
// coconut: always orient instance instead of object
|
if (orient_option == 0)
|
||||||
for (ModelInstance* mi : o->instances)
|
{
|
||||||
|
orients_requirement.clear();
|
||||||
|
for (auto& model : m_models)
|
||||||
|
for (ModelObject* o : model.objects)
|
||||||
{
|
{
|
||||||
orientation::orient(mi);
|
orients_requirement.insert(std::pair<size_t, bool>(o->id().id, false));
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "object "<<o->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="<<o->id().id<<std::endl;
|
}
|
||||||
//BBS: clear the orient objects lists
|
else if (orient_option == 1)
|
||||||
orients_requirement[o->id().id] = false;
|
{
|
||||||
}
|
//force orient
|
||||||
|
orients_requirement.clear();
|
||||||
|
for (auto& model : m_models)
|
||||||
|
for (ModelObject* o : model.objects)
|
||||||
|
{
|
||||||
|
orients_requirement.insert(std::pair<size_t, bool>(o->id().id, true));
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "object "<<o->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") {
|
else if (opt_key == "copy") {
|
||||||
for (auto &model : m_models) {
|
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.
|
// All transforms have been dealt with. Now ensure that the objects are on bed.
|
||||||
// (Unless the user said otherwise.)
|
// (Unless the user said otherwise.)
|
||||||
//BBS: current only support models on bed, 0407 sinking supported
|
//BBS: current only support models on bed, 0407 sinking supported
|
||||||
//if (m_config.opt_bool("ensure_on_bed"))
|
if (m_config.opt_bool("ensure_on_bed"))
|
||||||
// for (auto &model : m_models)
|
{
|
||||||
// for (auto &o : model.objects)
|
BOOST_LOG_TRIVIAL(info) << "ensure_on_bed: need to ensure each object on beds";
|
||||||
// o->ensure_on_bed();
|
for (auto &model : m_models)
|
||||||
|
for (auto &o : model.objects)
|
||||||
|
o->ensure_on_bed();
|
||||||
|
}
|
||||||
|
|
||||||
// loop through action options
|
// loop through action options
|
||||||
bool export_to_3mf = false, load_slicedata = false, export_slicedata = false, export_slicedata_error = false;
|
bool export_to_3mf = false, load_slicedata = false, export_slicedata = false, export_slicedata_error = false;
|
||||||
|
|
|
@ -5094,12 +5094,12 @@ CLITransformConfigDef::CLITransformConfigDef()
|
||||||
def->cli_params = "count";
|
def->cli_params = "count";
|
||||||
def->set_default_value(new ConfigOptionInt(1));
|
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->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->tooltip = L("Lift the object above the bed when it is partially below. Disabled by default");
|
||||||
def->set_default_value(new ConfigOptionBool(true));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("copy", coInt);
|
/*def = this->add("copy", coInt);
|
||||||
def->label = L("Copy");
|
def->label = L("Copy");
|
||||||
def->tooltip =L("Duplicate copies of model");
|
def->tooltip =L("Duplicate copies of model");
|
||||||
def->min = 1;
|
def->min = 1;
|
||||||
|
@ -5119,18 +5119,18 @@ CLITransformConfigDef::CLITransformConfigDef()
|
||||||
def->tooltip = L("Convert the units of model");
|
def->tooltip = L("Convert the units of model");
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("orient", coBool);
|
def = this->add("orient", coInt);
|
||||||
def->label = L("Orient");
|
def->label = L("Orient Options");
|
||||||
def->tooltip = L("Orient the model");
|
def->tooltip = L("Orient options: 0-disable, 1-enable, others-auto");
|
||||||
//def->cli = "orient|o";
|
//def->cli = "orient|o";
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionInt(0));
|
||||||
|
|
||||||
/*def = this->add("repair", coBool);
|
/*def = this->add("repair", coBool);
|
||||||
def->label = L("Repair");
|
def->label = L("Repair");
|
||||||
def->tooltip = L("Repair the model's meshes if it is non-manifold mesh");
|
def->tooltip = L("Repair the model's meshes if it is non-manifold mesh");
|
||||||
def->set_default_value(new ConfigOptionBool(false));*/
|
def->set_default_value(new ConfigOptionBool(false));*/
|
||||||
|
|
||||||
/*def = this->add("rotate", coFloat);
|
def = this->add("rotate", coFloat);
|
||||||
def->label = L("Rotate");
|
def->label = L("Rotate");
|
||||||
def->tooltip = L("Rotation angle around the Z axis in degrees.");
|
def->tooltip = L("Rotation angle around the Z axis in degrees.");
|
||||||
def->set_default_value(new ConfigOptionFloat(0));
|
def->set_default_value(new ConfigOptionFloat(0));
|
||||||
|
@ -5143,7 +5143,7 @@ CLITransformConfigDef::CLITransformConfigDef()
|
||||||
def = this->add("rotate_y", coFloat);
|
def = this->add("rotate_y", coFloat);
|
||||||
def->label = L("Rotate around Y");
|
def->label = L("Rotate around Y");
|
||||||
def->tooltip = L("Rotation angle around the Y axis in degrees.");
|
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 = this->add("scale", coFloat);
|
||||||
def->label = L("Scale");
|
def->label = L("Scale");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue