From 3d5e32a8768fe7ee7c89ee259c27d3f83c2b45a8 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 2 Jan 2020 11:37:50 +0100 Subject: [PATCH] #3435 - Added object's instances count into Slic3r_PE_model.config inside exported .3mf files --- src/libslic3r/Format/3mf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index 376b34ca8..b485e83d8 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -87,6 +87,7 @@ const char* V3_ATTR = "v3"; const char* OBJECTID_ATTR = "objectid"; const char* TRANSFORM_ATTR = "transform"; const char* PRINTABLE_ATTR = "printable"; +const char* INSTANCESCOUNT_ATTR = "instances_count"; const char* KEY_ATTR = "key"; const char* VALUE_ATTR = "value"; @@ -1613,6 +1614,9 @@ namespace Slic3r { 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_curr_config.object_id = object_id; return true; @@ -2495,7 +2499,8 @@ namespace Slic3r { const ModelObject* obj = obj_metadata.second.object; 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 if (!obj->name.empty())