Skip to content

preview: one preamble for every GUI, restating modes only - #4618

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:axis-preview-m61
Open

grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:axis-preview-m61

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

The preview starts from the machine's state, restated as G-code. AXIS and the gremlin GUIs (gmoccapy, gscreen, qtvcp) each built that preamble their own way, with a bug each:

  • AXIS restated stat.mcodes[3], the last block's tool change. After an MDI M61 Q1 a reload ran a bare M61 and failed with "Need non-negative Q-word to specify tool number with M61". Found by Sigma1912.
  • gremlin restated a bare G43, which in the preview takes the loaded tool's table offset. After G43 H<other>, G43.1 or G43.2 the preview starts at the wrong height, so moves relative to the start point are drawn off.

preview_helpers.preview_initcodes() is now the one preamble for all of them. It restates only the slots that hold a mode, and the tool length offset in force as G43.1 or G49. It replaces create_unitcode_and_initcode().

I checked it against the tool tip sampled on a sim run: the preview from the shared preamble matches within 0.005 mm in every case, where the gremlin one was 8 to 18 mm off with G43 H<other>, G43.1 and G43.2. tests/interp_initcode now covers G43.1 and a final M61.

@Sigma1912

Copy link
Copy Markdown
Contributor

Also fixes a bug in gremlin where a gcode (re)loaded against an active G91 would cause an error Cannot use g53 incremental

AXIS restated the last block's tool change from stat.mcodes[3], so a
reload after an MDI M61 Q1 ran a bare M61 and failed. The gremlin GUIs
restated a bare G43, which in the preview takes the loaded tool's table
offset, so after G43 H<other>, G43.1 or G43.2 the preview started at the
wrong height. Reported by Sigma1912.

preview_helpers.preview_initcodes() is now the one preamble: it restates
only the slots that hold a mode, and the tool length offset in force as
G43.1 or G49. AXIS, gremlin and qt5_graphics call it.
@grandixximo

Copy link
Copy Markdown
Contributor Author

Rebased on master after #4600. Two things changed with it:

  • preview_initcodes() now uses axis_kinds.wrapped() for the wrapped rotaries, and restates the tilted work plane with workplane_code() right after the machine units, as AXIS did on master. tests/workplane-preview calls preview_initcodes() now that create_unitcode_and_initcode() is gone.
  • The first version left out stat.gcodes[5], the program's G20/G21, on the assumption that the units were already restated. They were not: stat.linear_units is the machine's units, so after an MDI G21 on an inch machine the preview ran the file in inches. tests/workplane-preview caught it once rebased. Slot 5 is restated again, as it was before.

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.

2 participants