3mf export - Do not export unneeded space

This commit is contained in:
enricoturri1966 2021-01-27 15:53:44 +01:00
parent d68489c7d7
commit b178a1b04f

View File

@ -2193,9 +2193,9 @@ namespace Slic3r {
std::stringstream stream; std::stringstream stream;
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
stream << "<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n"; stream << "<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n";
stream << " <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\" />\n"; stream << " <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/>\n";
stream << " <Default Extension=\"model\" ContentType=\"application/vnd.ms-package.3dmanufacturing-3dmodel+xml\" />\n"; stream << " <Default Extension=\"model\" ContentType=\"application/vnd.ms-package.3dmanufacturing-3dmodel+xml\"/>\n";
stream << " <Default Extension=\"png\" ContentType=\"image/png\" />\n"; stream << " <Default Extension=\"png\" ContentType=\"image/png\"/>\n";
stream << "</Types>"; stream << "</Types>";
std::string out = stream.str(); std::string out = stream.str();
@ -2232,8 +2232,8 @@ namespace Slic3r {
std::stringstream stream; std::stringstream stream;
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
stream << "<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n"; stream << "<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n";
stream << " <Relationship Target=\"/" << MODEL_FILE << "\" Id=\"rel-1\" Type=\"http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel\" />\n"; stream << " <Relationship Target=\"/" << MODEL_FILE << "\" Id=\"rel-1\" Type=\"http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel\"/>\n";
stream << " <Relationship Target=\"/" << THUMBNAIL_FILE << "\" Id=\"rel-2\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail\" />\n"; stream << " <Relationship Target=\"/" << THUMBNAIL_FILE << "\" Id=\"rel-2\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail\"/>\n";
stream << "</Relationships>"; stream << "</Relationships>";
std::string out = stream.str(); std::string out = stream.str();
@ -2379,7 +2379,7 @@ namespace Slic3r {
else else
{ {
stream << " <" << COMPONENTS_TAG << ">\n"; stream << " <" << COMPONENTS_TAG << ">\n";
stream << " <" << COMPONENT_TAG << " objectid=\"" << object_id << "\" />\n"; stream << " <" << COMPONENT_TAG << " objectid=\"" << object_id << "\"/>\n";
stream << " </" << COMPONENTS_TAG << ">\n"; stream << " </" << COMPONENTS_TAG << ">\n";
} }
@ -2502,7 +2502,7 @@ namespace Slic3r {
ptr = format_coordinate(v.y(), ptr); ptr = format_coordinate(v.y(), ptr);
boost::spirit::karma::generate(ptr, "\" z=\""); boost::spirit::karma::generate(ptr, "\" z=\"");
ptr = format_coordinate(v.z(), ptr); ptr = format_coordinate(v.z(), ptr);
boost::spirit::karma::generate(ptr, "\" />\n"); boost::spirit::karma::generate(ptr, "\"/>\n");
*ptr = '\0'; *ptr = '\0';
output_buffer += buf; output_buffer += buf;
if (! flush()) if (! flush())
@ -2540,7 +2540,7 @@ namespace Slic3r {
boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG << boost::spirit::karma::generate(ptr, boost::spirit::lit(" <") << TRIANGLE_TAG <<
" v1=\"" << boost::spirit::int_ << " v1=\"" << boost::spirit::int_ <<
"\" v2=\"" << boost::spirit::int_ << "\" v2=\"" << boost::spirit::int_ <<
"\" v3=\"" << boost::spirit::int_ << "\" ", "\" v3=\"" << boost::spirit::int_ << "\"",
idx[0] + volume_it->second.first_vertex_id, idx[0] + volume_it->second.first_vertex_id,
idx[1] + volume_it->second.first_vertex_id, idx[1] + volume_it->second.first_vertex_id,
idx[2] + volume_it->second.first_vertex_id); idx[2] + volume_it->second.first_vertex_id);
@ -2550,18 +2550,20 @@ namespace Slic3r {
std::string custom_supports_data_string = volume->supported_facets.get_triangle_as_string(i); std::string custom_supports_data_string = volume->supported_facets.get_triangle_as_string(i);
if (! custom_supports_data_string.empty()) { if (! custom_supports_data_string.empty()) {
output_buffer += " ";
output_buffer += CUSTOM_SUPPORTS_ATTR; output_buffer += CUSTOM_SUPPORTS_ATTR;
output_buffer += "=\""; output_buffer += "=\"";
output_buffer += custom_supports_data_string; output_buffer += custom_supports_data_string;
output_buffer += "\" "; output_buffer += "\"";
} }
std::string custom_seam_data_string = volume->seam_facets.get_triangle_as_string(i); std::string custom_seam_data_string = volume->seam_facets.get_triangle_as_string(i);
if (! custom_seam_data_string.empty()) { if (! custom_seam_data_string.empty()) {
output_buffer += " ";
output_buffer += CUSTOM_SEAM_ATTR; output_buffer += CUSTOM_SEAM_ATTR;
output_buffer += "=\""; output_buffer += "=\"";
output_buffer += custom_seam_data_string; output_buffer += custom_seam_data_string;
output_buffer += "\" "; output_buffer += "\"";
} }
output_buffer += "/>\n"; output_buffer += "/>\n";
@ -2603,7 +2605,7 @@ namespace Slic3r {
stream << " "; stream << " ";
} }
} }
stream << "\" " << PRINTABLE_ATTR << "=\"" << item.printable << "\" />\n"; stream << "\" " << PRINTABLE_ATTR << "=\"" << item.printable << "\"/>\n";
} }
stream << " </" << BUILD_TAG << ">\n"; stream << " </" << BUILD_TAG << ">\n";