#3435 - Added object's instances count into Slic3r_PE_model.config inside exported .3mf files

This commit is contained in:
Enrico Turri 2020-01-02 11:37:50 +01:00
parent a2ff94515f
commit 3d5e32a876

View File

@ -87,6 +87,7 @@ const char* V3_ATTR = "v3";
const char* OBJECTID_ATTR = "objectid"; const char* OBJECTID_ATTR = "objectid";
const char* TRANSFORM_ATTR = "transform"; const char* TRANSFORM_ATTR = "transform";
const char* PRINTABLE_ATTR = "printable"; const char* PRINTABLE_ATTR = "printable";
const char* INSTANCESCOUNT_ATTR = "instances_count";
const char* KEY_ATTR = "key"; const char* KEY_ATTR = "key";
const char* VALUE_ATTR = "value"; const char* VALUE_ATTR = "value";
@ -1613,6 +1614,9 @@ namespace Slic3r {
return false; return false;
} }
// Added because of github #3435, currently not used by PrusaSlicer
int instances_count_id = get_attribute_value_int(attributes, num_attributes, INSTANCESCOUNT_ATTR);
m_objects_metadata.insert(IdToMetadataMap::value_type(object_id, ObjectMetadata())); m_objects_metadata.insert(IdToMetadataMap::value_type(object_id, ObjectMetadata()));
m_curr_config.object_id = object_id; m_curr_config.object_id = object_id;
return true; return true;
@ -2495,7 +2499,8 @@ namespace Slic3r {
const ModelObject* obj = obj_metadata.second.object; const ModelObject* obj = obj_metadata.second.object;
if (obj != nullptr) if (obj != nullptr)
{ {
stream << " <" << OBJECT_TAG << " id=\"" << obj_metadata.first << "\">\n"; // Output of instances count added because of github #3435, currently not used by PrusaSlicer
stream << " <" << OBJECT_TAG << " " << ID_ATTR << "=\"" << obj_metadata.first << "\" " << INSTANCESCOUNT_ATTR << "=\"" << obj->instances.size() << "\">\n";
// stores object's name // stores object's name
if (!obj->name.empty()) if (!obj->name.empty())