The previous lesson explained how Teach tables create inputs, lists and buttons. This lesson follows the existing Line and Spatial Arc pages: reading coordinates, arranging three points in one table, generating a record and restoring its editable settings.
We use the standard pages throughout. Start with the visible result, then follow the UI properties and scripts in env/teach. This lesson adds no Teach category.
中文版 ·
Open Teach at the top. At the bottom of the category area on the right, select Line or Spatial Arc. Line and Linear Motion are separate entries, with different parameter pages and scripts. The previous lesson used Linear Motion.
Click the screenshot to view the original image.
This overview locates the controls. The remaining screenshots are native close-ups rendered at double pixel density. Click images in the HTML edition to enlarge them.
| UI entry | Category #1500 |
Working parameters | Parameter page | Generation script |
|---|---|---|---|---|
| Line | 15 | #1531 |
env/teach/ui/teach_16.ui |
env/teach/custom/line |
| Spatial Arc | 16 | #1533 |
env/teach/ui/teach_17.ui |
env/teach/custom/spacearc |
“Working parameters” means the values currently being edited on the right. The standard category table stores #1500.item[15]=1531 and #1500.item[16]=1533. On selection, codeselect loads the original page through teachFrame16 or teachFrame17. See the first Teach lesson for page loading.
The screenshots show the standard interface. Coordinates, filenames, and parameter values are examples; use the values appropriate to your configuration.
Select Line. The example follows these steps:
600, and press Enter.10, Y=20, Z=30, and A/B/C=0, click END in the first table column.Click the screenshot to view the original image.
Click the screenshot to view the original image.
END only reads the current position. It adds no record to the left table. Generate code line creates the record below and selects the next empty position.
Click the screenshot to view the original image.
The complete generated text is:
G01X10.000Y20.000Z30.000A0.000B0.000C0.000F600
To study input and generation in an offline copy, you can enter these values directly in the existing coordinate cells and press Enter. That checks editing and generation. The next section explains where the END button obtains its values.
Open teach_16.ui, find codeParamTable, and inspect accessibleDescription. The complete first-column definition is:
-column:
-T10(#1531itemdesc0)
-D
-A: (clickedEvent:/env/teach/custom/recordLinePoint[0])
-T10 creates a button occupying the whole cell. Its caption comes from #1531.itemdesc[0], displayed as END in this page's English configuration. This differs from the small position button inside a numeric input in the previous lesson. clickedEvent runs the original custom/recordLinePoint script.
Here is that script in full:
IF#1531.item[7]==0GOTO1
GOTO2
N1
#1531.item[0]=#300.item[36]
#1531.item[1]=#300.item[37]
#1531.item[2]=#300.item[38]
#1531.item[3]=#300.item[39]
#1531.item[4]=#300.item[40]
#1531.item[5]=#300.item[41]
GOTO3
N2
#1531.item[0]=#300.item[42]
#1531.item[1]=#300.item[43]
#1531.item[2]=#300.item[44]
#1531.item[3]=#300.item[45]
#1531.item[4]=#300.item[46]
#1531.item[5]=#300.item[47]
N3
Read it in macro-program order: check the mode, choose a branch, then copy six coordinates into six working items. It neither writes a Teach record in #1551 nor issues a positioning or machining command.
The coordinate cells bind to these working items and include -D, so they update after the assignments. For example, the X cell uses -T(#1531item%0). This row has base index 0, so it displays and edits #1531.item[0]. The three-row arc table will make %0 clearer later.
| Setting | Line page | Spatial Arc page | Meaning in this example |
|---|---|---|---|
| Pick Point Mode | #1531.item[7] |
#1533.item[19] |
0: Workpiece coordinates; 1: RTCP coordinates |
| Feed value | #1531.item[6] |
#1533.item[18] |
600 and 500, respectively |
| Include feed | #1531.itemversion[6] |
#1533.itemversion[18] |
Selected means 1; generation uses this flag to include F |
The three original Line bindings are:
-T(#1531item7)
-T(#1531item6)
-T(#1531itemversion6<<#1531itemtitle6)
The last binding belongs to the original QCheckBox: its selected state writes .itemversion[6], and its caption comes from .itemtitle[6]. The value 600 is stored separately in .item[6]. Different fields of the same item serve different purposes. The original English captions use Feed Rate on Line and Feed rate on Spatial Arc.
The coordinate sources are:
| Mode | Source range | Six example coordinate values |
|---|---|---|
| Workpiece coordinates | #300.item[36]–[41] |
10,20,30,0,0,0 |
| RTCP coordinates | #300.item[42]–[47] |
110,120,130,1,2,3 |
After changing the mode, clicking the same END button read the second group. Selecting the saved Line record subsequently restored 10,20,30,0,0,0, feed 600, and mode 0.
The original English UI displays the hint “Tip:After switching Pick Point mode,re-teach point teach.” Its practical meaning is to capture the points again after changing mode. The list changes where the next capture reads from; it does not convert points already captured. These scripts also do not turn RTCP on or off.
Both sources are coordinate display data maintained by the host application. Actual use depends on the coordinate and RTCP setup. This lesson verifies the source selection, not real five-axis positioning.
The bottom button enters env/teach/addcode. It first locates the selected category's parameter group:
#11=#1500.item[#1500]
#12=#1500.item[#1500]+1
For Line, #11=1531. Therefore ^11.item[0] in custom/line accesses item 0 of that group; it does not mean item 0 of ordinary parameter #11.
custom/line assigns record type 16, saves the coordinates and feed/mode settings, and assembles code according to the axis conditions. The original X and F decisions are:
IF#912.itemmax[0]==1THEN#1567.item[0]=#1567.itemtitle[0]+^11.item[0]
IF^11.itemversion[6]==1THEN#1567.item[6]=#1567.itemtitle[6]+INT[^11.item[6]]
The corresponding prefixes in the current standard configuration are X and F. All six axis conditions are 1 and feed is selected, producing Figure 4. When feed is not selected, the script omits F from this record; omission does not set feed to zero. That branch is explained from source; the captured example uses selected feed.
Field of the current #1551 record |
Contents for Line |
|---|---|
.itemversion[index] |
Type 16, used when restoring the record |
.item[index] |
Complete G01...F600 code text |
.itemdesc[index] |
Text shown in the Program table; identical to the code for Line |
.itemtitle[index] |
Editing information separated by @, used to restore the parameter page |
Line saves nine parts in this order: X, Y, Z, A, B, C, include-feed flag, feed value, point mode. The actual saved string is:
10.0000@20.000@30.000@0.000@0.000@0.000@1@600@0
The first value has a different number of decimal places in the original script's result. Do not alter the record merely to make its formatting uniform. Follow the order of the nine parts. See the complete original Line generator.
Continue at the next empty program position. Select Spatial Arc, set Pick Point Mode to Workpiece coordinates, select Feed rate, and enter 500. The example supplies three sets of offline coordinates, clicking Start, Mid, and End, respectively:
Click the screenshot to view the original image.
| Button | Script under env/teach/custom/ |
Destination in #1533.item[...] |
Values read in this example |
|---|---|---|---|
| Start | recordArcSPoint |
[0]–[5] |
10,20,30,0,0,0 |
| Mid | recordArcCPoint |
[6]–[11] |
20,30,30,1,2,3 |
| End | recordArcEPoint |
[12]–[17] |
30,20,30,0,0,0 |
All three scripts check #1533.item[19] before choosing #300.item[36]–[41] or [42]–[47]. Their main difference is the destination group. Clicking a button rereads its whole six-value group, rather than one selected axis.
Mid has no A/B/C input boxes, yet the script stores the example values 1,2,3 in [9]–[11]. Record generation saves these values too. The arc code assembly subsequently uses only Mid X/Y/Z. Not displayed, not saved and not output are different conditions.
These three page buttons do not advance #1500.channel or generate a record automatically. After all three captures, the left table still contains only the earlier Line record. Click Generate code line to record the arc. Check the values in each row; button color is not proof that all points have been captured.
teach_17.ui still has only one codeParamTable. Its attributes contain a header section followed by three row sections, each creating one row.
| Row section | -rows |
-serial |
-interval |
Actual target of #1533item%0 |
|---|---|---|---|---|
| Start | 1 | 0 | 6 | #1533.item[0] |
| Mid | 1 | 6 | 6 | #1533.item[6] |
| End | 1 | 12 | 6 | #1533.item[12] |
The complete original Mid section contains its button, three coordinate inputs and three blank cells:
{
-filter:
-rows:1
-serial:6
-interval:6
-column:
-T10(#1533itemtitle%0)
-C1(#1500channel==1)
-C0(1)
-A: (clickedEvent:/env/teach/custom/recordArcCPoint[0])
-column:
-T(#1533item%0)
-D
-C(#319.item3==1)
-R0
-column:
-T(#1533item%1)
-D
-C(#319.item3==1)
-R0
-column:
-T(#1533item%2)
-D
-C(#319.item3==1)
-R0
-column:
-T("")
-column:
-T("")
-column:
-T("")
}
Read it in order. -rows:1 creates one row. -serial:6 gives this row base index 6. %0, %1 and %2 mean base plus 0, 1 and 2, accessing [6], [7] and [8]. The button caption #1533itemtitle%0 uses the same base and displays item [6]'s title, Mid. The final three -T("") entries create blank text cells under A/B/C.
%0 does not always mean item 0, and it differs from %%. For repetition j, counted from zero within a row section:
| Notation | Substitution |
|---|---|
%% |
Section serial+j |
%0 |
Section serial+j×interval+0 |
%1 |
Section serial+j×interval+1 |
Each section here has one row, so j=0. The three starting indices come from -serial:0/6/12; -interval:6 alone does not create three groups. See the complete original Spatial Arc table.
The inputs also use -C(#319.item3==1) with -R0, explained in the previous lesson. Source sets these inputs read-only when that start flag is 1. This does not uniformly disable the first-column buttons. No machining-state transition was exercised here.
The earlier axis-configuration lesson explained how the main-screen menu changes #912.itemmax[0..5]. Here, follow how Spatial Arc uses those same flags. Use a practice copy to compare the following settings; the machine's axis configuration must match its actual axes.
With all axes selected, the original Spatial Arc table includes C:
Click the screenshot to view the original image.
Clear C-axis in the main-screen axis menu, then return to the same table:
Click the screenshot to view the original image.
The C header in codeParamTable, in env/teach/ui/teach_17.ui, contains:
-header:(#1015_description),,,#912itemmax5
The title reads the C-axis name. Width and resize mode are omitted; the final condition reads the C flag. X through C use #912.itemmax[0] through [5]. The header section's -attr:-D includes the table in dynamic updates. Unlike the previous lesson's -filter: for rows, this rule hides a whole column.
The menu changes one shared setting; the table reads it without another axis-selection parameter. Hiding C does not renumber the table's parameter items or delete the point values in #1533. The intermediate A/B/C cells still follow the three-row arrangement explained above.
env/teach/custom/spacearc checks the same flag when building axis words. For start and end C it contains:
IF#912.itemmax[5]==1THEN#1568.item[5]=#1568.itemtitle[5]+^11.item[5]
IF#912.itemmax[5]==1THEN#1568.item[14]=#1568.itemtitle[14]+^11.item[17]
The script first clears the text pieces, then adds words for selected axes. Use the points in Figure 6 and a feed rate of 1000. Generate one record with all axes selected, clear C, then generate the next record from the same points to see the difference.
With all axes selected, the first record contains:
G01X10.000Y20.000Z30.000A0.000B0.000C10.000F1000
G2.9X30.000Y20.000Z30.000A0.000B0.000C40.000I20.000J30.000K30.000
The new record generated after clearing C contains:
G01X10.000Y20.000Z30.000A0.000B0.000F1000
G2.9X30.000Y20.000Z30.000A0.000B0.000I20.000J30.000K30.000
Only the new record omits C. The first record already stored in #1551 still contains its C words. The original generation script advances the record position itself, so you can generate the second record at that new position without another next-row action.
Selecting C again restores its row and column, but does not add C words to the second stored record. To update a record, select it, review its parameters, and use the original Generate code line action. Hiding an axis column does not remove that axis's motion from previously generated programs.
After comparing the results, select C-axis again in the same menu. Its coordinate row and Teach column reappear. The generated text above illustrates the axis-word selection; it does not provide complete machine setup or programming modes.
Using the three points in Figure 5 with all six axis conditions set to 1, click Generate code line. The left table contains two Teach records:
Click the screenshot to view the original image.
Record 2 shows G2.9..., but that is only .itemdesc[1]. Its .item[1] contains both lines below:
G01X10.000Y20.000Z30.000A0.000B0.000C0.000F500
G2.9X30.000Y20.000Z30.000A0.000B0.000C0.000I20.000J30.000K30.000
In the original custom/spacearc script and current prefix configuration, the first line assembles G01 from the Start coordinates and feed. The second line uses End for X/Y/Z/A/B/C, and Mid X/Y/Z for I/J/K. The example directly writes Mid 20,30,30 as I20.000J30.000K30.000; this script does not calculate a center or subtract Start.
This is the actual G2.9 output of this system's Teach category. Do not substitute assumptions about I/J/K in another controller's ordinary G02/G03. Generated text was checked; arc motion was not executed.
The arc record has type 17. Its .itemtitle editing information contains 21 parts:
| Saved position, counted from 0 | Contents | Restore destination |
|---|---|---|
| 0–5 | Start, six values | #1533.item[0]–[5] |
| 6–11 | Mid, six values | #1533.item[6]–[11] |
| 12–17 | End, six values | #1533.item[12]–[17] |
| 18 | Include-feed flag | #1533.itemversion[18] |
| 19 | Feed value | #1533.item[18] |
| 20 | Point mode | #1533.item[19] |
The final saved positions differ from their working-item indices because feed contributes both a value and a selected state. Generation and restoration must agree on this order when extending the design. See the complete original Spatial Arc generator.
After generating the arc, the program position advances to empty position 3. Change End X to 99 and press Enter, but do not click Generate code line:
Click the screenshot to view the original image.
Now select the first Line record on the left, then the second Spatial Arc record. The page restores this result:
Click the screenshot to view the original image.
The input did succeed: Enter wrote 99 into #1533.item[12]. The saved arc's editing information still contained 30. Selecting the record follows refreshnode1 → parsenode; .itemversion=17 selects N17, which restores the 21 parts and selects Spatial Arc. Feed 500, selected feed and mode 0 are restored too.
The original code starts reading the first two parts as follows:
#11=#1500.item[16]
#12=#1500.item[16]+1
#10.unit=#1551.itemtitle[#1551]
^11.item[0]=#10.unit*"@"
#10.unit=#10.unit-"@"
^11.item[1]=#10.unit*"@"
#10.unit=#10.unit-"@"
Here *"@" takes the text before the first delimiter. -"@" removes that part and its delimiter so the next read advances. These are this system's string operations, not numeric multiplication or subtraction.
To modify an existing arc, select it first, edit and commit its parameters, then use Generate code line to write the current record. Editing at a new empty position does not select the previous record for replacement. Repeated clicks on the already selected record can also enter the original menu branch. This check selects another record first, then the target, to observe restoration clearly.
Click the original Load Code button. The first statement of codeGenerate is:
widgetFunc["systemParamToFile",1551,0,"/env/teach/doc/program.nc"]
It outputs the code text held in #1551, sets the file-display parameters and switches to Program. It does not reread the three points or rerun each record's generation script.
Click the screenshot to view the original image.
Compare Figure 8: Line contributes one line and Spatial Arc contributes two, giving three nonempty lines in the editor. End X remains 30.000; the unrecorded edit to 99 was not exported.
Use Teach Save to retain .program editing information for later changes. The loaded .nc is code output and cannot restore all 21 parts of this example by itself. See the first Teach lesson for the two file types.
For a similar point-based category, follow the same sequence:
%0, and use -T10 for button cells.@ field order in both directions.| Common misunderstanding | Actual behavior here |
|---|---|
| Capturing a point adds a record | The three direct capture scripts only update working values; Generate code line records them |
%0 always means item 0 |
It adds the row base, giving 0, 6 or 12 here |
| Changing point mode converts old coordinates | It changes the reading source; capture the points again |
| Blank Mid A/B/C cells mean nothing was saved | Those values are read and saved, but not used in this category's generated code |
| One table record equals one NC line | An arc record contains two code lines |
| Hiding an axis changes previous code | Visibility leaves old code intact; new generation also checks script conditions |
| Enter followed by Load Code exports the edited value | Enter changes working values; generate the record before exporting it |
The three capture buttons read positions into working parameters; generating a record is a separate operation. env/teach/custom/recordkey handles staged capture and generation through a different script, so it does not replace the call relationships shown here. custom/local and custom/run involve NC positioning or execution and require the corresponding operating conditions.
These generators do not automatically supply complete programming-mode setup, RTCP setup or geometry checks before the example code. Prepare the program for the machine and process before using the generated result for machining. Next, return to Delay to compare fixed values with recipe references, then learn how to save programs and recipes.
Previous: Teach tables · Next: Recipe references · Reading guide