How the main screen selects the axes in use

Contents · 中文版

The previous lesson explained menu contents and selection actions. This lesson uses the original axis menu on the main screen to show how a choice is stored in shared parameters and how coordinate rows appear or disappear.

This lesson uses the standard coordinate area and axis menu. First understand where the setting comes from; the later Teach point-capture lesson explains how the same setting controls table columns and generated code.

1. Find the coordinate area on the right

Figure 1: Original main screen; coordinates are on the right, the status reads Simulation, and no machining file is loaded

Click the screenshot to view the original image.

The original English headings are Mechanical, Relative and Remaining dis. The work coordinate group, such as G54, also appears in the middle. In this chapter, “work coordinate” refers to the field under Relative. Each axis occupies a complete row.

Figure 2: Original coordinate area with all six rows, X through C

Click the screenshot to view the original image.

Keep these three states separate:

State Source in this example Meaning
Axis selected by the standard configuration #912.itemmax[0..5] The shared axis flags covered in this lesson
Axis homing complete #314.item[0..5] Also used by the origin indicator in the coordinate row
Drive enabled Servo output configuration and associated IO state Requires tracing the connection and output scripts

Hiding the C row does not mean that the C drive is immediately disabled or that its homing state is cleared.

2. Right-click a coordinate heading with developer access

Use the original login facility to obtain developer access. Right-click Mechanical and release the mouse button to open the original menu.

Figure 3: Original Coordinate Axis Display Configuration menu with C-axis checked

Click the screenshot to view the original image.

The heading widget, label_23 in env/maininterface/maininterface.ui, contains:

-A:(rightMouseButtonRelease:/env/program/coordcnfmenu[0])

Read this as right-button release → call coordcnfmenu → use the specified channel. [0] is this system's channel notation, not menu item zero. See the earlier menu lesson for channel handling.

The entire original env/program/coordcnfmenu script is:

IF#1026.item[0]!=2GOTO1
widgetFunc["PopMenu","","",912]
N1

When the access value is not 2, the script jumps to its end. With value 2, it creates the menu from parameter #912. This entry therefore opens the axis menu only with developer access.

Other original headings, including Relative, use the same entry. Each heading does not need its own copy of the menu contents.

3. Follow the C-axis item

#912 holds both the menu contents and the axis flags used by the standard configuration. A heading item and separator precede the axes. Consequently, C-axis is menu item 7, while its axis flag is item 5. Both counts start at zero.

Axis Menu item index Selection flag Value 1 means
X 2 #912.itemmax[0] X selected
Y 3 #912.itemmax[1] Y selected
Z 4 #912.itemmax[2] Z selected
A 5 #912.itemmax[3] A selected
B 6 #912.itemmax[4] B selected
C 7 #912.itemmax[5] C selected

The C menu item uses several fields:

Field in #912 Current contents Purpose
itemtitle[7] C-axis Displayed menu label
itemdesc[7] Action text below Toggle the flag and call the script
item[7] Two rules below Determine the check mark
itemversion[7] 1 Script channel for the menu action
itemmax[5] 1 or 0 C flag read by other pages and scripts

Original action text:

/env/funcscripts/menuconfig<<#912itemmax5=1-#912itemmax5

If the old value is 1, 1-1 produces 0. Clicking again produces 1-0, or 1. Menu handling evaluates the attached expression after << before dispatching the script named before it. menuconfig performs the original menu refresh; the attached assignment changes the C flag.

Original check-mark rules:

-C(#912itemmax5==1)
-R0

Here -R0 belongs to a menu item and uses condition 0 to control its check mark. Do not apply the input-field interpretation of “read-only.” Likewise, although itemmax can hold an upper limit, this standard design uses these particular fields as axis flags. Follow their actual readers and writers.

4. Why the entire C coordinate row disappears

Click C-axis to clear its check mark.

Figure 4: The entire C row disappears; X through B remain visible

Click the screenshot to view the original image.

Open the menu again:

Figure 5: C-axis is now unchecked in the original menu

Click the screenshot to view the original image.

The original C row container is frame_24. Its relevant attributes are:

-C(#912itemmax5==1)
-V0

-C(...) defines condition 0, and -V0 uses it for visibility. When the flag is zero, the whole container holding the axis label, indicator and coordinate fields is hidden. There is no need to repeat the visibility rule on every small widget.

X Y Z A B C
frame_14 frame_15 frame_20 frame_21 frame_23 frame_24

The absence of -D here does not mean the row cannot update. The current widget handling also registers objects with visibility conditions for updates. Dynamic text refresh and conditional visibility have different purposes.

5. Restore the coordinate row

Select C-axis again in the same menu. The flag returns to 1 and the coordinate row reappears:

Figure 6: Selecting C-axis again restores its coordinate row

Click the screenshot to view the original image.

The menu mark and the row's visibility both read the same parameter. To change which axes the machine uses, keep the selection consistent with the machine configuration. Other standard functions also read these flags, as shown next.

6. Other standard functions read these flags

Although the menu is headed Coordinate Axis Display Configuration, the standard scripts also use its flags elsewhere.

Function and original file How it uses the flags Scope to keep in mind
Machining start, env/start Combines axis selection with machine, simulation and homing conditions Selection alone does not always require homing; see machining flow
Handwheel axis selection, env/mpg/mpg_axis_changed Checks whether a newly selected axis is in use Other handwheel states also matter; see manual operation
Connection handling, env/netlink Combines flags with servo output port settings Runs during connection handling; axis menu selection does not replace drive-enable control
Periodic checks, env/timer Combines flags with input settings to decide which servo alarms to check Do not clear axis selection as a substitute for resolving a machine fault
Coordinate storage, env/coordinate/savecoord and loadcoord Filters the axes saved or restored See coordinate storage

7. Keeping the selection after a restart

Clicking the menu changes #912.itemmax[5] in memory. Saving it to a file is a separate step in the application lifecycle.

menuconfig refreshes the menu. Parameter saving belongs to the exit process: closing the independent application normally invokes env/close, which contains:

widgetFunc["SysFunc","","saveParamBak",0]

The built-in handler writes a parameter backup. The independent application uses setting-bak0; client mode uses a backup name associated with its own configuration. Startup first reads the environment configuration, then reads a valid parameter backup. File existence, save times and version checks determine which backup is used.

To retain axis selections, use the application's normal exit facility and reopen it with the same configuration directory and startup mode. Forcibly terminating the process bypasses normal exit handling. If selections are not retained, check the configuration directory and backup files used by exit saving and startup loading.

8. Three techniques to reuse

  1. Store one shared choice. The menu changes it; other pages and scripts read it. The Teach point-capture lesson follows its effect on columns and generated axis words.
  2. Control a whole group. Put a coordinate row in a container and give that container a visibility condition.
  3. Distinguish memory from a saved file. A menu click changes the current value; exit saving and startup loading determine whether it is retained.

If the menu does not appear, check developer access and the right-button-release event. If its mark is wrong, compare menu indices with axis indices. If the row does not follow the mark, check that both use the same flag. If the selection is lost after reopening, check the configuration directory and backup handling.

Previous: Context menus and submenus · Next: Coordinate input · Reading guide