Fix z-offset handling for ZAA

This commit is contained in:
Aleksandr Dobkin
2026-03-16 13:48:42 -07:00
parent 29e35d77b1
commit 12232deb7a
2 changed files with 7 additions and 9 deletions

View File

@@ -30,8 +30,6 @@ static double slope_from_normal(const Eigen::Vector3d& normal)
return angle_rad; return angle_rad;
} }
// const int LINE = 180;
static bool contour_extrusion_path(LayerRegion *region, const sla::IndexedMesh &mesh, ExtrusionPath &path) static bool contour_extrusion_path(LayerRegion *region, const sla::IndexedMesh &mesh, ExtrusionPath &path)
{ {
if (region->region().config().zaa_region_disable) { if (region->region().config().zaa_region_disable) {
@@ -213,14 +211,13 @@ static void contour_extrusion_entity(LayerRegion *region, const sla::IndexedMesh
} }
static void handle_extrusion_collection(LayerRegion *region, const sla::IndexedMesh &mesh, ExtrusionEntityCollection &collection, std::initializer_list<ExtrusionRole> roles) { static void handle_extrusion_collection(LayerRegion *region, const sla::IndexedMesh &mesh, ExtrusionEntityCollection &collection, std::initializer_list<ExtrusionRole> roles) {
for (ExtrusionEntity *extr : collection.entities) { for (ExtrusionEntity* extr : collection.entities) {
// printf("handling extrusion collection %p %p\n", &collection, extr); if (!contains(roles, extr->role())) {
if (!contains(roles, extr->role())) {
continue; continue;
} }
contour_extrusion_entity(region, mesh, extr); contour_extrusion_entity(region, mesh, extr);
} }
} }
void Layer::make_contour_z(const sla::IndexedMesh &mesh) void Layer::make_contour_z(const sla::IndexedMesh &mesh)

View File

@@ -28,7 +28,6 @@
#include <float.h> #include <float.h>
#include <iterator> #include <iterator>
#include <mutex> #include <mutex>
#include <ostream>
#include <string> #include <string>
#include <oneapi/tbb/blocked_range.h> #include <oneapi/tbb/blocked_range.h>
#include <oneapi/tbb/concurrent_vector.h> #include <oneapi/tbb/concurrent_vector.h>
@@ -731,13 +730,15 @@ void PrintObject::contour_z()
} }
ModelInstance *inst = m_model_object->instances.front(); ModelInstance *inst = m_model_object->instances.front();
Point center_offset = this->center_offset(); Point center_offset = this->center_offset();
Geometry::Transformation trans = inst->get_transformation(); Geometry::Transformation trans = inst->get_transformation();
double z = trans.get_offset().z() - unscale<double>(this->height()) / 2;
trans.set_offset(Vec3d(-unscale<double>(center_offset.x()), -unscale<double>(center_offset.y()), 0)); trans.set_offset(Vec3d(-unscale<double>(center_offset.x()), -unscale<double>(center_offset.y()), 0));
mesh.transform(trans.get_matrix()); mesh.transform(trans.get_matrix());
sla::IndexedMesh imesh(mesh); sla::IndexedMesh imesh(mesh);
imesh.ground_level_offset(-z);
std::mutex mtx; std::mutex mtx;
size_t completed = 0; size_t completed = 0;
tbb::parallel_for( tbb::parallel_for(