New placeholder parser values for output file name template;
{num_objects} - number of printable objects on the plater. {num_instances} - number of printable instances on the plater, adding up all printable instances of all objects. Implements #2735 #3339 #4607
This commit is contained in:
parent
3216448bbc
commit
1ddd060982
@ -26,14 +26,17 @@ void PrintBase::update_object_placeholders(DynamicConfig &config, const std::str
|
|||||||
// get the first input file name
|
// get the first input file name
|
||||||
std::string input_file;
|
std::string input_file;
|
||||||
std::vector<std::string> v_scale;
|
std::vector<std::string> v_scale;
|
||||||
|
int num_objects = 0;
|
||||||
|
int num_instances = 0;
|
||||||
for (const ModelObject *model_object : m_model.objects) {
|
for (const ModelObject *model_object : m_model.objects) {
|
||||||
ModelInstance *printable = nullptr;
|
ModelInstance *printable = nullptr;
|
||||||
for (ModelInstance *model_instance : model_object->instances)
|
for (ModelInstance *model_instance : model_object->instances)
|
||||||
if (model_instance->is_printable()) {
|
if (model_instance->is_printable()) {
|
||||||
printable = model_instance;
|
printable = model_instance;
|
||||||
break;
|
++ num_instances;
|
||||||
}
|
}
|
||||||
if (printable) {
|
if (printable) {
|
||||||
|
++ num_objects;
|
||||||
// CHECK_ME -> Is the following correct ?
|
// CHECK_ME -> Is the following correct ?
|
||||||
v_scale.push_back("x:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(X) * 100) +
|
v_scale.push_back("x:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(X) * 100) +
|
||||||
"% y:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(Y) * 100) +
|
"% y:" + boost::lexical_cast<std::string>(printable->get_scaling_factor(Y) * 100) +
|
||||||
@ -43,6 +46,9 @@ void PrintBase::update_object_placeholders(DynamicConfig &config, const std::str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.set_key_value("num_objects", new ConfigOptionInt(num_objects));
|
||||||
|
config.set_key_value("num_instances", new ConfigOptionInt(num_instances));
|
||||||
|
|
||||||
config.set_key_value("scale", new ConfigOptionStrings(v_scale));
|
config.set_key_value("scale", new ConfigOptionStrings(v_scale));
|
||||||
if (! input_file.empty()) {
|
if (! input_file.empty()) {
|
||||||
// get basename with and without suffix
|
// get basename with and without suffix
|
||||||
|
Loading…
Reference in New Issue
Block a user