Skip to content

fix: preserve smoothed variable layer height profile with raft - #638

Open
mwz-iot wants to merge 2 commits into
process_optimistic_julyfrom
fix/raft_adaptive_layer_height_reset_on_smooth
Open

fix: preserve smoothed variable layer height profile with raft#638
mwz-iot wants to merge 2 commits into
process_optimistic_julyfrom
fix/raft_adaptive_layer_height_reset_on_smooth

Conversation

@mwz-iot

@mwz-iot mwz-iot commented Jul 29, 2026

Copy link
Copy Markdown

Description

This PR fixes two variable layer height issues that occur in raft-only configurations.

Issue 1: Smoothed variable layer height profile resets with raft enabled

Problem

When raft layers are enabled, the following steps cause the variable layer height profile to reset:

  1. Open the Variable Layer Height tool.
  2. Click Adaptive to generate a profile.
  3. Click Smooth.

The smoothed profile is displayed correctly at first, but approximately 500 ms later it is reset to the default straight profile.

Root Cause

PrintObject::update_layer_height_profile() compared the first height stored in the profile with the calculated first object layer height:

layer_height_profile[1] != slicing_parameters.first_object_layer_height

When a raft is present, the slicing logic may adjust the calculated first object layer height.

For example:

layer_height_profile[1]                       = 0.25 mm
slicing_parameters.first_object_layer_height = 0.20 mm

This difference is valid because the first object layer height is not fixed when a raft is present.

However, the previous validation treated the difference as invalid profile data and rebuilt the profile with layer_height_profile_from_ranges(). This caused the smoothed profile to be replaced by the default straight profile during the delayed background-process refresh.

Fix

The first profile height mismatch is now checked only when the first object layer height is fixed:

const bool first_layer_height_mismatch =
    slicing_parameters.first_object_layer_height_fixed() &&
    !layer_height_profile.empty() &&
    layer_height_profile[1] != slicing_parameters.first_object_layer_height;

When the first object layer height is not fixed because of a raft, the comparison is skipped and the valid variable layer height profile is preserved.

Issue 2: Incorrect Organic support incompatibility error with raft only

Problem

The following configuration incorrectly prevents the Variable Layer Height tool from opening:

  1. Select Organic tree as the support type.
  2. Keep support disabled.
  3. Enable raft layers only.
  4. Open the Variable Layer Height tool.

The application incorrectly reports:

Variable layer height is not supported with Organic supports

Root Cause

The Organic support compatibility check in Print.cpp used:

print_object.has_support_material()

has_support_material() returns true when either support or raft is enabled:

has_support() || has_raft()

As a result, a raft-only configuration was incorrectly treated as if Organic support were enabled.

Fix

The compatibility check now uses:

print_object.has_support()

instead of:

print_object.has_support_material()

The Organic support restriction is now applied only when support is actually enabled, not when the object only has raft layers.

Changes

Modified files:

  • src/libslic3r/PrintObject.cpp

    • Validate the first profile height only when the first object layer height is fixed.
    • Preserve valid variable layer height profiles when raft layers are enabled.
  • src/libslic3r/Print.cpp

    • Replace has_support_material() with has_support() in the Organic support compatibility check.
    • Prevent raft-only configurations from being treated as enabled support.

Compatibility

  • No new dependencies.
  • No configuration format changes.
  • No breaking changes.
  • No changes to the smoothing algorithm.
  • Existing first-layer validation remains active when the first object layer height is fixed.
  • Existing Organic support restrictions remain active when support is actually enabled.

Screenshots/Recordings/Graphs

Issue 1: Variable layer height profile reset

Before

With raft layers enabled, the smoothed variable layer height profile is briefly displayed and then reset to a straight line after the delayed background-process refresh.

2026-07-29.120626.mp4

After

With raft layers enabled, the smoothed variable layer height profile remains unchanged after the background-process refresh.

2026-07-29.120740.mp4

Issue 2: Incorrect Organic support error

Before

With Organic tree selected, support disabled, and raft enabled, opening the Variable Layer Height tool incorrectly displays an incompatibility error.
image

After

With Organic tree selected, support disabled, and raft enabled, the Variable Layer Height tool opens normally.

image

Tests

  • Enable raft layers, apply Adaptive and then Smooth, and verify that the profile does not reset.
  • Disable raft layers and verify that Adaptive and Smooth continue to work normally.
  • Select Organic tree, disable support, enable raft layers, and verify that the Variable Layer Height tool opens normally.
  • Enable Organic tree support and verify that the existing variable layer height incompatibility restriction is still applied.
  • Verify that normal first-layer profile validation remains active when the first object layer height is fixed.

@mwz-iot mwz-iot self-assigned this Jul 29, 2026
@mwz-iot mwz-iot changed the title fix: skip first-layer-height validation when raft is enabled fix: preserve smoothed variable layer height profile with raft Jul 29, 2026
has_support_material() returns has_support() || has_raft(), which
false-positively triggers the organic tree + variable layer height
incompatibility check when only raft is enabled without supports.

Use has_support() instead to only check when support is truly enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants