OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::BeltSliceStrategy Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/BeltSliceStrategy.hpp>

Static Public Member Functions

static void apply_preslice_transforms (Transform3d &trafo, const PrintConfig &config, const ModelVolumePtrs &model_volumes, double *out_belt_min_z=nullptr)

Detailed Description

Member Function Documentation

◆ apply_preslice_transforms()

void Slic3r::BeltSliceStrategy::apply_preslice_transforms ( Transform3d & trafo,
const PrintConfig & config,
const ModelVolumePtrs & model_volumes,
double * out_belt_min_z = nullptr )
static
16{
17 // 1. Belt rotation — the sole mesh-side belt transform (matching
18 // BeltTransformPipeline::build_forward_transform). Only active in
19 // belt-printer mode.
20 bool has_rotation = false;
21 if (config.belt_printer.value) {
22 const Matrix3d rot = BeltTransformPipeline::build_rotation_matrix(config, &has_rotation);
23 if (has_rotation) {
24 Transform3d belt_xform = Transform3d::Identity();
25 belt_xform.linear() = rot;
26 trafo = belt_xform * trafo;
27 }
28 }
29
30 if (!has_rotation)
31 return;
32
33 // 2. Z-shift — detect if the mesh clips below the build plate after the
34 // transforms and lift it. Each mesh vertex must be brought into object space
35 // via mv->get_matrix() before applying the full trafo (which is in object
36 // space). Missing this on assemblies (where per-volume get_matrix() positions
37 // each volume within the object) would compute min_z against mesh-local vertex
38 // coordinates rather than object-space coordinates, so volumes translated along
39 // the slicer's Z axis would be silently excluded from the bound check.
40
41 //
42 // The lift is measured to the lowest point of the SUPPORT region, not of the
43 // mesh: the belt floor (z = shear * u in this rotated frame, u the from-axis
44 // coordinate) runs below every vertex, and under the leading end of an
45 // overhang it lies below the lowest vertex by up to the overhang's length
46 // times the shear. Supports have to reach that floor, and every support
47 // generator works in layers at z >= 0, so z = 0 has to be the lowest floor
48 // point under the footprint. The layers between it and the first vertex
49 // come out empty, which belt slicing already tolerates (the bottom corner
50 // of a tilted part is a point). Vertices on the belt have z == floor, so
51 // for a part resting on the belt this is simply the floor at its leading
52 // extreme, less the frame margin (see BeltTransformPipeline::frame_margin).
53 BeltTransformPipeline::BeltFloorParams floor;
54 const bool has_floor = BeltTransformPipeline::floor_shear(config, floor);
55 double min_z = std::numeric_limits<double>::max();
56 for (const ModelVolume *mv : model_volumes) {
57 if (!mv->is_model_part()) continue;
58 Transform3d vol_trafo = trafo * mv->get_matrix();
59 const auto &its = mv->mesh().its;
60 for (const stl_vertex &v : its.vertices) {
61 Vec3d vm = v.cast<double>();
62 Vec3d pt = vol_trafo * vm;
63 min_z = std::min(min_z, pt.z());
64 if (has_floor)
65 min_z = std::min(min_z, floor.shear_factor * (floor.from_axis == 0 ? pt.x() : pt.y()));
66 }
67 }
68 if (has_floor && min_z != std::numeric_limits<double>::max())
70 const double z_shift_val = (min_z < 0. && min_z != std::numeric_limits<double>::max()) ? -min_z : 0.;
71 if (z_shift_val > 0.) {
72 Transform3d z_shift = Transform3d::Identity();
73 z_shift.matrix()(2, 3) = z_shift_val;
74 trafo = z_shift * trafo;
75 }
76 // out_belt_min_z is only meaningful in belt mode.
77 if (out_belt_min_z && config.belt_printer.value) {
78 *out_belt_min_z = (min_z != std::numeric_limits<double>::max()) ? min_z : 0.;
79 }
80}
static double frame_margin(const BeltFloorParams &fp)
Definition BeltTransform.hpp:116
static Matrix3d build_rotation_matrix(const PrintConfig &config, bool *has_rot_out=nullptr)
Definition BeltTransform.cpp:19
static bool floor_shear(const PrintConfig &config, BeltFloorParams &out)
Definition BeltTransform.cpp:142
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
Eigen::Matrix< double, 3, 3, Eigen::DontAlign > Matrix3d
Definition Point.hpp:86

References Slic3r::BeltTransformPipeline::build_rotation_matrix(), Slic3r::BeltTransformPipeline::floor_shear(), Slic3r::BeltTransformPipeline::frame_margin(), Slic3r::BeltTransformPipeline::BeltFloorParams::from_axis, and Slic3r::BeltTransformPipeline::BeltFloorParams::shear_factor.

Referenced by Slic3r::slice_volumes_inner(), and Slic3r::PrintObject::trafo_sliced().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: