Drainholes are saved elevated for 3MF compatibility
This is a follow-up of previous commit
This commit is contained in:
parent
a95509ce36
commit
c51a45ee0f
@ -1103,7 +1103,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
sla::DrainHoles sla_drain_holes;
|
sla::DrainHoles sla_drain_holes;
|
||||||
|
|
||||||
if (version == 1 || version == 2) {
|
if (version == 1) {
|
||||||
for (unsigned int i=0; i<object_data_points.size(); i+=8)
|
for (unsigned int i=0; i<object_data_points.size(); i+=8)
|
||||||
sla_drain_holes.emplace_back(Vec3f{float(std::atof(object_data_points[i+0].c_str())),
|
sla_drain_holes.emplace_back(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+1].c_str())),
|
||||||
@ -1115,15 +1115,14 @@ namespace Slic3r {
|
|||||||
float(std::atof(object_data_points[i+7].c_str())));
|
float(std::atof(object_data_points[i+7].c_str())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version == 1) {
|
// The holes are saved elevated above the mesh and deeper (bad idea indeed).
|
||||||
// In this version the holes were saved elevated above the mesh and deeper (bad idea indeed).
|
// This is retained for compatibility.
|
||||||
// Place the hole to the mesh and make it shallower to compensate.
|
// Place the hole to the mesh and make it shallower to compensate.
|
||||||
// The offset was 1 mm above the mesh.
|
// The offset is 1 mm above the mesh.
|
||||||
for (sla::DrainHole& hole : sla_drain_holes) {
|
for (sla::DrainHole& hole : sla_drain_holes) {
|
||||||
hole.pos += hole.normal.normalized();
|
hole.pos += hole.normal.normalized();
|
||||||
hole.height -= 1.f;
|
hole.height -= 1.f;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!sla_drain_holes.empty())
|
if (!sla_drain_holes.empty())
|
||||||
m_sla_drain_holes.insert(IdToSlaDrainHolesMap::value_type(object_id, sla_drain_holes));
|
m_sla_drain_holes.insert(IdToSlaDrainHolesMap::value_type(object_id, sla_drain_holes));
|
||||||
@ -2601,7 +2600,18 @@ namespace Slic3r {
|
|||||||
for (const ModelObject* object : model.objects)
|
for (const ModelObject* object : model.objects)
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
auto& drain_holes = object->sla_drain_holes;
|
sla::DrainHoles drain_holes = object->sla_drain_holes;
|
||||||
|
|
||||||
|
// The holes were placed 1mm above the mesh in the first implementation.
|
||||||
|
// This was a bad idea and the reference point was changed in 2.3 so
|
||||||
|
// to be on the mesh exactly. The elevated position is still saved
|
||||||
|
// in 3MFs for compatibility reasons.
|
||||||
|
for (sla::DrainHole& hole : drain_holes) {
|
||||||
|
hole.pos -= hole.normal.normalized();
|
||||||
|
hole.height += 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!drain_holes.empty())
|
if (!drain_holes.empty())
|
||||||
{
|
{
|
||||||
out += string_printf(fmt, count);
|
out += string_printf(fmt, count);
|
||||||
|
@ -20,15 +20,8 @@ namespace Slic3r {
|
|||||||
support_points_format_version = 1
|
support_points_format_version = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* The same for holes.
|
|
||||||
|
|
||||||
* version 0: undefined
|
|
||||||
* version 1: holes saved a bit above the mesh and deeper
|
|
||||||
* version 2: holes are saved on the mesh exactly
|
|
||||||
*/
|
|
||||||
enum {
|
enum {
|
||||||
drain_holes_format_version = 2
|
drain_holes_format_version = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
|
Loading…
Reference in New Issue
Block a user