New version 1.1.0.4 – interpreter updates and more

This version brings many improvements to the CNC code interpreter as well as other fixes.

•    Made G90/91 work with coordinates (Example: G90 X200).
•    Made G90/91 work with G0/G1 (Example G90G01Z-2).
•    Corrected an issue with G91 in combination with drilling cycles.
•    Fixed issue when G90/91 was together with other G-codes in the same block.
•    Added a new command $SetG28pos to be able to customize the G28 position.
•    Implemented G53 Move in absolute machine coordinate system.
•    Fixed issue with G0/G1 without coordinates.
•    Fixed issue with G41/42 radius compensation when only activated for two movements.
•    Fixed other minor issues with the radius compensation.
•    Fixed faster rapid movements during fast forward.
•    Added command $SetToolChangePos for customized tool change positions.
•    Made the zoom in and out function to follow the mouse pointer.
•    Added D and P words to G41/42 (See Radius Compensation below).
•    Added new command $DefineDoffsetDiameter (See Radius Compensation below).
•    Added possibility to call subprograms in separate files (See Subroutine and subprograms call below).
•    Added M99 subroutine/subprogram return command (See Subroutine and subprograms call below).
•    Made the L word optional in subroutine/subprogram calls (See Subroutine and subprograms call below).
•    Made so that if a subroutine is missing in the main program, the simulator will look for a file instead (See Subroutine and subprograms call below).
•    Added M97 (See Subroutine and subprograms call below).
•    Made G2/G3 modal.
•    Added a brand new Tool Offset Registry.
•    Added settings for the Tool Offset Registry.
•    Added G43 tool length compensation (see Tool Length Compensation below).
•    Added semicolon comments.
•    Fixed issues with G98/99 .
•    Fixed some issues with drilling cycles. Only G73 does peck drilling now.
•    Added G20/21. They will force the user to change the mm/inch setting.
•    Added G94/95 Feed per min/ feed per rev.
•    Added G61 and G64 for exact stop mode and normal mode.
•    Added pop-up help for G96/96 in turning mode.
•    Fixed issues with the grid in the 2D view.
•    Fixed issues with the graphic zeropoint in the 2D view for turning machines.
•    Fixed issue when clicking on the Stop button while simulating in 2D.
•    Fixed issue with graphic zeropoint in 2D-view inches

Radius compensation (milling)

From this version there are two optional letters used with G41/G2. The first one is the D word that is used to fetch a diameter value from either the in-program defined D-offset registry or the new Tool Offset Registry in the Inventory Browser. The second one is the P word and it used to directly program the compensation distance (radius). If these addresses are omitted, the radius of the currently selected tool will be used for the compensated tool path (default automatic tool radius compensation).

The local in-program D-offset registry can be programmed using the command $DefineDoffsetDiameter.
If no in-program D-offset is found, the simulator will look for the D-offset in the Tool Offsets Registry (Inventory Browser). Please note that the registry has to be enabled in settings before it becomes visible in the Inventory browser.
Please also note that the D-offset values in the Tool Offsets table can be either diameter or radius values depending on the checkbox “Use diameters for tool offsets” under the Program page in settings.

image

If the D-offset index is not programmed or not found, the current tool radius will be used instead. Also, the D-offset index row has to be checked in the registry to be considered valid.

image

The Wear value will be added to the tool radius/diameter when the compensation is calculated.

Example (using automatic and in-program defined offsets):

image

Please also note that the activation of the Tool Offset Registry adds complexity to the simulator as well as more machine-like realism. For beginners, we suggest keeping the Tool Offset Registry disabled letting the simulator fetch tool values automatically from the normal tool registry. When disabled, D-words can still be present in the G41/42 blocks without having any effect on the tool radius compensation.

Subroutine and subprograms call (all machines)

From this version the subroutines and subprograms calls has been rewritten and improved to maximize compatibility with various CNC controllers. We now also support subprogram calls to separate files.

General rules:

1. You can call subroutines (within the same program) and subprograms (separate file on disk) using either M98 or M97 using the same syntax. M97 has been added to support controllers like Haas.

2. A subprogram can start with either N or O. Both codes are supported as a sub program number.

3. Repetitions can be given using the L word or as the first digits of the P word (last four digits are always program number).

4. If a subroutine number is missing in program the simulator will attempt to find a disk file with the format O####.cnc in the same folder as the main program or in the user defined CNC-folder.

5. A subprogram can also be called with the alternative syntax M98 “mySubProgram.cnc” L…

6. Return from subprograms and subroutines can be done with either M17 or M99.

7. The L word is optional. If omitted, one call will be done only.

Some examples:
Single call to subroutine, no repeats
M98 P1000
.
O1000
.
M17 (or M99)

Standard call to subroutine, repeating 4 times
M98 P1000 L4

Call to subroutine on line number 555, repeating 2 times
N100 M98 P555 L2
.
N555 ….
N565 M17 (or M99)

Call to subroutine with repeats in the P address
M98 P51001 (Call O1001 five times)
.
O1001
.
M17 (or M99)

Calling subprograms
If a subroutine within the same program is missing, the simulator will look for a separate program on disk.
M98 O1099 L2
If there is no O1099 or N1099 in the program, the block above will call subprogram O1099.cnc

File name syntax
M98 “DrillHoles.cnc” L2
The block above will look for subprogram DrillHoles.cnc in the same folder as the main program, or in the user defined CNC programs folder.

Please remember to end all sub programs with either M17 or M99 for execution to continue in the main program.

Example:

image

Tool Length Compensation (milling)

Under normal circumstances, the CNCSimulator Pro user does not have to think about tool length compensation as it is automatically handled by the program. For example, when you call in a tool with M6 the length compensation value will be automatically fetched and applied from the milling tool registry.

For various reasons (realism, education etc.), sometimes the user might want to be able to control what value is used for tool length compensation, even in the simulator. This can be done by adding the G43 code to the program followed by the H word.

The H word specifies the index of the value in the new Tool Offset Registry.

It is important to know that the Tool Offset Registry has to be enabled in settings and the index row has to be checked for the value to be considered valid. If the registry is disabled and/or the index row is unchecked, the current selected tool length will be used instead (default automatic tool length compensation).

Important: The Geometry value specifies the positive tool length sticking out from the holder (this value is normally treated differently in real CNC machines where the gauge line is used; check your machine manual for comparison).

image

The Wear value will be added to the tool length when the compensation is calculated.

image

The tool length compensation can also be directly programmed using the P word.

Example: G43 P55.7 Z2 (Setting 55.7 as the tool length compensation).

If the tool length compensation differ from the tool length set in the milling tool registry, the simulator will be “fooled” into milling deeper (tool compensation less than tool length) or shallower (tool comp greater than tool length) than the programmed Z contour depth.

Please also note that the activation of the Tool Offset Registry adds complexity to the simulator as well as more machine-like realism. For beginners, we suggest keeping the Tool Offset Registry disabled letting the simulator fetch tool values automatically from the normal tool registry. When disabled, H-words can still be present in the G43 blocks without having any effect on the tool length compensation.