Grinding it your way with scripting



Scripting allows you to work smarter, improve productivity simply! Thomson Mathew, ANCA Software Product Manager explains how scripting is easy to learn. A powerful new level of automation, scripting can significantly expand the power of the ANCA software suite. Best of all, it is free to use and as a standard part of the ToolRoom software suite.

Thomson says, “Scripting is a simple programming language created specifically to automate tasks within ANCA application software such as iGrind. On a simple level, it can be used to automate most tool design tasks that can be achieved using the keyboard and mouse, such as entering of parameter values or drawing line/arc elements in 2D editors. On a higher level, it can be used to create sophisticated solutions such as fully featured custom tool wizards with graphical user interfaces.”

“Scripting is somewhat like using macros in Microsoft Excel. Macros can be simple “record and repeat” automation functions or can be programmed to perform very sophisticated tasks. This is what has made Excel the flexible and successful software tool that it is today.”

“Don’t let the term “programming language” scare you away from scripting. Scripting has been designed to be simple and the integrated scripting editor also provides various tools to make writing scripts as easy as possible. I emphasise this as scripting provides tremendous productivity benefits for a relatively small amount of training investment. Furthermore, Scripting is an evolving technology. Capabilities are expanding rapidly with every ToolRoom release,” Thomson concludes.

At a glance, some of the benefits provided by Scripting include;

• Reduced programming and set-up times: Automate the tool design process.

• Reduced programming errors and reduced scrap: Automation of common tasks means less mistakes made due to manual input.

• Simplify the programming process: Capturing complex process or geometry knowledge in a script means less work for the programmer or operator.

• Knowledge retention: Capture design and process intelligence in your scripts and utilize it in your software.

• Competitor advantage: Make the software behave how YOU want it to and set yourself apart from the competition. Only ANCA software has this powerful feature.

• Protect your proprietary knowledge: Many security options allow scripts to be encrypted (made unreadable). Scripts can also be license protected.

• Distribution and sale: Protected scripts can be distributed or sold. Manufacturers can send regrinder’ s custom regrind wizards without divulging geometry details.

• Return on investment: Scripting is easy to learn and powerful to use. With so many uses for scripting, it is easy to apply the knowledge to realize many of the benefits listed above.

It is not the intention of this article to be a tutorial on scripting. However, the example below shows a very simple script to set the Backoff Diameter of a simple drill to be 95% of the current tool diameter.

! Get the Tool Diameter from the currently opened file

toolOD = get("tool_od");

! Set the OD Backoff Diameter to 95% of the Tool Diameter

set("r_od_bk.backoff_od", toolOD * 0.95);



Figure 1 : A simple script example. Set the OD Backoff diameter (shown in yellow) to be 95% of the tool diameter. The script could be extended to set several tool parameters based on various geometry rules. Programming of entire tool families can be automated using this simple scripting mechanism. Scripts can be assigned as menu items (allowing one-click execution) or run directly from the scripting editor.




Figure 2 : Process knowledge, such as fluting feedrate verses tool diameter, can be easily captured within a script. In this example; (1) The feedrate verses tool diameter relationship is established from prior experience. (2) Scripting has utilities in the Scripting editor to easily program such relationships. (3) Much of the code is automatically written into the editor where the script is written. (4) The script is saved and can be optionally added to the iGrind “Utilities” menu. This allows the operator to simply click a menu item to automatically set the fluting feedrate based on the current tool diameter. This could be easily extended to also set the number of passes, infeed per pass, core diameter, etc.




Figure 3 : An example of a convenient script to save Endmill files using a specific filename format. The script in this example extracts certain information from the currently opened file and then creates a file name based on this. E.g. Mill type, corner radius (if applicable), tool diameter, number of flutes, helix and taper angle. When OK is pressed, the script will then also save the file in an appropriate directory. This is an example of how scripts can automate and simplify daily tasks.




Figure 4 : Graphical interfaces are easy to create using scripting. This example shows how the ANCA software can essentially be extended to suit your needs. Depending on the drawing, a customer had an issue where primary land width could be specified in one of two ways. To simplify the programming, a simple script was written with two graphical buttons. Simply select the land width definition type, enter the required value, and the script will calculate the required land width value. Calculations such as these are best automated within scripts to avoid manual calculation errors.




Figure 5 : Scripts can be extremely useful to create utilities to create custom geometry. In this example, a script was written to simplify programming of the geometry shown. Although powerful, this script is simple to write. Add in an image, position some length and angle parameter boxes over the image, add the logic to create the geometry from these parameter values, and show the dialog. Furthermore, it is easy to select whether the geometry is to be added to either the Blank or Profile editor, or to export to a DXF. These type of scripts are great time savers and greatly minimize the risk of programming errors.




Figure 6 : Scripts to create geometry can also be very useful to create wheel files. If the Wheel Editor does not have a standard template you require, a script can be easily written to achieve it. The script can output the geometry in DXF format to import into the Wheel Editor.




Figure 7 : Simple yet powerful scripts can be used to highly automate the programming process. In this example a Script is written where a simple Tap drawing has been added to a dialog. Parameter boxes are then positioned over the drawing to allow operator input. When ‘OK’ is pressed, the script simply copies the parameters into the appropriate Tap file operations. The blank is also created automatically. This is a very easy script to create, yet allows a great amount of flexibility, customization, and automation.



Figure 8 : Scripts can be written to create complete Tool Wizards that set all parameters. Scripting has been used to create full tool wizards for several existing ANCA customers. This allows operators to simply enter a very small amount of information (in some cases, just a tool diameter) and the tool file is created automatically.


Would you like to suggest an article or have a tool grinding question you would like us to address? If so, please send it to