When looping Program steps by use of VB Script loop - i.e. For Loop, Do Until, etc. - Features that have been executed more than one time will automatically be renamed using standard convention as such - Circle1, Circle1...1, Circle1...2, Circle1...3, etc. You may want to facilitate more meaningful names, this is especially true in nested loops like this:
- For i = 1 to 10
- For k = 1 to 10
- ...
- ...
- Next
- Next
This nested loop scenario is typical for loops used to create a rectangular grid of features / groups of features. A more useful naming convention might be - Circle_1_1, Circle_1_2, Circle_1_3, Circle_2_1, Circle_2_2, Circle_2_3, etc. - This method will give the recipient of report document some sense of which circle is which based on logical naming convention.
Here is an example of nested VB Script Loop that facilitates VB Variable that will be used in Name field of Feature Operation:
- for i = 1 to 10
- for k = 1 to 10
- MyFeatName = "Circle_" + CStr(i) + "_" + CStr(k)
- next
- next
If Measured or Reported Feature(s) are inserted between VB Script lines 3 & 4, the user may rename feature using the "@" character to specify variable replacement of name as shown below:
In Teach Mode the Feature Name in the Feature Database will be shown as above. Then any subsequent Report or Construction Operations will show the name in this same manner:
After Program is run (in Run Mode) the Feature Names will be replaced by VB Variable String value, thus providing unique and meaningful names for each Feature as shown here:
It is also possible to create Variable text for the User Note Report operation. This could be used to create periodic User Notes in the Report that help break the report document into logical groupings. A VB Script included inside of a loop could be used to create unique Variable Text for these User Notes as shown here:
- MyUserNote = "Report Section Number " + CStr(i)
A single User Note operation placed inside of a VB Loop results in multiple unique User Notes within the Report.
See attached example program. This program can be executed on simple rectangular block such as gage block or 1-2-3 block with minimum top surface width and length of 50mm x 50mm.
Related Articles
VB Script - Getting Started
What can I do with VB Scripting? CMM-Manager VB Scripts run in line with program execution and can be used to perform loops and flow control, display custom messages, prompt user for input that then influences program execution - i.e. skip section of ...
Parametric Programming - Part Families
Do you manufacture and inspect Part Families? Meaning, variety of parts having similar overall geometry but with varying dimensional characteristics? Instead of cresting one program for each unique part, you can realize significant time savings by ...
Launch CMM-Manager Program using External Command
It is possible to run another CMM-Manager Program from the External Command operation. This is useful if you'd like to create a simple launching program - i.e. main program that prompts user for next program, and then runs accordingly to user ...
VB Script - Calculate Measured Arc Length
To find the Arc length, you need 3 measurements. A circle (Arc), and a line or point at each of the Arc. From there, construct lines from the center of Circle to Arc's endpoints and report both the diameter of Circle and Angle between two constructed ...
Save Report Automatically for use with Discus
Once you've taught a program and create Report(s) it is possible to configure CMM-Manager program to automatically save report document in a format compatible with Discus CMM each time the program is run. Set Report Properties as follows: View the ...