Skip to content

axis: rebuild the program preview after an MDI rotation - #4836

Open
kVinsom wants to merge 1 commit into
LinuxCNC:masterfrom
kVinsom:fix/498-axis-rotation-preview
Open

kVinsom wants to merge 1 commit into
LinuxCNC:masterfrom
kVinsom:fix/498-axis-rotation-preview

Conversation

@kVinsom

@kVinsom kVinsom commented Nov 12, 2026

Copy link
Copy Markdown

AXIS redraws the coordinate axes when the active XY rotation changes, but the loaded program geometry still contains the rotation from its last parse. In the AXIS simulator, this is visible after homing and issuing G10 L2 P1 R45 in MDI with a program loaded.

When MDI becomes idle after an XY rotation change, AXIS synchronizes the interpreter's parameter file and rebuilds the preview using the same program input, including cached filter output. The controller's open program and mode are preserved. Failed refreshes mark the preview incomplete so its extents are not presented as a complete check.

Fixes #498.

Validation

  • Seven headless checks exercised the production Python refresh functions with a temporary parameter file and stand-ins for the GUI, interpreter and controller. They covered one refresh per change, rotation back to zero, pending MDI, an unrelated program, a failed sync, a parse error, and polling integration. The polling check failed on the unmodified branch.
  • Python compilation and git diff --check passed.
  • Full AXIS simulator and hardware validation were unavailable locally. To verify visually in sim/axis, home the machine, load a program with an XY path that does not set its own coordinate rotation, and issue G10 L2 P1 R45 in MDI while G54 is active. Both the axes and the preview should rotate after the command finishes. G10 L2 P1 R0 should restore the original orientation without a manual reload.

AI assistance was used to prepare the change and the local test harness.

if c.wait_complete() != linuxcnc.RCS_DONE:
canon.preview_incomplete = True
return
updated = AxisCanon(o, widgets.text, canon.linecount, DummyProgress(), arcdivision)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a program that is slow to parse (a 5M-iteration o100 while loop, about 9 s), Esc stops a normal load halfway, but this rebuild runs to the end: Esc at 2 s, done at 9.6 s. It has no progress bar, and cancel_open() sets aborted on o.canon, which is still the old preview here. Would a Progress and the same Esc binding as in open_file_guts() fit, so the rebuild can be cancelled and holds off input like a normal load?

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.

Preview does not rotate

2 participants