diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index f4b16b3650..e8fde1fbb1 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -1419,23 +1419,31 @@ namespace Slic3r { std::vector sla_support_points; if (version == 0) { + assert(object_data_points.size() % 3 == 0); for (unsigned int i=0; isla::SupportPointType{ + return (std::abs(val - 1.) < EPSILON) ? sla::SupportPointType::island : + (std::abs(val - 2.) < EPSILON) ? sla::SupportPointType::manual_add : + //(std::abs(val - 3.) < EPSILON) ? sla::SupportPointType::slope : + sla::SupportPointType::slope; // default for previous version of store points + }; + assert(object_data_points.size() % 5 == 0); for (unsigned int i=0; i float { + switch (t) { + case Slic3r::sla::SupportPointType::manual_add: return 2.f; + case Slic3r::sla::SupportPointType::island: return 1.f; + case Slic3r::sla::SupportPointType::slope: return 3.f; + default: assert(false); return 0.f; + } + }; // Store the layer height profile as a single space separated list. for (size_t i = 0; i < sla_support_points.size(); ++i) { - sprintf(buffer, (i==0 ? "%f %f %f %f %f" : " %f %f %f %f %f"), sla_support_points[i].pos(0), sla_support_points[i].pos(1), sla_support_points[i].pos(2), sla_support_points[i].head_front_radius, (float)(sla_support_points[i].is_island())); + sprintf(buffer, (i==0 ? "%f %f %f %f %f" : " %f %f %f %f %f"), + sla_support_points[i].pos(0), + sla_support_points[i].pos(1), + sla_support_points[i].pos(2), + sla_support_points[i].head_front_radius, + support_point_type_to_float(sla_support_points[i].type)); out += buffer; } out += "\n"; diff --git a/src/libslic3r/Format/3mf.hpp b/src/libslic3r/Format/3mf.hpp index 78f95b7db0..b2e3746fd2 100644 --- a/src/libslic3r/Format/3mf.hpp +++ b/src/libslic3r/Format/3mf.hpp @@ -19,7 +19,18 @@ namespace Slic3r { * version 1 : ThreeMF_support_points_version=1 object_id=1|-12.055421 -2.658771 10.000000 0.4 0.0 object_id=2|-14.051745 -3.570338 5.000000 0.6 1.0 - // introduced header with version number; x,y,z,head_size,is_new_island) + // introduced header with version number; x,y,z,head_size,type) + // before 2.9.1 fifth float means is_island (bool flag) -> value from 0.9999f to 1.0001f means it is support for island otherwise not. User edited points has always value zero. + // since 2.9.1 fifth float means type -> starts show user edited points + // type range value meaning + // (float is used only for compatibility, string will be better) + // from | to | meaning + // -------------------------------- + // 0.9999f | 1.0001 | island (no change) + // 1.9999f | 2.0001 | manual edited points loose info about island + // 2.9999f | 3.0001 | generated point by slope ration + // all other values are readed also as slope type + */ enum {