G-code
Macro programming
Run behavior during loading of job file and simulation
4 min
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 check example that should be always executed 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 check example that should be only executed during the job 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