Enter Your Email Address Here

Macro Programming Fundamentals

Macro programming is a useful tool for most any CNC machine shop, whether a one man garage or an international conglomerate. Macro programming provides a means of shortening code and doing repetitive tasks easily and quickly. All of your canned cycles in a control are nothing but a macro. Macro is also extremely useful for families of parts.
All computer programming is on a fundamental level, very similar. The syntax of the commands, and purpose of the programming may change, but the fundamentals of how to approach it, how logic works, and program flow are pretty much the same.

The first step to any programming is to define the _functionality_ required of the program. Functionality is defined as the end result(s) and abilities expected of the computer code. In other words, what is it supposed to do.

When we write a macro, we have a desired result in mind. Write down the broad-based result you are looking for from the program. A broad-based result would be something like: Bolt circle drilling, rectangular pocketing, block facing, slotting, etc.
For an example, lets use bolt circle drilling.
After we have defined the broad-based functionality, we need to narrow down the specifics of what we desire from the program. We must set limits to the functionality we want to achieve. If no limits are set, then the program becomes too large, cumbersome and time consuming.
In our example, one of the main limits we need to set is the maximum number of holes we will be allowed to drill in the macro. For the sake of brevity, lets limit ourselves to 10 holes (We have another question coming up that, in reality, allows unlimited holes using only 10 as a maximum here)
So: Max Holes in pattern == 10.
Next up on the functionality list regarding hole drilling: Do we have a drilling cycle in the machine control or not? Most of the time, this is going to be a yes, so we will go with that.
So: Have drilling cycle in control == Yes
Next up on the functionality list: Do we want the ability to start the hole pattern at some angle other than directly along one of the major machine axis (X,Y,Z), this is seen often in parts, so yes, we want this functionality.
So: Ability to start holes at operator input angle == Yes
Next: Do we want the macro to call the tool, or will you already have the tool in the spindle when you call the macro? Lets do macro does not call tool. This is really a programmers preference as to which way to go, but since the possibility exists that we could do multiple bolt patterns with the same tool, we wouldn't want to go to tool change position each time between patterns.
So: Macro calls tool == No
Next: Do we want to induce multiples of our max holes? This would allow you to drill more than our stated maximum number of holes. I think we can implement this in a short manner, so we will do this.
So: Macro allows multiples == Yes
What other functionality should we define?......hrm.....for now I can't think of anything, so onward we go with the functionality described above.

Followers

Face book

Twitter Delicious Facebook Digg Stumbleupon Favorites More