mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-07-05 17:17:06 +02:00
Changed internal coordinates of drain holes
Drain holes reference position was saved slightly above the mesh to avoid problem when the hole is placed on flat or nearly flat surface The depth of the hole was internally bigger than what the user has set to compensato for it However, this leads to problem with scaling and makes reprojection of the holes on the mesh complicated This commit changes the reference point to the point on the mesh and the extra elevation is handled when rendering and drilling the hole. The change is reflected in 3MF drain holes versioning so that old 3MFs are loaded correctly. Reprojection on the mesh after reload from disk/fix through netfabb has been enabled.
This commit is contained in:
@@ -1103,7 +1103,7 @@ namespace Slic3r {
|
||||
|
||||
sla::DrainHoles sla_drain_holes;
|
||||
|
||||
if (version == 1) {
|
||||
if (version == 1 || version == 2) {
|
||||
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())),
|
||||
float(std::atof(object_data_points[i+1].c_str())),
|
||||
@@ -1114,6 +1114,16 @@ namespace Slic3r {
|
||||
float(std::atof(object_data_points[i+6].c_str())),
|
||||
float(std::atof(object_data_points[i+7].c_str())));
|
||||
}
|
||||
|
||||
if (version == 1) {
|
||||
// In this version the holes were saved elevated above the mesh and deeper (bad idea indeed).
|
||||
// Place the hole to the mesh and make it shallower to compensate.
|
||||
// The offset was 1 mm above the mesh.
|
||||
for (sla::DrainHole& hole : sla_drain_holes) {
|
||||
hole.pos += hole.normal.normalized();
|
||||
hole.height -= 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sla_drain_holes.empty())
|
||||
m_sla_drain_holes.insert(IdToSlaDrainHolesMap::value_type(object_id, sla_drain_holes));
|
||||
|
||||
@@ -20,8 +20,15 @@ namespace Slic3r {
|
||||
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 {
|
||||
drain_holes_format_version = 1
|
||||
drain_holes_format_version = 2
|
||||
};
|
||||
|
||||
class Model;
|
||||
@@ -35,6 +42,6 @@ namespace Slic3r {
|
||||
// The model could be modified during the export process if meshes are not repaired or have no shared vertices
|
||||
extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr);
|
||||
|
||||
}; // namespace Slic3r
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif /* slic3r_Format_3mf_hpp_ */
|
||||
|
||||
Reference in New Issue
Block a user