About GibbsCAM Macros
Introduction
The GibbsCAM macro language is a programming system that enables you to create geometry, tools and operations. It was originally implemented to assist with family of parts programming. To provide a method for a user to input a set of dimensions for a part. To use those dimensions to create a shape, build the required process and tool and DoIt.
GibbsCAM macros are text files which are interpreted at run-time. There is no compiler stage for GibbsCAM macros. The language used is similar to Basic.
All macro files must be plain ASCII text files. You may use Notepad or the text editor of your choice for creating macros. The macro files may be saved anywhere on your system and they are run from the Macro menu in GibbsCAM. You edit the macro menu by using the configure option which is always on the bottom of the macro menu.
Your code can be stored in a single macro file (with the .mac extension), or you may break it up into smaller macros that are called from the main macro. User input is available through a simple prompt for a single value, or a user defined dialog (a seperate text file, with the .dlg extension) that may contain input boxes, check boxes, radio buttons, drop down menus and pictures.
- Modify an existing Prog, known to be good, to get the desired output.
- Test the entire compiled processor.
While writing the Prog be sure to use Prog comments wherever there may be a question of what is going on, both for your aid and the next person trying to figure it out. Anything placed between {} brackets is a comment and not compiled. Also be sure to list in the header of the Prog some comments describing what processor you started with and for whom it is being made for along with the date, your name and a summary of what you did to it and maybe why you did it.
Prog
A Prog is a text file containing eight basic types of keywords; Command, Numeric, Boolean, String, Literal, Argument, Math and Directive, ComPost understands these keywords to compile and create the processor. The Prog basically does two things, produces an effect to the file and controls the flow of the processing.
Keywords
There are eight different types of keywords involved in the ComPost language. They are as follows:
Argument
- An Argument can be of a keyword type: Command, Numeric or Boolean. The keyword is followed by a value enclosed in parentheses (`n'). The value n is a defined value and must be enclosed inside of single quotes and parentheses. This is then acted upon or simply stored for future reference or calculations.
- A Boolean is a keyword that ends with a question mark "?." A logical operator used to discriminate the flow of the Prog. The boolean is preceded by an "IF." If the result of the boolean is true, the very next line is executed, otherwise the flow falls through to the "ELSE," if one is present. The line after it takes control with the whole statement being terminated with "END." See "ComPost Reference Guide - Logic & Modifiers."
- A Command is typically a keyword that formats a value from the post processor with its label and label formatter in the Form and outputs the result to the file.
Directive
- The Directive is a keyword that instructs the Status Register (also known as the Status Record, it is the internal file inside the post processor that keeps track of what's going on) directly without causing any output. For example, you can instruct the Status Register that you want incremental values with the `SetInc' command. You will then get incremental values output but there will be no incremental command output.
Literal
- A Literal is anything enclosed in single quotes, it is output literally. A numeric-type is usually preceded by a literal to describe what the number is for.
Math
- Math is a keyword that resembles a numeric (in that it ends with a pound sign "#") allowing you to do simple mathematical computations to numeric keywords.
- A Numeric keyword that ends with a number sign "#." Typically returns a value from post processor. A numeric is normally preceded by a literal and requires a Prog Formatter (see "Numeric Formats") for proper output.
- String keyword that ends with a dollar sign "$." Similar to a command except that there is no formatting, It outputs a string of text from the post processor.