Pseudo-code is a type of programming language that uses plain language to outline the logic and structure of a program without being tied to any specific programming language. Pseudo code is typically less detailed than actual code, and may not include specifics such as syntax or variable names.
Pseudo-code is important because it allows programmers to plan and design the structure of a program before writing actual code, which helps identify potential issues or problems early in the development process.
In the context of G-code programming for CNC machining, pseudo-code can be used to plan and design the tool path for a part before writing the actual program in the G-code programming language. Once the pseudo-code is complete, the programmer can then use it as a guide to write the actual G-code program.
This can help to ensure that the toolpaths are optimized for the part and that the machining process will be efficient and accurate.
Code Documentation is a process of creating documentation, often in the form of written text, diagrams, or comments in the code itself, that explains how a particular software program or system works. The purpose of code documentation is to help other operators/programmers/engineers understand the code, use it effectively, and maintain it over time. Code documentation typically includes information such as:
How the different parts of the code are organized and interact with each other
Any special considerations or limitations that must be taken into account when using the code
Any assumptions or requirements that must be met for the code to work correctly
The purpose and functionality of each command within the code
While pseudo-code can be used to outline the program's logic and function, documentation is used to outline the processes related to the program, such as:
Machine setup instructions
Part/Stock setup instructions
WCS locating instructions
Tool setup instructions
In-process operation instructions
Part/feature inspection
Part reorientation between operations
Both Pseudo-Code and Documentation can be practically accomplished through the use of Comments within the G-Code program itself
Comments are not executable/readable by machines, and exist exclusively for the operator, programmer, and engineer's sake
This also means that the comment is not subject to the same G-Code "rules" - particularly with respect to syntax - and can include most characters and symbols
For CNC machines, Comments are indicated several ways, one of the most common being anything within a set of parentheses, e.g.: (Comment)
When adding advanced functionality to G-Code to automate processes, it requires a fundamental shift in how you might typically interact with G-Code:
The traditional way of looking at G-Code would be to:
Write or post the code with correct syntax
Translate/comment out the code (pseudo-code & documentation)
Visually/mentally lump functional sections of code into toolpaths or other combined purposes
When it comes to advanced G-Code programming (ex: Macros - more on them, later), the workflow is the exact opposite of the traditional one:
Define functional sections of code - toolpaths and other combined purposes
Write pseudo-code & documentation via comments
Translate the pseudo code to exectuable syntax
Read the following Chapters of the Peter Smid book, "CNC Programming Handbook: A Comprehensive Guide to Practical CNC Programming":
Chapter 6: Programming Planning
Chapter 7: Part Program Structure
After reading, do the following:
Analyze your understanding of the concepts discussed in the book's chapters and throughout this submodule
Identify your key takeaways from the chapters - what did you learn that you didn't know previously, how does what you learned affect your perspective going forward, etc.