SolidCAM
Published

Custom Macro Enhancements

This parametric programming version hasn’t changed much over the years, but there have been some important updates.

Share

Custom Macro is the most popular version of parametric programming for CNC machine tools. Created by FANUC and adopted for use by several control manufacturers, it provides countless benefits to CNC users. I have demonstrated many benefits in previous columns.

Though the Custom Macro has been around for a long time, it hasn’t changed much over the years. I will highlight the most important updates, but keep in mind that if you must maintain compatibility among new and old machines, you must use only those Custom Macro features that are shared by all of your machines.

• Improved arithmetic. Newer versions of Custom Macro include more arithmetic functions than older ones. These functions include arc sine, arc cosine, improved arc tangent and power. The number of allowed nesting levels (brackets within brackets) has been increased from four to five.

• Improved conditional branching statement. Early versions of Custom Macro provide a rather simple IF statement. If the logical expression within the IF statement is evaluated as true, the only option is to specify an unconditional branch (GOTO). While the GOTO statement is often required, there are times when the true condition requires a different action—like a simple arithmetic operation command. Consider these examples:

Old way:
IF [#1 NE #0] GOTO 5
#1 = 0.25
N5 . . .

New way: 
IF [#1 EQ #0] THEN #1 = 0.25

Newer versions of Custom Macro also provide the ability to test more than one condition using the AND and OR extensions. Consider this example:

IF [[#1 EQ #0] AND [#1 LT 1.0]] THEN #1 = 0.25

Only if both conditional expressions are true will the arithmetic operation be executed.

• Referencing system variables by name. With older versions of Custom Macro, system variables are referenced by a four-digit variable number. The alarm-generating system variable, for example, is #3000, and the command
#3000 = 100 (R WORD MISSING)
will generate an alarm, and the message “MC100 - R WORD MISSING” will be displayed.

With newer versions of Custom Macro, you can additionally reference system variables by name. This makes it easier to determine what a system-variable-containing command is doing. Consider how much easier it is to understand this revised alarm-generating command:
[#_ALM] = 100 (R WORD MISSING)

You must reference the Custom Macro descriptions in your control manufacturer’s programming manual in order to find the appropriate name for each system variable (there are many). And by the way, referencing this manual is the only way to determine if your specific control model allows the new features described in this article.

• Reading parameter values. This may be the most important Custom Macro enhancement. While CNC users have had the ability to enter (write) parameters from within programs (using G10), there has been no previous way to read them.

Consider this command:
#101 = PRM [1,1]

The value of bit number one for parameter number one (a one or a zero) will be placed in common variable #101. (The value before the comma is the parameter number; the value after the comma is the bit number.)

It happens that for a FANUC 0iD control, bit one of parameter one specifies program format. For a turning center, this affects whether the format for one-line or two-line multiple repetitive cycles is required. A value of zero makes the control require two-line multiple repetitive cycles. A value of one makes it require one-line multiple repetitive cycles.

With the ability to read parameter settings and test their values with conditional branching (IF) statements, you can (among countless other things) ensure that your programs include the appropriate multiple repetitive cycle commands.

Other enhancements to Custom Macro include:

• Improved time/date. This Custom Macro function is helpful for timing events, as is required for tool-life monitoring. 

• Sub-program call using a specified letter address. Previously, only a “T” or “M” word could be used to call a sub-program. Current versions of Custom Macro allow you to specify that a sub-program be called when a letter address of your choosing is executed (though some letter addresses, like N, G and O, are not allowed).

• Abbreviating arithmetic and logic names. Programs can be shortened a little with this feature. The arithmetic function ROUND, for example, can be specified as RO. Just the first two alpha characters are required.

Paperless Parts
DN Solutions
OASIS Inspection Systems
Koma Precision
SolidCAM
Kennametal
To any Measurement Question there is an Answer
Hurco
CHIRON Group, one stop solution for manufacturing.
Precision grinding & hard turning custom solutions
World Machine Tool Survey
Mazak Multi-Tasking: Your Parts Multiplier.

Read Next

Large Part Machining

The Cut Scene: The Finer Details of Large-Format Machining

Small details and features can have an outsized impact on large parts, such as Barbco’s collapsible utility drill head.

Read More

3 Mistakes That Cause CNC Programs to Fail

Despite enhancements to manufacturing technology, there are still issues today that can cause programs to fail. These failures can cause lost time, scrapped parts, damaged machines and even injured operators.

Read More
OASIS Inspection Systems