The Program Editor
The Program Editor is a context sensitive G-Code editing window that allows searching, find and replace, line numbering, formatting, axis modification and syntax verification.
Editing G-Code
To display the program Editor, select the program and click Edit or right click on the program and select Edit Program in the context menu. By default, the program Editor will be in Read Only mode to prevent accidental edits. To make edits to the G-Code, click Edit. When Editing mode is enabled, the Edit pin will show as pressed and a special striped border will be drawn around the G-Code:
When Edit is clicked a second time it will set the editor back into Read Only mode. At this point, the software will verify the program syntax and report any errors that are found. If syntax errors are found the changes can still be committed or the editor will go back to editing mode.
The Edit ribbon
The Edit ribbon tab contains basic text editing commands:
The basic editing commands are:
|
Enable Editing Mode – Switches between Editing and Read Only mode (See description above) Use Ctrl + E as the keyboard shortcut. |
|
Cut – Cut the selected text from the editor. (Must be in Editing mode) Use Shift + Delete as the keyboard shortcut. |
|
Copy – Copy the selected text from the editor. Use Ctrl + C as the keyboard shortcut. |
|
Paste – Paste any text from the Windows clipboard into the editor. (Must be in Editing mode) Use Ctrl + V as the keyboard shortcut. |
|
Delete – Delete the selected text from the editor. (Must be in Editing mode) Use Delete as the keyboard shortcut. |
|
**Undo/Redo** – Undo and Redo any edits that were made. (Must be in **Editing** mode)
Use Ctrl + Z to undo and Ctrl + Y to redo as keyboard shortcuts. |
Find and Replace
Drop list - The dropdown edit box is used to enter the text to be searched for and will remember the last 10 searches.
Find Next/Find Prev – Find the next or previous instance of the text as entered in the drop box. If the text is found, it will be highlighted in the editor. If the text was not found in the set direction, an error message will be displayed.
Replace – Perform a find-and-replace operation. This option is only available when the editor is in Editing mode. Clicking Replace will show the Find and Replace dialog:
Enter the search term and new text. Click Find Next to search through the editor (from start to finish) for the search term. Click Replace to replace the matched term with the new text. Click Replace All to automatically replace all instances within the program. Once the replace is finished it will display a dialog telling the user how many changes occurred.
Options – Displays the Find and Replace Options dialog:
Find By Text Compare – Matches specific text. For example, with this option enabled, if the search term is M1, then M1, M10, M100, M123 etc. will all match the M1 search term.
Find By G-Code Match – Matches specific codes only. For example, with this option enabled, if the search term is M1, then ONLY M1 will be matched and M10, M100, M123 etc. will not be matched.
Ignores extra zeros – When combined with Find By G-Code Match, 0’s in the beginning of M-Codes will be ignore during matching. Therefore, searching for M1 will match to M1 and M01.
Ignore Case – Makes the search matching case insensitive. For example, with this option enabled, searching for m1, will match to M1 and m1.
Find All
The Find All dialog will search the entire program or ALL programs for specific text. The results are listed in a grid for easily searching through a program or programs.
-
Click Find All on the ribbon. This will show the Find All dialog:
-
Enter the search term in the drop list.
-
Click Find All in the dialog to initiate the searching.
-
The results are displayed in the Instances grid:
-
The results show the program name, the line number and the actual G-Code of the line.
-
Selecting a line in the grid will take you to that location in the program editor.
-
Check the Search in all programs option to search in all programs that are in your editor.
Characters
The Characters options are:
|
Caps Lock – This option enables a software CAPS Lock whereby all letters typed into the editor will be capital letters, regardless of whether the CAPS lock is set on the keyboard or if the SHIFT key is pressed. This option stays on until it is un-checked. You can also right-click in any G-Code editor to control this option. |
|
To Uppercase – This option will convert any letters in the selected text to upper case. It is only available when the editor is in Editing mode. |
Codes ribbon tab
The Codes ribbon contains advanced G-Code editing functions:
Code commands
|
Code Map Editing – These commands let you control how custom G and M codes are handled in the editor and the simulation. |
-
Click Code Map to see a list of any user G or M codes. You can add and remove codes manually from this list:
-
To Remove any UNKNOWN codes directly from the G-Code, highlight the G-Code and click Remove Codes. Any unknown codes will be converted to comments.
-
To add the codes, click Add Codes.
-
Any unknown codes in the editor will be listed in a grid:
-
You can edit the description of the code and enter a time for the code to execute (which will be used in the simulation)
-
Click Add and the code will appear as a known code.
-
WARNING: The code is only simulated by pausing the simulation for the given time. No other aspect of the code will be simulated. It should only be used for special codes that do not affect the simulation, such as coolant modes, robot handler codes etc.
-
Click All Codes to show a list of all known G and M codes that are supported directly by the editor and the simulation:
9. You can filter the codes using the Filter edit box.
-
Select a code and click Insert. The code will be automatically inserted into the G-Code at the current cursor location.
-
Click Include Comment to include the description of the code in the inserted text.
Analysis commands
|
Analysis Commands – These commands check and analyze the selected G-Code |
The program Editor will verify the basic syntax of the G-Code. This will check for unknown M and G-Codes that the simulation doesn’t understand. It cannot find more advanced errors that will only show up in simulation such as missing program names, mismatched sync codes, mismatched spindle control codes etc.
-
Click Verify Syntax.
-
The Verify Syntax dialog will be displayed.
-
Click Verify in the dialog to initiate the verification process.
-
When completed, the errors will be displayed in the grid.
-
Selecting a line in the grid will bring you to that line in the editor.
You can also calculate the axis ranges of the selected text.
-
Highlight the text block to be checked.
-
Click Calculate Range to display the Axis Ranges dialog:
Note: Only axes that appear in the highlighted text will appear in the list. -
Click OK to close this dialog.
Comment commands
|
Comments – These commands will convert text back and forth between comments and regular code. |
This option will convert the selected text to and from comments. It is only available when the editor is in Editing mode.
-
Highlight the required text on the line(s) that will be converted.
-
Click Convert to Convert To Comment (or use Ctrl + R as a keyboard shortcut) or Remove from Comment (Ctrl + U).
-
The text will be converted by the following rules:
If no text is selected entire line that the curser is on will be commented out. However, if the entire line has already been commented out (and the line is entirely a comment), the line will be uncommented.
If multiple lines of text are selected, the number of commented and uncommented lines will be counted. If there are more commented lines than uncommented lines, all of the lines will be uncommented. If there are more uncommented lines selected, all of the lines will be commented.
If a sub-section of text on one line has been selected, only that selection will be commented or uncommented.
Lines command
|
Line – Modifies the line numbers of the program. |
The line numbering modifications are only available when the editor is in Editing mode.
-
Select the text lines that will be modified.
-
Click Line Numbers to display the Line Number Options Dialog:
-
Select the line numbering option:
Remove line numbers - Strip all the line numbering from the highlighted text in the editor.
Add line numbers - Add line numbers to the highlighted text in the editor starting with the number indicated in Start Number and incrementing by the number in Increment Number.
Renumber lines – Renumbers ONLY lines that have line numbers already. The numbering will start with the Start Number and increment by the Increment Number.
Add Only to Specific Codes – Add line numbers to specific lines within the highlighted text in the editor. Specific options are:
Number T Lines – Apply to tool call lines (lines with a T-Code).
Set the number to tool number – Set the line number to the value of the T-Code. If this option is not selected then the tool line will get numbers by the Start Number and Increment Number values.
Number M1 M0 lines – Will number all M1 M0 lines within the highlighted text using the Start Number and Increment Number values.
-
Click OK to apply the new numbering options to the highlighted text.
Modification commands
|
Modification – Modify the selected text in the editor. |
The Translate option will translate the axis values of the highlighted text by the given amount. It is only available when the editor is in Editing mode.
-
Highlight the text block to be translated.
-
Click Translate to display the Translate Axis dialog:
-
Enter the translation for each axis and click OK.
-
The selected axis values will be translated.
This Mirror option will mirror any given axis (it will switch the sign). It is only available when the editor is in Editing mode.
-
Highlight the text to mirror in the editor.
-
Click Mirror to show the Mirror Axis dialog:
-
Select the X, Y and/or Z axis for mirroring.
-
Click Reverse Arc Directions to reverse G2 and G3 arcs.
-
Click OK and the selected axes will be mirrored in the highlighted text.
This Modify option allows advanced edits to the specific G-Code values which can be done in parallel. It is only available when the editor is in Editing mode and when a section of text has been highlighted in the editor. The following modifications can be made:
Scale – Scale the G-Code value by the given multiplier.
Transpose – Transpose one value to another. For example, switch the A axis to C.
Rounding – Round the values to a given number of decimal places.
Trim Zeros – Trim any trailing zeros after the decimal point.
Replace – Replace one set of text with another.
Delete - Delete the given text.
The modifications can even be saved and recalled for later use. This can be useful for things like converting from mill style programs to lathe style programs.
-
Highlight the text to be modified.
-
Click Modify to display the Modify Values dialog:
Each row represents a specific modification that will be performed. The modifications will be performed in order from top to bottom. The columns control each modification:
Value – Selects the value that will be modified. This can be X, Y, Z, A, B, C, I, J, K, F, R, U, V, W, P and Q.
Modification – Sets the type of modification that will be performed.
Setting – Sets the value for the modification. For Scale, this sets the multiplier. For Transpose, it sets the new transposed value. For Rounding, it sets the number of decimal places. For Replace it sets the new value of the text.
Error – This will show any possible errors in the modification.
The entire list can be saved to a Text file by clicking Save. Similarly, these files can be reloaded by clicking Load.
Windows commands
|
Windows – Control which windows are shown in the editor. |
The Status button hides and shows the status bar.
The CAM Data button hides and shows the CAM Data view window (only available for NC Format programs)
Status bar
The status bar shows context sensitive information about the currently selected command code and displays the current line and character number in the editor. You can double-click any known code in the editor and the editor will select the entire code. When you do so, the code type and description is displayed in the status bar.
While in Edit G-Code mode, you can click Change to modify the code. A grid will be displayed showing all possible values for that code. Simply select a new value and it will be updated in the G-Code.