VB Script - End program or display error if Dim is Out of Tolerance

VB Script - End program or display error if Dim is Out of Tolerance

You can retrieve report data into VB using the “GetReportInfo()” function.

double GetReportInfo( CString sReportName, CString sReportType, int nIndex )

Return Value
The value at the specified cell of the report if the function is successful. The return value is 0.0 if there is no specified cell in the report.
Parameters
sReportName
Specifies the name of the report item to be retrieved.
sReportType
Specifies the type of report item to be retrieved. It is usually the text in the first column of the report item.
nIndex
Specifies which value of the report item to be retrieved. Defined as follows:
Nom – 1; Act – 2; Dev – 3; LoTol – 4; UpTol – 5; OutTol – 6.

i.e., the following VB Script could find out if ANY of the following dimension is Out Of Tolerance.

CODE

oot_x = GetReportInfo( "CIRCLE3", "X", 6 )
oot_y = GetReportInfo( "CIRCLE3", "Y", 6 )
oot_z = GetReportInfo( "CIRCLE3", "Z", 6 )
oot_d = GetReportInfo( "CIRCLE3", "DIA", 6 )
oot_c = GetReportInfo( "CIRCLE3", "CIR", 6 )

Now you can perform some action based on these results… Add all of the OOT variables.

CODE:

IsOut = oot_x + oot_y + oot_z + oot_d + oot_c
i.e., display a MsgBox or custom Text Message in Report



CODE:

DoPass = "Pass"
If IsOut <> 0 Then
   MsgBox("Dimension 8 Cirlce3 is OOT!!!")
   DoPass = "Fail"
End If
Or… Jump to the End of the program.

CODE:

Do
ProgEnd = MsgBox("Do you want to exit program?", 4)
If ProgEnd = 6 Then
  Exit Do
End If
Be sure to put a VB Script at the last step of the program to stop automatically.

CODE: 

ProgExit = 1
Loop Until ProgExit = 1
Attached is an example of how this can be used
    • 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 ...
    • 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 - Variable use for Feature Names and User Notes

      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, ...
    • 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 ...
    • VB Script - Prompt to skip manual Alignment

      Many times a CMM program may have a manual alignment followed by a DCC alignment. In some cases, the manual alignment does not need to be executed each time the program is run. This is true if subsequent running of the program is done with each part ...