Many customers produce “families” of related parts, or parts that are nearly identical, but whose features vary in size and placement. Most measurement platforms require separate programs for each part in the “part family”. However, in VMS, a single program can run all parts in a family by utilizing a text file.
The figure above shows two different sizes of the FastStart training part. Creating separate programs for each part would be time consuming and prone to errors. Instead, consider designing the part program to handle many different sizes. In this example, an input text file is used with the part program. The sample program can be downloaded using this link. Sample.txt should be placed in the C:\ViewMM\VMS\PROG\ folder.
First, the input text file must be created, and the format for each line needs to be defined. In the image below, each line has three items separated by commas, i.e. the part number, the value for dimension A, and the value for dimension B. It is recommended to add a header line as the first line to remind the user what dimensions are being entered.
Next, the program must have the necessary steps to read this file and determine the values to use. VMS has the capability to read this input file, determine which line is for the current part, and apply the values for the dimensions to variables in the program. Please refer to the example in the VMS File I/O issue of the VIEW Vision Tech Bulletin and the function help within VMS for more information about specific functions mentioned.
In the program shown below, the operator is prompted to enter the part number (“SampleA”). Then, the program will read Sample.txt and search for that line that has “SampleA” as the first entry in the line. When that line is found, the function parse_line() is used to extract individual strings separated by a delimiter (a comma in this case) and puts them in a string array. The variables A and B can then be assigned their value from their respective locations in this array.
Finally, the variables A and B need to be used in the program to measure the two circles. Edit the circle measurement step “C2” and replace X stage position with the variable “A”. Do the same for “C3”, but replace Y stage position with variable “B”. The finders will be placed dynamically according to the specific part, instead of the same position each time. As the program grows, more variables will need to be defined and their dimensions entered into the input file.
Adding future parts becomes fast and easy. To add “SampleC”, simply add another line in Sample.txt with the new dimensions. The program is ready to run immediately! By utilizing these techniques, programs in VMS become more dynamic and efficient, giving you more time to spend doing the things you love, like developing new parts.