SolidCAM
Published

You Asked, We Answered: Custom Macro B

Custom macro B is FANUC’s version of parametric programming. Judging by the questions, comments and suggestions I regularly receive from readers, it is a feature that many of you have utilized. There are certain questions that I receive on a pretty regular basis. While none by itself is enough to justify its own column, taken together, these questions can provide some helpful information.

Share

• How can I tell if my machine has custom macro B?
There are two ways you can do this. With newer FANUC controls, if you find a display screen soft key labeled MAC VAR, press it. If the display shows a series of variables (such as #1, #2, #3 and so on), the machine has custom macro B. If you can’t find this soft key, try inputting and executing the command using manual data input (MDI):
 
#100 = 1
 
If the control executes the command without generating an alarm, the machine has custom macro B.
 
• Is there a way to get the machine to prompt the operator for an input?
This would be a helpful feature. You might have an application that requires the operator to answer a question prior to continuing. Unfortunately, there is no such feature in custom macro B, but there is a work-around.  You can use the stop with message system variable (#3006) to stop the machine (just like M00) and place a message on the display screen. The message can tell the operators to enter a value into a given variable. The operator then presses the cycle start button to continue. Here’s an example:
 
#3006 = 110 (ENTER DIA IN #101)
 
When the control executes this command, it will stop the machine and place the message ENTER DIA IN #101 on the display screen. The operator must then call up the variable page and enter a diameter in common variable #101. Finally, the operator presses cycle start to have the machine continue. In the custom macro, it would be wise to test the value of the entered value for correctness prior to allowing the program to continue.
 
• Is it better to use G10 or system variables to enter offset data?
There are two ways to enter data into offsets, G10 and system variables. These two commands do exactly the same thing on a 21 series FANUC control:
 
G10 L2 P1 X13.2726

#5221 = 13.2726
 
Both of these commands set the X register of fixture offset No.1 to 13.2726. So which is better? Here are two considerations:
 
First, G10 is more universal when writing values into offsets. Different FANUC control models use different system variables to provide access offsets. So, if you have several controls requiring the same program, you might have to reference different system variable numbers in each program. The same G10 command can be used in all programs.
 
Second, you must use system variables if you ever need to read from an offset register. G10 does not allow this ability. So the following command will place the current value of fixture offset No.1’s X register into common variable:
 
#101 = #5221
 
If you need only to write values into offsets, G10 will be better because it’s more universal. However, if you have to read the values of offsets, it might be better to stick with the system variables for everything. 
 
• Can I use AND and OR within conditional (IF) statements?
This ability provides more versatility for developing conditional expressions. Consider these two series of commands that confirm the value of #101 is between five and ten.
 
Without AND
IF [#101 LT 10] GOTO 3

#3000 =100 (BAD INPUT)

N3 IF [101 GT 5] GOTO 5

#3000 = 100 (BAD INPUT)

N4 … (Program continues)

.

.
With AND
IF [#101 GT 5] AND [#101 LT 10] GOTO 5

#3000 = 100 (BAD INPUT)

N5 … (Program continues)

.

.
With older controls, AND and OR were reserved for use with binary expressions and could not be used in the manner shown in the second example above. However, newer controls do allow AND and OR to be used within conditional expressions. Unfortunately, I can’t tell you which control models allow AND and OR to be used in this manner, but if you write a lot of custom macros, it would be worth your time to test it.
 

Keep in mind that if programs are run in multiple machines, you will not be able to use this new feature for programs run in older machines. 

TIMTOS
SolidCAM
DN Solutions
Hurco
JTEKT
715 Series - 5-axis complete machining
More blasting. Less part handling.
Koma Precision
Paperless Parts
SolidCAM
DN Solutions
MMS Made in the USA

Read Next

Workforce Development

Inside Machineosaurus: Unique Job Shop with Dinosaur-Named CNC Machines, Four-Day Workweek & High-Precision Machining

Take a tour of Machineosaurus, a Massachusetts machine shop where every CNC machine is named after a dinosaur! 

Read More
Machines

IMTS 2024: Trends & Takeaways From the Modern Machine Shop Editorial Team

The Modern Machine Shop editorial team highlights their takeaways from IMTS 2024 in a video recap.

Read More
Sponsored

The Future of High Feed Milling in Modern Manufacturing

Achieve higher metal removal rates and enhanced predictability with ISCAR’s advanced high-feed milling tools — optimized for today’s competitive global market.

Read More
TIMTOS