top of page
Writer's pictureMike Lynch

Quick Intro to Parametric Programming

The best kept secret of CNC!

There are few CNC people that even know what parametric programming is -- and fewer still that know how to use it! Given the enhancements that this kind of programming brings, it is surprising that more machine tool builders, control manufacturers, and technical schools don't say more about it. In this short discussion, we'll explain what parametric programming is and show its main applications.


What it is Parametric programming can be compared to any computer programming language like BASIC, C Language, and PASCAL. However, this programming language resides right in the CNC control and can be accessed at G code level, meaning you can combine manual programming techniques with parametric programming techniques. Computer-related features like variables, arithmetic, logic statements, and looping are available. Like computer programming languages, parametric programming comes in several versions. The most popular is Custom Macro B (used by Fanuc and Fanuc-compatible controls). Others include User Task (from Okuma), Q Routine (from Sodick), and Advanced Programming Language [APL] (from G& L).


In addition to having many computer-related features, most versions of parametric programming have extensive CNC-related features. Custom macro, for example, allows the CNC user to access many things about the CNC control (tool offsets, axis position, alarms, generate G codes, and program protection) right from within a CNC program. These things are impossible with only normal G code programming techniques.


Applications: Many companies have excellent applications for custom macro and don't even know it. Of course, if you don't even know you have an application for something, it's impossible to even consider using it. While these applications are covered in much greater detail in our books, online classes, and CD-rom courses, applications for custom macro fall into five basic categories. Do any of these sound familiar?

  • Part families: Almost all companies have at least some applications for custom macro that fit into this category. Possibly you have prints dimensioned with variables right on the print. The programmer must reference a chart on the drawing to come up with values needed in the program. Or perhaps you consistently find yourself editing one CNC program to make another one. If you do, you have a perfect application for custom macro!

  • User-created canned cycles: Even if you don't have a perfect family of parts application for custom macro, surely you have at least some workpieces that require similar machining operations. Or maybe you find yourself wishing your CNC control had more (or better) canned cycles. With custom macro, you can develop general purpose routines for operations like thread milling, bolt hole patterns, grooving, and pocket milling. In essence, you can develop your own canned cycles!

  • Complex motions: There may be times when your CNC control is incapable of easily generating a needed motion. To perform accurate taper thread milling (taper threads), for example, your control must have the ability to form a spiraling motion in XY while forming a linear motion in Z (helical motion will not suffice in this case). Unfortunately, most CNC controls do not have spiral interpolation. But, believe it or not, with custom macro you can generate this desired motion. In essence, custom macro allow you to can create your own forms of interpolation.

  • Driving accessory devices: Probes, post process gauging systems, and many other sophisticated devices require a higher level of programming than can be found in standard G code level programming. Custom macro is the most popular parametric programming language used to drive these devices. In fact, if you have a probe on one or more of your machines, you probably have custom macro!

  • Utilities: There is a world of things you can do with custom macro that you would never consider doing without it. Custom macro can help reduce setup time, cycle time, program transfer time, and in general, facilitate the use of your equipment. A few example applications that fit into this category include part counters, tool life managers, jaw boring for turning centers, using standard edge finders as probing devices, and facilitating the assignment of program zero

Example: To stress what can be done with parametric programming, we show a simple example written in custom macro B for a machining center application. It will machine a mill a hole of any size at any location. Notice how similar this program is to a program written in computer programming languages.


Program

O0001 (Program number)

#100=1. (Diameter of end mill)

#101=3.0 (X position of hole)

#102=1.5 (Y position of hole)

#103=.5 (Depth of counter bored hole)

#104=400 (Speed in RPM)

#105=3.5 (Feedrate in IPM)

#106=3. (Tool length offset number)

#107=2.0 (Diameter of counter bored hole)

G90 G54 S#104 M03 (Select abs mode, coordinate system, start spindle)

G00 X#101 Y#102 (Rapid to hole center)

G43 H#106 Z.1 (Instate tool length compensation, rapid to approach Z position)

G01 Z-#103 F[#105 / 2]

Y[#102 + #107 / 2 - #100 / 2] F#105

G02 J-[#107 / 2 - #100 / 2]

G01 Y#102

G00 Z.1

M30

10,988 views0 comments

Recent Posts

See All
bottom of page