mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 14:56:00 +08:00
add store/load 3mf flag,
that SLA support point is manualy edited by user (NOTE: After user editat is lost informtion about supporting island)
This commit is contained in:
parent
5ed055e8e4
commit
998175137c
@ -1419,6 +1419,7 @@ namespace Slic3r {
|
||||
std::vector<sla::SupportPoint> sla_support_points;
|
||||
|
||||
if (version == 0) {
|
||||
assert(object_data_points.size() % 3 == 0);
|
||||
for (unsigned int i=0; i<object_data_points.size(); i+=3)
|
||||
sla_support_points.push_back(sla::SupportPoint{Vec3f(
|
||||
float(std::atof(object_data_points[i+0].c_str())),
|
||||
@ -1427,15 +1428,22 @@ namespace Slic3r {
|
||||
0.4f});
|
||||
}
|
||||
if (version == 1) {
|
||||
auto get_support_point_type = [](double val)->sla::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<object_data_points.size(); i+=5)
|
||||
sla_support_points.push_back(sla::SupportPoint{Vec3f(
|
||||
float(std::atof(object_data_points[i+0].c_str())),
|
||||
sla_support_points.push_back(
|
||||
sla::SupportPoint{
|
||||
Vec3f{float(std::atof(object_data_points[i+0].c_str())),
|
||||
float(std::atof(object_data_points[i+1].c_str())),
|
||||
float(std::atof(object_data_points[i+2].c_str()))),
|
||||
float(std::atof(object_data_points[i+2].c_str()))},
|
||||
float(std::atof(object_data_points[i+3].c_str())),
|
||||
//FIXME storing boolean as 0 / 1 and importing it as float.
|
||||
std::abs(std::atof(object_data_points[i+4].c_str()) - 1.) < EPSILON ?
|
||||
sla::SupportPointType::island : sla::SupportPointType::manual_add});
|
||||
get_support_point_type(std::atof(object_data_points[i+4].c_str()))
|
||||
});
|
||||
}
|
||||
|
||||
if (!sla_support_points.empty())
|
||||
@ -3541,10 +3549,22 @@ namespace Slic3r {
|
||||
if (!sla_support_points.empty()) {
|
||||
sprintf(buffer, "object_id=%d|", count);
|
||||
out += buffer;
|
||||
|
||||
auto support_point_type_to_float = [](sla::SupportPointType t) -> 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";
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user