If you know G-code, then you know the limitations it has. G-code files end up being quite long, often repeating large segments of code with just one or two small changes. There is no way to re-use code in loops or subroutines.
While standard G-code does not have these features, many control systems implement some kind of a scripting language in addition to standard G-code. These add-on scripting languages give you programming style features, like subroutines, loops and branching, and math functions to calculate values instead of using literals.
This class will go over the basics of the scripting tools available in LinuxCNC. Subjects covered include:
– system parameters, which function like variables in a program
– expressions, which allow for calculated values to be used instead of literals
– O-words for flow control, including conditional branching, loops and subroutines
– special comments used for debugging scripts and printing messages to the LinuxCNC UI window
– several G-words and M-words that are useful only in such scripts, including probing, changing WCS values and tool offsets, and saving and restoring modal states of the machine.
Students should have a working familiarity with the basics of G-code before taking this class. Students unfamiliar with G-code should take the “Introduction to G-code” class before taking this class.
While it is not required for the class, students may find it useful to have a working installation of LinuxCNC or Machinekit set up with the AXIS simulation configuration. Such a simulator setup is absolutely necessary for testing code before trying it out on any actual CNC machine. I will be using Machinekit installed on a Raspberry Pi 3 and configured for simulation to demonstrate code behavior in this class.
Dates & Access:
Wednesdays; 3/31/21 – 4/7/21. All participants will receive a link to a live Zoom session prior to the start of the class.
Instructor: Brian Trimmer