Run behavior during loading of job file and simulation
Simulation refers to the software mode that is used when no hardware is connected. During the loading of a G-Code file, the interpreter runs the file while generating output for the graphic. During this no actions to the machine are applied, no motion and no I/O, only checks if the g-code is valid and stays within the machine limits.
If there is advanced macro programming, e.g. because the machine has automatic tool change, it is important to take into account that in simulation and render mode no machine actions take place.
Suppose we have a machine with a 6-tool automatic tool changer. A check is programmed that generates an error if a g-code file is loaded that tries to change the tool to a number that the machine does not have:
It stands to reason that we want this “ErrMsg …” line to be executed always, when running but also in simulation mode and when loading the file.
This check on air pressure will not work correctly while loading a g-code file or while the system is in simulation mode, because no actual inputs are read.
Here we see the modification to make the on the air pressure sensor input 5 simulation and render proof, the check is only performed when we are not in render or simulation mode, only an extra if statement that checks variable #5380 (contains the value of 1 when simulation mode) and #5397 (contains the value of 1 when rendering) is added.