Skip to content

fix: fix cross section position for apis that clear the scene - #239

Open
LKasianAnsys wants to merge 2 commits into
mainfrom
fix/apis-that-clear-scene-cross-section-plane-fix
Open

LKasianAnsys wants to merge 2 commits into
mainfrom
fix/apis-that-clear-scene-cross-section-plane-fix

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Resolves #238

Summary

Addresses a bug on main observed in both CLIENT and SERVER mode: running the start API with a dataset after add_dataset had previously been called, results in the new dataset from the start API call not appearing in the viewer console.

The bug

Expected behaviour of the start API:

  • if no input is provided, it simply starts the visualizer instance/trame server.
  • if input is provided, it first clears the scene, then starts the visualizer instance/trame server.
    If a scene already contained one or more datasets, running start with no dataset provided would bring up the old scene; running start with a dataset provided as input would clear the scene and start a fresh scene with only the dataset that was provided as input.

Observed behaviour when the start API is called:

  • when no input is provided, it starts the visualizer instanc/trame server as expected.
  • when input is provided, the original scene is cleared as expected, but the new dataset does not show in the viewer canvas. The new dataset is represented correctly in the tree view.

Root cause: the renderer saves the cross-section plane position the first time it places it (fitted to the first dataset). On every later placement it puts that saved position back, so that a user-dragged plane survives part toggles. But clear() never discarded that saved position, and the renderer couldn't tell a default position from a deliberately set one. After start cleared the scene, the new dataset got the plane fitted to the old dataset.

Fix summary

The renderer now records whether the cross-section plane was placed on purpose, through sync_cross_section_plane (a client or server drag, or load_state). If it wasn't, update_bounds recomputes the default plane from the current scene bounds on every dataset add. VisorSceneBase.clear() now calls the new reset_cross_section_plane(), so start, update and clear all discard any previous plane and the next dataset gets a correct default position. A deliberately placed plane is still preserved until the next clear.

@LKasianAnsys LKasianAnsys self-assigned this Nov 20, 2026
@github-actions github-actions Bot added test Work associated with testing fixed bug Something isn't working labels Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixed test Work associated with testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug located in start API after running add_dataset

2 participants