Performing Math Functions on Reported Data

Post Reply
RonDon-47
New User
New User
Posts: 2
Joined: Fri Aug 23, 2013 11:02 am

Performing Math Functions on Reported Data

Post by RonDon-47 » Fri Aug 23, 2013 11:15 am

I would like to report the difference between two features that I have in my report. Lets call them Length1 and Length2. The difference between these two points is what I need in my final report and not the actual lengths. So if Length1 minus Lenght 2 = delta1 How would I write that in VB script? Or is there some other way of getting the difference between these two length dimensions which are the lengths between constructed points in CMM Manager.

Thanks - Ron

User avatar
US_Helpdesk
Moderator
Moderator
Posts: 1087
Joined: Wed Feb 23, 2011 7:26 pm

Re: Performing Math Functions on Reported Data

Post by US_Helpdesk » Fri Aug 23, 2013 12:38 pm

The function GetReportInfo() will retrieve report values for use in VBScript during program execution. This function allows user to retrieve any report values including Nominal, Actual, Deviation, Tolerance, Out of Tolerance, etc. as a VB variable. Refer to VBScript Function Reference here - C:\Program Files\Nikon\CMM-Manager 3.8 SP1\Help\Function Reference - VB Script.pdf - for more detail as shown below:
GetReportInfo( CString sReportName, CString sReportType, int nIndex )

sReportName - String value - Specifies the name of the report item to be retrieved.

sReportType - String Value - Specifies the type of the report item to be retrieved. It is usually the text in the first column of the report item.

nIndex - Integer value - 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.

Examples:
  • “CIRCLE3” is a report item in your report. To retrieve the actual X value, the VBScript text would be:
    act_x = GetReportInfo( "CIRCLE3", "X", 2 )

  • If you have reported a cloud “CLOUD1” and want to retrieve nominal Y value of point “P1”, the VBScript text would be:
    nom_y = GetReportInfo( "CLOUD1", "P1:Y", 1 )
Regarding your question about Length 1 & Length 2 comparison, you can add the following VB Script to the program after reporting the two distances:

Code: Select all

dist1 = GetReportInfo("DIST BT CIRCLE1 and CIRCLE2", "3D",2)
dist2 = GetReportInfo("DIST BT CIRCLE3 and CIRCLE4", "3D",2)

MyDist = abs(dist2 - dist1)
MsgBox(MyDist)
Due to MsgBox() you will be prompted with calculated distance as shown below. Details for MsgBox() here

msgbox.jpg

Now we will want to display the value from MyDist variable in the CMM-Manager report. We'll use the User Defined Report to pull the VB Variable from the Script. Press the [Set Variables] button to replace the Nominal, Actual, and Tolerance values with VBScript variable name instead. When the program executes the actual value of VB variable will replace the value displayed in the User Defined Dimension operation and ultimately update the Report accordingly.

user_defined_dim.jpg

Overall the program should look like this, also see attached program.

program.jpg
You do not have the required permissions to view the files attached to this post.
I've migrated to a new user account, see my other posts here

RonDon-47
New User
New User
Posts: 2
Joined: Fri Aug 23, 2013 11:02 am

Re: Performing Math Functions on Reported Data

Post by RonDon-47 » Mon Aug 26, 2013 11:47 am

Thanks Nate. I will add it to my program. Have a good day Ron

Post Reply