mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-20 06:01:16 +00:00
Belt printer: supports reach the belt under a leading overhang
The slicing frame of a belt object started at its lowest vertex, but the belt under the leading end of an overhang lies below that, by the overhang's length times the tilt's shear. Every support generator works in layers at z >= 0, so none of them could reach it: normal supports stopped at the object's own lowest layer, and the two tree generators each carried a stack of hacks to extend themselves below it (a post-hoc copy of the lowest base area in TreeSupport, "virtual belt raft layers" in TreeSupport3D/TreeModelVolumes), sized from the pre-rotation bbox and capped at global z = 0, which is only right for the trailing half of the belt. Start the frame at the lowest belt-floor point under the footprint instead, less a 10 mm margin along the belt for the base of a support column (BeltSliceStrategy::apply_preslice_transforms and BeltTransformPipeline::compute_belt_height_and_floor agree on it). The layers between it and the first vertex come out empty, which belt slicing already tolerates, and the generators need no extension at all: - normal supports: the generator anchors its layer grid at the frame origin, so run it in the object frame and shift the global belt Z offset onto the result afterwards, as organic supports already did. With the offset on the object layers a top contact at negative z turned the intermediate-layer count negative and the generator allocated layers until the kernel killed it (any overhang in the leading half of the belt). Drop the first-layer flange expansion on a belt: the first support layer is the leading tip of the support, not a flange, and inflating it put lines in the air ahead of the belt. - classic tree: a node now keeps dropping until its whole circle is in the belt, so the branch tapers to a tip on the belt instead of stopping, a radius above it, when its centre crosses. - organic: the belt is no longer a support blocker. A blocker is a collision, and a branch descending onto one slides off it, down the tilted belt and ahead of the part; the belt is where branches end, which the per-layer m_belt_floor clipping already does. The belt brim is generated after the parallel support step instead of inside it: belt_brim_obstacles() reads every object's layers and support layers, which another object's support step rebuilds (and, now, shifts) at the same time. This is the race behind the Windows arm64 segfault in "Belt brim of each object precedes its perimeters on its own filament". Also: the belt tilt axis moves to Developer mode as its own row (a shared line is shown by its first option's mode), first_layer_plane band thickness, belt_support_floor_mode, belt_preslice_global and gcode_back_transform are retired and presumed on, the gravity arrow is a plain line along the up direction, and the "Show raw G-code (belt only)" preview toggle is gone. Regression test: "Belt supports reach the belt under a leading overhang" slices a cube with a fin whose underside is parallel to the layers, 20 mm ahead of the cube and up to 41 mm of slicing Z above the belt, for normal, organic and classic tree supports, and checks that the lowest support layer sits on the belt beneath its own lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
8039d4d2ac
commit
dda58b07cd
37 files changed
+412
-618
No files matched your search
+14
-13
@@ -36,6 +36,7 @@
|
||||
#include <tuple>
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
#if BOOST_VERSION >= 107800
|
||||
#include <boost/timer/timer.hpp>
|
||||
@@ -766,25 +767,25 @@ void Bed3D::render_gravity_arrow(const Transform3d& view_matrix, const Transform
|
||||
m_gravity_arrow.reset();
|
||||
return;
|
||||
}
|
||||
const Vec3d gravity_dir = -up_dir;
|
||||
|
||||
// Build the arrow model (same dimensions as the axis arrows)
|
||||
if (!m_gravity_arrow.is_initialized()) {
|
||||
const float stem_length = Axes::DefaultStemLength;
|
||||
const float tip_radius = Axes::DefaultTipRadius;
|
||||
const float tip_length = Axes::DefaultTipLength;
|
||||
const float stem_radius = stem_length / 75.f; // same ratio as axis cylinders
|
||||
m_gravity_arrow.init_from(stilized_arrow(16, tip_radius, tip_length, stem_radius, stem_length));
|
||||
// A plain line along the tilted "up" direction -- the way the layers lean, i.e.
|
||||
// the gantry -- drawn like the bed axes (no tip: the other direction is not
|
||||
// possible) and shorter than them, so it reads as a hint inside the YZ corner.
|
||||
const float length = 0.6f * m_axes.get_total_length();
|
||||
if (!m_gravity_arrow.is_initialized() || m_gravity_arrow_length != length) {
|
||||
m_gravity_arrow.reset();
|
||||
m_gravity_arrow.init_from(smooth_cylinder(16, /*Radius*/ length / 75.f, length));
|
||||
m_gravity_arrow_length = length;
|
||||
}
|
||||
|
||||
// The arrow model points along +Z by default. Compute rotation to align with gravity_dir.
|
||||
// Rotation axis = cross(+Z, gravity_dir), angle = acos(dot(+Z, gravity_dir))
|
||||
// The cylinder model points along +Z. Compute the rotation that aligns it with
|
||||
// up_dir: rotation axis = cross(+Z, up_dir), angle = acos(dot(+Z, up_dir)).
|
||||
Vec3d from = Vec3d::UnitZ();
|
||||
Vec3d to = gravity_dir;
|
||||
Vec3d to = up_dir;
|
||||
double dot = from.dot(to);
|
||||
Transform3d rot = Transform3d::Identity();
|
||||
if (dot < -0.9999) {
|
||||
// Nearly opposite — rotate 180° around X
|
||||
// Nearly opposite -- rotate 180 degrees around X
|
||||
rot = Eigen::AngleAxisd(M_PI, Vec3d::UnitX()) * rot;
|
||||
} else if (dot < 0.9999) {
|
||||
Vec3d axis = from.cross(to).normalized();
|
||||
@@ -800,7 +801,7 @@ void Bed3D::render_gravity_arrow(const Transform3d& view_matrix, const Transform
|
||||
shader->start_using();
|
||||
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
Transform3d model_matrix = rot;
|
||||
Transform3d model_matrix = Eigen::Translation3d(m_axes.get_origin()) * rot;
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * model_matrix);
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
|
||||
|
||||
Reference in new issue
Block a user