How to Create a VB Script Program to Better Locate Position of a Feature

This is a excerpt from the CMM Manager Handbook

Objective:

The issue is, in our program if Circle1 is not in the correct location, due to machine targeting or various other reasons we will want to manually check the diameter of Circle1 and use this new location to check the diameter in CNC mode.

The Program

Here is the program layout. We will go through each item on the following pages.

Setup a program as normal. Add the alignment, Probe Assembly, etc..

After these steps we will begin our program.

Measure Circle1

In our example the X & Y positions will be off. The machine shop is still targeting.

Create a Feature Report item and report Circle1

As you can see Circle1 X & Y is out of position. Frankly everything is due to the diameter being out of position. This might be caused by the probe going into the part’s true nominal, derived from the CAD model and the measurement needs to be centered better prior to measurement.

One solution is to manually measure the diameter and extract the exact position of the diameter then remeasure in CNC.

Solution

In the Program tab select Add VB Script

Insert after the measured Circle1 and before the reporting of Circle1

After the reporting of Circle1 repeat the input of VB Scripting and add this text. The CMM Manager Handbook breaks down the individual text lines.

To manually measure a Circle feature. Add a circle from the feature tab.

Change the name to ManCircle.

Now add this VB Script

Now we need to capture the actual X & Y for the ManCircle. We will use these values to locate the new Circle1 diameter.

Now add a CAD based circle

Change the name to Circle1a

Under the Nominal Tab select Set Variable button and set the variable as shown.

Create a feature report for Circle1a.

Create another VB Script as shown.

Now when you run the program the results will be displayed for Circle1a.

 Now continue your program. We added a cone and circle feature.

 Now at the end of the program we need to close the loop. This will guarantee the program will end properly.

Now when the hole is targeted to the correct location and you need to disable the VB Script. Select the VB Script lines and the measure Cricle1a and Circle1a report right click and select Disabled. The code and the manual measure circle and report will not be run.

Previous
Previous

Datum Alignment