Parametric Programming

Author Christopher Tate
Published
November 26, 2024 - 06:00pm
view magazine
image of gifts

Parametric programming is one the most powerful and least used tools available to CNC programmers, machinists and engineers. Parametric programing allows a programmer to create code utilizing variables stored in a machine’s memory along with logic, mathematics and trigonometry to command the machine. The most common example of parametric programming are the programs used by machines with probes and automatic tool setting. All are controlled by parametric programs. Parametric programming is a foundational part of automating routine programming tasks, simplifying machining operations and improving efficiency.

It is interesting to hear why people do not want to invest the time to learn and perfect the use of parametric code. Many have told me that they don’t need to learn it because they work in a small shop and only the “high production” shops need to use that kind of stuff. Others say they run the same parts all the time so there is no benefit. However, every programmer and machinist can benefit from using parametric code.

Parametric programming opens the door to a world of opportunities for programmers and machinists. It is the gateway to automating routine tasks, reducing errors and improving productivity.

So, what can it do for you?

It is important to point out that part probes, tool setting probes and similar devices rely on parametric programs to function. The probing routines and “canned” cycles rely on stored values to accurately execute commands. Probes are nothing more than expensive triggering devices. Once triggered, the probe will signal the machine to stop, and the parametric code then reads and records values for later use. All these values live in the memory of the control, and all are available to the programmers if they know where to look.

There are countless things that a programmer can do with that stored data. I worked for a company that made step drills — those drills that look like Christmas trees with several different diameters on them. We made about a dozen different configurations, all of which got two flutes milled in them.

Drill diameters and lengths varied from part to part necessitating a new setup each time. Our operators struggled to get the machines set up and we lost hours every time we changed over. When a new program was needed it took days to get it created and qualified.

We decided to create a parametric program that could be used for all tools. It was set up so that the person creating the program simply populated a template with values from the drawing and then saved it with a new name. Once we had the template completed, a new program could be created in 10 minutes.

Here is some of the code from the program. The first three lines capture critical values from the drawing. Of course, the instructions make more sense when you have a drawing.

#850=1.75 (DISTANCE FROM SECTION TO SECTION ON DRAWING)

#851=.030 (HEIGHT FROM CENTER TO TOP OF FLUTE POINT END)

#852=.315 (HEIGHT FROM CENTER TO TOP OF FLUTE BIG END)

#853=#852-#851 (FOR TRIG CALCULATION)

#854=ATAN[#853/#850]

#855=-90+#854 (B AXIS POSITION FOR MILLING)

Transitioning to parametric code simplified the creation of new programs and ensured every program had the same structure.

Utilizing parametric code also allows the programmer to perform arithmetic and trigonometric calculations inside the program. Including the calculations internally further simplifies the programming process while reducing the opportunity for errors. Once the parametric code was complete and qualified, we shared the information with our design engineers. We only needed a few of the dimensions they were providing. So they were able to align their drawings to our program and streamline the drafting process. The lines below show how we used arithmetic and trigonometric calculations with values from the drawings to calculate needed values.

#814= SIN[ #811 ]

#829= [ #830 - #810 ] * [ #814 ]

#831= [ #830 - 0.75 ] * [ 1.0 ] (X START POINT)

#832= [ #831 + ABS[ #815 ] ]

#833= [ #831 * -1.0 ]

We successfully created a program template that would make good parts, and it worked well. However, we still had setup issues that had to be overcome. Our operators were using old fashioned edge finders to set up the work coordinates during change over. It was difficult and resulted in a significant amount of time lost running a part, checking, adjusting and running again.

Our machines were equipped with part probes and tool setting probes, but they had not been utilized. So, we put them to use. The machine already had programs that controlled the probing routines, but we took it a step further to simplify the setup.

The VMC had a fourth- and fifth-axis rotary table that would position drills at the correct angles for machining. The programs would calculate the angles based on data entered (shown in the code on page 17). We machined about 12 different styles of these drills. Body length and body angle varied across the family of parts. In the beginning our machinists were setting the X axis starting point by tipping the rotary table and trying to touch the point of the drill with an edge finder. It didn’t work well, and we spent hours chasing problems.

To overcome the issue, we created parametric code that would probe a gauge pin to find X and Y locations. We then pulled those values into the program and calculated the X and Y origins. This simple change reduced setup time by hours and essentially eliminated setup errors. You can see in the code below where we pull values stored deep in the control by the probing routine (#14201, #14202 & #14203) and reused them for our program.

#835= #828 + #829 (Y START POINT)

#836= #814 * #832

#837= #835 - #836 (Y END POINT)

#822=.5 (RETRACT CLEARANCE IN Y)

#801=#14201

#802=#14202

#803=#14203

It took several weeks to create and debug our program, but the effort paid off in the end. Before our work, it could take an entire shift to set up one machine, and we scrapped a large number of parts in the process. After we launched our program our setup time dropped to 5 minutes and our first pass yield went to 100%. The milling process was so efficient that we routinely outran the upstream turning processes.

Parametric programming is one of the most powerful tools available in the modern CNC control, though it can feel daunting to someone who is unfamiliar. However, it is not as difficult to learn as it might seem, and it provides cost-effective solutions to problems. The only limitation is the programmer’s imagination.

Related Glossary Terms

  • clearance

    clearance

    Space provided behind a tool’s land or relief to prevent rubbing and subsequent premature deterioration of the tool. See land; relief.

  • computer numerical control ( CNC)

    computer numerical control ( CNC)

    Microprocessor-based controller dedicated to a machine tool that permits the creation or modification of parts. Programmed numerical control activates the machine’s servos and spindle drives and controls the various machining operations. See DNC, direct numerical control; NC, numerical control.

  • edge finder

    edge finder

    Gage mounted in the spindle of a vertical mill and used, while rotating, to find the center of a part relative to the toolholder.

  • family of parts

    family of parts

    Parts grouped by shape and size for efficient manufacturing.

  • flutes

    flutes

    Grooves and spaces in the body of a tool that permit chip removal from, and cutting-fluid application to, the point of cut.

  • gang cutting ( milling)

    gang cutting ( milling)

    Machining with several cutters mounted on a single arbor, generally for simultaneous cutting.

  • milling

    milling

    Machining operation in which metal or other material is removed by applying power to a rotating cutter. In vertical milling, the cutting tool is mounted vertically on the spindle. In horizontal milling, the cutting tool is mounted horizontally, either directly on the spindle or on an arbor. Horizontal milling is further broken down into conventional milling, where the cutter rotates opposite the direction of feed, or “up” into the workpiece; and climb milling, where the cutter rotates in the direction of feed, or “down” into the workpiece. Milling operations include plane or surface milling, endmilling, facemilling, angle milling, form milling and profiling.

  • turning

    turning

    Workpiece is held in a chuck, mounted on a face plate or secured between centers and rotated while a cutting tool, normally a single-point tool, is fed into it along its periphery or across its end or face. Takes the form of straight turning (cutting along the periphery of the workpiece); taper turning (creating a taper); step turning (turning different-size diameters on the same work); chamfering (beveling an edge or shoulder); facing (cutting on an end); turning threads (usually external but can be internal); roughing (high-volume metal removal); and finishing (final light cuts). Performed on lathes, turning centers, chucking machines, automatic screw machines and similar machines.