mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 09:02:06 +00:00
Fix crash when slicing multi-material print with wipe tower (#12682)
The WipeTower2 code path never called construct_mesh(), leaving wipe_tower_mesh_data as std::nullopt. GCode export then dereferenced it unconditionally, triggering an assertion failure / crash.
This commit is contained in:
@@ -3025,7 +3025,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||
}
|
||||
}
|
||||
// wipe tower area
|
||||
if (has_wipe_tower) {
|
||||
if (has_wipe_tower && print.wipe_tower_data().wipe_tower_mesh_data) {
|
||||
Polygon temp_Expoly = print.wipe_tower_data().wipe_tower_mesh_data->bottom;
|
||||
area_sum_temp += temp_Expoly.area();
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
// WT2 doesn't currently compute a rib-origin compensation like WipeTower (m_rib_offset),
|
||||
// so expose a zero offset for consistency purposes (to maintain API parity).
|
||||
Vec2f get_rib_offset() const { return Vec2f::Zero(); }
|
||||
float get_rib_width() const { return m_rib_width; }
|
||||
float get_rib_length() const { return m_rib_length; }
|
||||
|
||||
// Switch to a next layer.
|
||||
void set_layer(
|
||||
|
||||
@@ -3396,6 +3396,11 @@ void Print::_make_wipe_tower()
|
||||
|
||||
m_wipe_tower_data.used_filament = wipe_tower.get_used_filament();
|
||||
m_wipe_tower_data.number_of_toolchanges = wipe_tower.get_number_of_toolchanges();
|
||||
m_wipe_tower_data.construct_mesh(wipe_tower.width(), wipe_tower.get_depth(),
|
||||
wipe_tower.get_wipe_tower_height(), wipe_tower.get_brim_width(),
|
||||
config().wipe_tower_wall_type.value == WipeTowerWallType::wtwRib,
|
||||
wipe_tower.get_rib_width(), wipe_tower.get_rib_length(),
|
||||
config().wipe_tower_fillet_wall.value);
|
||||
const Vec3d origin = Vec3d::Zero();
|
||||
m_fake_wipe_tower.set_fake_extrusion_data(wipe_tower.position(), wipe_tower.width(), wipe_tower.get_wipe_tower_height(),
|
||||
config().initial_layer_print_height, m_wipe_tower_data.depth,
|
||||
|
||||
@@ -770,6 +770,7 @@ struct WipeTowerData
|
||||
number_of_toolchanges = -1;
|
||||
depth = 0.f;
|
||||
brim_width = 0.f;
|
||||
rib_offset = Vec2f::Zero();
|
||||
wipe_tower_mesh_data = std::nullopt;
|
||||
}
|
||||
void construct_mesh(float width, float depth, float height, float brim_width, bool is_rib_wipe_tower, float rib_width, float rib_length, bool fillet_wall);
|
||||
|
||||
Reference in New Issue
Block a user