VBA Macros Ease CAM Program Creation

Taking advantage of the open architecture of Esprit CAM software to write Visual Basic for Applications (VBA) macros simplifies CNC programming at this manufacturer of automotive presses.


Facebook Share Icon LinkedIn Share Icon Twitter Share Icon Share by EMail icon Print Icon


Machining a wide variety of complex, tight-tolerance parts that often involve special customer requirements can be time-consuming and expensive, but that doesn’t necessarily have to be the case for programming. Such has been the experience at Prensas Schuler, a Sao Paulo, Brazil-based manufacturer of automotive industry press systems. Using macros to program parts in Esprit CAM software from DP Technology (Camarillo, California) has helped manage complexity and significantly reduce programming times, in some cases from hours to minutes. Moreover, the software’s open-architecture design and use of the Visual Basic for Applications (VBA) programming language makes it easy to find and train new macro programmers, receive technical support, and customize the system to suit individual applications, says Fabio Avila, who heads Prensas Schuler’s machine shop.
Prensas Schuler is the second-largest subsidiary of the Schuler Group, a Goppingen, Germany-based supplier of metalforming presses that has plants throughout the world. The Brazilian operation distributes the parent company’s full product line, but its manufacturing resources are dedicated to press lines, servo presses, transfer presses, progressive die presses, blanking presses, try-out presses, forging presses and press automation solutions. Components for these systems are produced mostly on large gantry mills and horizontal machining centers.
Accommodating special customer requirements requires creating dozens of new CNC programs each month. The company reports that this task is especially challenging because parts tend to be geometrically complex, and they often require special programming touches to avoid damage. Tolerances tend to be tight, so programs must include built-in trial cuts and touch-offs. Finally, programs require detailed annotations to guide operators through setup and machining processes.
Mr. Avila says writing macros for each major category of press component helps simplify the programming process, reduce errors, reduce programming time and make special customer requests easier to accommodate. Prensas Schuler had been using macro-based programming for some time before adopting Esprit, and the process is similar with both the old software and the new. In essence, macros boil the programming process down to a series of questions about the part and the equipment and tooling used to produce it. Based on the programmer’s input, the system generates a finished G-code program.
However, Esprit enables programmers to write macros using the industry-standard VBA programming language. In contrast, the company’s previous software used its own language. According to the company, it was difficult to find people who knew that language, so it often had no choice but to train new programmers from scratch. “We looked for a program that uses a standard programming language,” Mr. Avila says. “There are many programmers who already know VBA, and Esprit provides an application programming interface that opens the door for communications with many Windows programs.”
The fact that so many programmers have already mastered VBA is a major benefit because they can readily write macros for a variety of applications, including those at Prensas Schuler. Compared to the previous system, this eases hiring and training. Additionally, Esprit’s application programming interface (API) provides seamless integration with VBA, the company reports. For example, all of the CAM software’s menus and toolbars are accessible from within a VBA macro. This enables programmers to use macros to adapt the Esprit interface according to the individual needs of an application or business.
Prensas Schuler has several VBA programmers who write Esprit macros. The process begins with parametric models in CATIA V5, the CAD software the shop uses to design presses. Once imported into Esprit, those CAD files serve as the basis for macros dedicated to specific families of parts. Then, the CNC programmer uses the macro to create programs for individual parts within the family. For example, a typical dialog box might ask the programmer to define a hole by entering parameters such as diameter, depth, X-Y-Z location and hole type. Once the programmer enters that information, the system automatically creates the holes, selects the cutting tools, creates the drilling operations and produces the G-code program, complete with a tool list and a tool setup diagram that shows the zero point for the tooling on the part.
In addition to macro programming with VBA, Mr. Avila says he appreciates Esprit’s simulation capabilities. The software provides a graphical representation of not only the programmed tool paths, but also the entire machining environment, all in dynamic 3D solids. Such simulation provides benefits in addition to simply preventing collisions. For example, simulation has helped programmers discover that the final part geometry does not match the design intent and requires tweaking prior to any actual cutting. In other cases, programmers have recognized opportunities to reduce machining time by cutting a feature with a different tool or changing the order of operations. 
“Esprit macros have improved the CNC programming process for forming press components, and its use of the VBA programming language makes it much easier to find and train programmers,” Mr. Avila concludes. “Our goal is to continue to improve our macro programming capabilities in order to further reduce programming time and eliminate machine setup errors.”



  • Understanding NURBS Interpolation

    The right way to program curves? A solution to yesterday's problems? The truth is probably somewhere in between.

  • Interpolating Curves

    The ability to import complex curves into CNCs promises to let shops finally get beyond old limitations imposed by contouring with linear interpolation. Faster and smoother cutting will be the result.

  • DNC: Faster And Better -- Part One

    Direct numerical control (DNC) should solve problems, not create them. If you under-stand how DNC works and follow the tips presented in this article, you can maximize its benefits and avoid headaches with your system. Part One of a two-part series.