CM600 RTCP 6-Axis Motion controll
CM300 R 3-Axis Motion controller
CM300 3-Axis Motion controller
Download the bilingual offline manual (ZIP, 8.7 MB; original-resolution screenshots included)
The earlier lessons covered file selection, program execution and status display. This group follows another route through the existing Teach page: choose an instruction, enter its parameters, record the resulting code, and create a file for the Program page to display and use.
We will use the existing Delay instruction. Its three parameters make the whole process easy to follow. By the end, you should be able to find a Teach instruction's parameter page, its code generation script, and the script that restores its parameters for editing. This lesson adds no new instruction.
中文版 ·
Select Teach at the top, then Delay on the right. The left side lists recorded program lines. The right side holds the current instruction's parameters, with Generate code line below them. Save, Open, and Load Code at the lower left have different purposes, explained later.
This walkthrough starts with an empty Teach program. When practising in your own software copy, use Save first if the list contains work you need to keep. Then choose New and confirm that you want to clear it.
Enter these values. Press Enter after typing the time to commit the input.
| Position on the page | Selection or input used here |
|---|---|
| Delay Policy | Single line delay |
| Delay Time (sec) | 1.25, displayed as 1.250 after committing |
| Data Source on the same row | Value |
| Sel checkbox beside Program line number | Leave it unchecked; the 1 on that row will therefore not be added to the code |
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
Use the overview to locate controls and the close-ups to read their text and values. In the illustrated HTML edition, click an image to enlarge it, use + / − to adjust its size, and press Esc or Close to return to the text.
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
The indicator at the top right of Figure 1a reads Simulation. This lesson covers parameter editing and code generation; it does not require Move/Position or other machine-motion controls.
Press Generate code line at the lower right:
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
Row 1 on the left now contains:
G04P1250
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
This operation records the instruction type, saves the parameters used to build it, writes the code text, and advances to the next position. Although the blue highlight is now on row 2, the program still contains only one recorded line. The table displays ten positions in advance; empty positions do not mean ten program lines already exist.
The 1.250 still visible on the right is not a permanent connection to row 1. The right side holds the parameters currently being prepared. The left side holds the result saved when the button was pressed. Changing an input alone does not change a recorded line.
Read the existing design in this order:
Enter Teach → select Delay → enter parameters → generate a code line → select that line again and edit it → Load Code → see program.nc on the Program page.
The following paths are relative to the application's run directory. For example, env/teach/pause means that file under the run directory.
| Purpose | Existing file | What to notice |
|---|---|---|
| Teach entry at the top | env/maininterface/maininterface.ui |
Changes the main page and calls the entry script |
| Load the Teach page into the main interface | env/teachpage |
This is the actual entry, not env/teach/teachpage |
| Program list, instruction buttons, Save and Load Code | env/teach/teach.ui |
All belong to the same Teach page |
| Prepare the selected instruction's parameter page | env/teach/codeselect |
Builds the UI filename from the current instruction index |
| Delay parameter table | env/teach/ui/teach_7.ui |
Reads names, values, and choices from parameters |
| Choose the generator after Generate code line | env/teach/addcode |
The Delay branch goes to N7, then calls pause |
| Save the line's inputs and construct its Delay code | env/teach/pause |
Converts the entered seconds into code text |
| Select an existing line again | env/teach/refreshnode1, parsenode |
Restores that line's original inputs on the right |
| Save and open a Teach file | env/teach/savefile, openfile |
Uses .program files |
| Load Code | env/teach/codeGenerate |
Writes an .nc file and returns to the Program page |
Use the actual button binding when following a feature. The button is labelled Load Code, while its script is named codeGenerate. Likewise, pause here generates a Delay instruction; it is not the machining PAUSE button.
The top-level Teach entry has this click action:
-A:(clickedEvent:/env/teachpage[0](#810permission=4))
#810.permission=4 makes the main interface display the Teach area. This entry and its area also depend on #929.item[8]; check that condition if Teach is absent from your standard configuration.
The first seven lines of env/teachpage update #9995.itemdesc[0] through [6] from the current function-key assignments. Its remaining section loads the page on first entry:
IF#837.version==1GOTO1
#837.version=1
#837.itemdesc[0]="/env/teach/teach.ui"
widgetFunc["QFrame","teachFrame","refresh",""]
widgetFunc["setWidgetAttribute","codeParamTable","",#1500.description]
N1
#837.version records whether the outer Teach page has been prepared. Later entries skip this preparation. The penultimate line is an existing table-attribute assignment retained in the script. The table used in this example is the subsequently loaded codeParamTable7; keep those two table names distinct.
The Delay button has this click action:
-A: (clickedEvent:/env/teach/codeselect[0](#1500=6))
It sets #1500 to 6, then runs the complete codeselect script below:
#1500.channel=0
IF#[1800+#1500].version!=0GOTO3
#[1800+#1500].version=1
#[1800+#1500].itemdesc[0]="/env/teach/ui/teach_"+INT[#1500+1]+".ui"
widgetFunc["QFrame","teachFrame"+INT[#1500+1],"refresh",""]
N3
Substituting #1500=6 makes the relationship clear:
| Original expression | Object used for Delay |
|---|---|
#[1800+#1500] |
#1806, which stores the page's preparation state and filename |
"teach_"+INT[#1500+1]+".ui" |
teach_7.ui |
"teachFrame"+INT[#1500+1] |
The existing teachFrame7 area |
The outer page is prepared once, and each instruction's parameter page is prepared separately when needed. Startup preparation in env/main resets the relevant states; selecting an instruction does not redefine all its parameters every time. Here 6 is the instruction index counted from zero, while 7 in the filename is that index plus one.
#1500 selects the instruction. #1500.item[...] stores the parameter number used by each instruction. In this example:
#1500 = 6
#1500.item[6] = 1513
These are observed configuration values, not a definition script for you to run again. Following them leads to the Delay working parameters in #1513 and the companion settings in #1514.
| Parameter | Meaning on the page | Value in Figure 1 |
|---|---|---|
#1513.item[0] |
Delay Policy | 0, Single line delay |
#1513.item[1] |
Delay Time, in seconds | 1.25 |
#1513.itemversion[1] |
Data source for this row | 0, Value |
#1513.item[2] |
Optional program line number | 1 |
#1514.item[2] |
Whether to generate the line number | Unchecked |
The table in teach_7.ui is named codeParamTable7. It accesses the working parameter through #[#1500.item[#1500]]. .itemtitle supplies parameter names, .item supplies values, and the associated fields determine whether a row uses an input box, a list, or a checkbox. This lets similar table definitions serve different instructions.
The fourth column's Value / Recipe Parameter Index choices come from language text in #1104.itemtitle[25] and [26]. The selected source is stored in the working parameter row's .itemversion. After it changes, refresh7 prepares the table again:
widgetFunc["QTableWidget","codeParamTable7","refresh",""]
Selecting the source and entering its value therefore work together. In Figure 1, 1.25 is a directly entered duration in seconds. With Recipe Parameter Index, the same position selects a recipe parameter instead; it no longer means a duration entered directly.
One detail matters when customising the table: the original configuration tests the literal field-description marker 可配置源 to decide whether to offer a data-source choice. This marker participates in a condition; do not rename it as ordinary display text. Operator-facing names are obtained separately from parameter titles and the language pack.
The original event on Generate code line is:
-A: (MouseButtonRelease:/env/teach/addcode[1])
At the start, addcode makes sure the current position has a record to write, then obtains the two parameter numbers for the selected instruction:
IF#1551==-1THEN#1551.itemnum=1
IF#1551==-1THEN#1551=0
IF#1551>=#1551.itemnumTHEN#1551.itemnum=#1551+1
#11=#1500.item[#1500]
#12=#1500.item[#1500]+1
Here that gives #11=1513 and #12=1514. The later expression ^11.item[1] means: take the parameter number stored in #11, then access item 1 of that parameter. In this example it accesses #1513.item[1].
When #1500==6, addcode jumps to N7 and calls /env/teach/pause. This is the complete generator:
#1551.itemversion[#1551]=7
#1551.itemtitle[#1551]="A"+^11.item[0]
#1551.itemtitle[#1551]=#1551.itemtitle[#1551]+"B"+^11.itemversion[1]
#1551.itemtitle[#1551]=#1551.itemtitle[#1551]+"C"+^11.item[1]
#1551.itemtitle[#1551]=#1551.itemtitle[#1551]+"D"+^12.item[2]
#1551.itemtitle[#1551]=#1551.itemtitle[#1551]+"E"+^11.item[2]
#1558.item[0]=""
#1558.item[2]=""
IF^12.item[2]==1THEN#1558.item[0]="N"+^11.item[2]
IF^11.item[0]==1GOTO1
IF^11.itemversion[1]==1THEN#1558.item[2]="P"+"INT[#1550.item["+INT[^11.item[1]]+"]*1000]"
IF^11.itemversion[1]==0THEN#1558.item[2]="P"+INT[^11.item[1]*1000]
N1
IF^11.item[0]==0THEN#1558.item[1]="G04"
IF^11.item[0]==1THEN#1558.item[1]="#1513=#9990.channel"
IF^11.item[0]==2THEN#1558.item[1]="G104"
#1551.item[#1551]=#1558.item[0]+#1558.item[1]+#1558.item[2]
#1551.itemdesc[#1551]=#1551.item[#1551]
#1551=#1551+1
#1551.channel=FIX[#1551/10]
widgetFunc["SysFunc","0","parser","/env/teach/parsenode"]
Follow the branch selected in this walkthrough first:
#1558.item[0] remains empty text."P"+INT[1.25*1000] produces P1250.0 selects G04.G04P1250 and written to the code field and display field.In these statements, + joins text. INT[...] puts the result into the text in integer form. Multiplying seconds by 1000 is the rule in this actual script, not an assumption borrowed from another CNC system.
Two other policies remain in the script: 1 generates timestamp-assignment text, while 2 generates G104. With Recipe Parameter Index, the script stores expression text containing #1550.item[...] instead of substituting the recipe's current value immediately. Their execution rules require further checks against the machining interpreter. The UI walkthrough here verifies only Single line delay + Value.
If the Teach list stored only G04P1250, later editing would have to reconstruct inputs from that code. The existing design saves editing information alongside the code:
Location in #1551 |
Use in this configuration | Record 0 after the first generation |
|---|---|---|
Main value of #1551 |
Current record position, counted from 0 |
Already advanced to 1 |
.itemnum |
Number of recorded entries | 1 |
.itemversion[0] |
Instruction type | 7, Delay |
.itemtitle[0] |
Parameter text used for editing | A0B0C1.250DfalseE1 |
.item[0] |
Actual code text | G04P1250 |
.itemdesc[0] |
Text shown in the program list | G04P1250 |
A marks the policy, B the data source, C the duration or recipe index, D whether to add a line number, and E the line number. The unchecked value is actually written as false in this capture; do not assume every saved value is an integer 0. Here .itemtitle holds editing information, not an operator-facing row title.
Starting from Figure 2, temporarily change the time on the right to 9 and commit it, without pressing Generate code line. Then click the program body in row 1 on the left. The time returns to 1.250, restored from the information already saved with that row.
The original table passes the record position to refreshnode1:
-A: (clickedEvent:/env/teach/refreshnode1[0](#1551=%%+#1551channel*10))
%% is the visible row index, counted from 0. Adding the page number multiplied by 10 gives the position in the complete list. The first row on the first page is record 0. When a record needs to be restored, refreshnode1 calls parsenode. Its Delay branch is:
N7
#11=#1500.item[6]
#12=#1500.item[6]+1
^11.item[0]=#1551.itemtitle[#1551]/"A"*"B"
^11.itemversion[1]=#1551.itemtitle[#1551]/"B"*"C"
^11.item[1]=#1551.itemtitle[#1551]/"C"*"D"
^12.item[2]=#1551.itemtitle[#1551]/"D"*"E"
^11.item[2]=#1551.itemtitle[#1551]/"E"
#1500=6
widgetFunc["SysFunc","3","parser","/env/teach/codeselect"]
GOTO100
For example, applying /"C"*"D" to the saved text extracts the part between C and D: 1.250 here. With text operands, / and * perform this system's text extraction operations; read them according to their operands rather than as ordinary numeric division and multiplication.
Now change the restored time to 2.5 and commit it. The right side displays 2.500, but the left still holds G04P1250:
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
At the same moment, the selected program row still contains its previous code:
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
Press Generate code line again. Row 1 becomes G04P2500. There is still only one recorded entry, and the highlight advances to row 2:
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
Generate code line writes at the current position. It replaces an existing selected record, or adds a record at an empty position at the end. To make room in the middle, use Insert, then enter the parameters and generate the line.
Distinguish these three controls at the lower left:
| Button | What it saves or reads | When to use it |
|---|---|---|
| Save | Saves #1551, including its records and associated information, to .program |
Keep a Teach program that can be edited later |
| Open | Reads .program into #1551, then attempts to restore the current instruction's inputs |
Continue editing previously saved work |
| Load Code | Writes each recorded code entry to env/teach/doc/program.nc, then loads it on the Program page |
View or hand over the generated NC result |
Save first opens a *.program filename dialog. After obtaining the path, its script executes:
widgetFunc["SysFunc",#1551.description,"saveParamItemAs1",1551]
After Open obtains its path, it executes:
widgetFunc["SysFunc",#1551.description,"readParamItemFrom1",1551]
The .program file preserves instruction types and editing parameters as well as code. It is not a plain-text NC file. The separate Recipe page uses #1550; its load and save operations use a separate .formula file. Saving a Teach program does not bundle that recipe into it.
With the single G04P2500 entry recorded, press Load Code at the lower left. It runs codeGenerate:
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
Its first line is:
widgetFunc["systemParamToFile",1551,0,"/env/teach/doc/program.nc"]
1551 is the parameter to export. 0 selects each record's .item text; empty text records are skipped. The destination is env/teach/doc/program.nc under the run directory, using the same path on each write. This step does not rerun the individual instruction generators. Regenerate any edited line before loading the code.
The script then connects the file to the machining file list and program text display:
#334.itemnum=0
#334.item[1]=#405+"teach/doc/program.nc"
#9047=#334.item[1]
#9048.channel=0
#9048.permission=widgetFunc["getFileLineNum","","",#9047]
#403=#9047
#333.item[1]=0
#333.item[13]=1
In the standard environment, #405 points to env/ under the run directory, including the trailing /. The loaded path must match the written file. If you change the environment or output location, check both the export and load paths.
After recording the load information, the script executes:
#810.permission=0
#810=0
This returns to Toolpath Preview under Program. As explained in File Management, #334 holds the machining file list, #403 identifies the current machining file, #9047 supplies the program text display, and #9048 holds its position and line count. The original script also requests clearing of the old drawing. Loading text and interpreting a new toolpath remain separate operations.
Click the screenshot to enlarge it. Full-resolution screenshots are included in the offline package.
The generated file here contains only G04P2500 and its line ending. The empty second line in the text display comes from the final newline. The exporter adds no program header, end command, or other machining operations. This single-line result explains the configuration process; it is not a complete machining program. Verification stopped at file creation and text display, without starting NC execution.
Once you understand how one record is written and restored, the remaining buttons are easier to follow:
| Existing operation | What it does | Point to retain when customising |
|---|---|---|
| Previous Item / Next item | Changes the current position in #1551 and restores that record's inputs |
The position also determines where the next generated line is written |
| Previous Page / Next Page | Changes page and position in groups of ten | Changing the visible row count alone does not change the scripts' 10 |
| Insert | Inserts a record at a valid current position | At an empty end position the script exits; generating there already appends a record |
| Delete | Removes the current record after confirmation, then restores inputs at that position | It does more than clear visible text |
| Copy | Stores the current record index in #1551.version |
It does not make an independent copy of the row yet; inserting or deleting rows can change what that index refers to |
| Paste | Copies code, saved inputs, display text, and type from that recorded index | Writes at the current position, expanding the count if necessary; it does not always insert a row |
| New | Clears record count, current position, and page after confirmation | Do not infer that it also clears recipes or disk files |
Clicking the same row again may take refreshnode1 into its #9519 menu branch. That branch depends on conditions including the previous position and matching type; not every click restores inputs. Menu contents also depend on the corresponding parameter configuration. This example selects row 1 after the position has advanced, so it follows the normal restore branch.
Capturing a position, recording a point, Move/Position, and running an instruction also need to be distinguished by their actual actions. Some entries read coordinates, some record code, and some enter NC execution. For motion instructions, follow the relevant events into scripts such as localpos, custom/recordLinePoint, custom/local, and custom/run. None of those actions was used in this lesson.
The existing example gives a clear working sequence: let an operator enter parameters, store them in an editable record, and then output the code. When adjusting a related feature, use this table to find the appropriate configuration files before turning to C++.
| Change wanted | Start here | Also check |
|---|---|---|
| Instruction names and parameter labels | #1500.itemtitle[...], working parameter titles, language packs |
Actual Chinese and English wording; fixed condition markers must not be translated as titles |
| Parameter-page contents | The corresponding teach_*.ui and working parameter definition |
#1500.item[...] still selects the right parameter group, with the correct companion settings |
| Generated code format | The addcode branch and actual generator |
Changing display text alone does not change export; export reads .item |
| How an input is saved and restored | .itemtitle assignments in the generator and the matching parsenode branch |
Letter delimiters and field order must match; compatibility with older .program files needs separate verification |
| A new Teach instruction | Instruction entry, parameter mapping, UI, generation branch, restore branch | Adding a button alone is insufficient; verify each instruction/type mapping instead of assuming every type is its index plus one |
| Output file location | Export and load statements in codeGenerate |
#405, #334, #403, and #9047 must lead to the same result |
Use these checks for common problems:
| Symptom | First check |
|---|---|
| The input time changed, but the recorded line did not | Was the input committed and Generate code line pressed afterwards? |
| An existing line changed when you meant to append | Was #1551 still selecting an existing record? |
| A new line appeared when you meant to edit | Did you select the original line first? Generation advances the current position |
| Code looks correct, but selecting it restores wrong inputs | Does the .itemtitle field order match parsenode? |
| Changing the data source does not change the editor | Did the event reach refresh7, and is the field-description marker intact? |
A line number was entered, but no N was generated |
Is its Sel checkbox checked? |
| Load Code still produces the old time | Was only the input changed, leaving the recorded code unchanged? |
The recipe differs after moving a .program file to another PC |
Was the required .formula file saved and loaded separately? |
| Editing a UI file has no effect after switching away and back | Has that page already been prepared? The entry script reuses loaded pages |
The next lesson examines Teach tables: paging, recipe editing, row filtering, input choices, refresh and position buttons inside cells. Continue with Line and Spatial Arc point capture, recipe references, and saving Teach files.
Previous: Progress, prompts and alarms · Next: Teach tables · Reading guide