Accessing script files in PlanetCNC TNG software

One of the most useful tools of PlanetCNC TNG software are its script files.
PlanetCNC TNG software offers numerous program features that allow flexible and fluent work flow when operating a CNC machine.

To name a few of the most common ones: Work position/Measure Height, Tool Offset/Measure Length, Tool change procedure, Homing procedure and the list goes on.

Each of these features have its own dedicated gcode program that dictates their machine and program behaviour. Such gcode program is called script file. So, most of the toolbar buttons, custom buttons, user commands, Machine menu items etc.. has its own dedicated script file that is available for observation, editing or configuration.

Script files can be accessed in three different ways:

-Via settings (File/Settings/Program Options/Scripts)
-Using combination of PC keyboard keys Ctrl + Alt and Left mouse button
-Directly accessing script files in Scripts folder


Accessing script file via Settings

In PlanetCNC TNG sw click File/Settings/Program Options/Scripts:

All program features that are available for configuration, observation and editing are listed here, categorized based on their functionality. So if you would like to change script code for spindle control, M3 code, click M-code category and select M3 from the drop down list. Then click button Edit Script:

Script code will open in PlanetCNC TNG native gcode editor:


Accessing script files using short keys

Third, and probably the fastest way of accessing script files is using combination of PC keyboard keys Ctrl + Alt + Left mouse button.
All you need to do is press combination of Ctrl + Alt keys and with left mouse button click on desired program feature(this can be Machine menu item or toolbar button or any other scriptable feature). Script file will open in gcode text editor.


Directly accessing script files in Scripts folder

To access script file in script folder, open your PlanetCNC TNG installation folder, locate and open your profile folder and open Scripts folder.
Maybe you will notice that script file that you would like to use is not present in the folder. In such case, you would need to access script file using either settings approach or short key approach (described above). Once you managed to open script file in gcode editor, click Save button (diskette symbol) and script file will appear in the Script folder.


Obtaining default script gcode

It is very important that user understands that there is no fear or danger of losing default script gcode. Default script code is always reversible/obtainable.
In order to do this, user clicks the trash bin button:

This button will restore scripts default gcode. You can modify script code, delete parts of it, delete all the code, with this button, default script code will be restored in its entirety.


For this example we will configure script for program feature: Machine/Move/To Zero. To access  script code, we will use short keys approach.

We will change the default script gcode and then set it back to default.

1. Access script code of program feature: Machine/Move/To Zero


Use shortkeys Ctrl+Alt+Left mouse button to open script code in TNG gcode editor:

We can see that default script code moves all 9 axes at the same time.

No we will change default script code so that axes ABC will move to zero first, axes XYUV second and axes ZW last:

Click Save button (diskette symbol) to save newly configured script gcode.

In order to obtain default script code back, you click the trash bin button and default code will appear. Click save button in order to save default script code.