Output Temperature Sensor to Report

Output Temperature Sensor to Report

It is possible to read temperature from sensors on CMM that's equipped with Thermal Compensation.

The GetTemperatureReading() function can be used to store the current temp reading to a variable:

VB Function
int GetTemperatureReading( double &dTemp, int nIndex )
Return Value
0 if the function is successful, which indicates dTemp is a valid temperature reading.
1 if the function fails to get a valid temperature reading, or thermal compensation is not enabled or supported by the controller being used.

Parameters
dTemp
Stores the retrieved temperature reading if the function is successful.
nIndex
Specifies which sensor’s temperature reading to be retrieved. Defined as follows:
X Axis – 1; Y Axis – 2; Z Axis – 3; Part – 4.

The following code will write the part sensor value to the variable "MyTemp1" and the variable "funcWk" will be 0 or 1 depending on whether the function was able to retreive the value or not.  If machine is not properly equipped the user is prompted to enter temperature manually.


  1. MyTemp1 = "xxx"
  2. funcWk = GetTemperatureReading(MyTemp1, 4)
  3. If funcWk = 1 Then
  4. manTmp = MsgBox("GetTemperatureReading() Failed" & vbCrLf & "Enter Temperature Manually?", 36, "Temperature Reading Error")
  5. If manTmp = 6 Then
  6. MyTemp1 = InputBox("Please enter temperature", "Enter Temperature", "68")
  7. End If
  8. Else
  9. MsgBox(MyTemp1)
  10. End If

Aside from Temperature reading obtained from VB Script, it's possible to add any VB Script Variable to the Report in the same manner as described below.  For example, you might add the current System Time by creating a variable like this - MyVarTime = Now()

Finally add a Customer Data Field to the Report header and specify the variable using the [Set] button.
Report Properties - Customer Data

It's also possible to display Variable data in Report>User Notes:
Report > User Notes - use @ to display VB Variable

Finally, after running program we see the results displayed in CMM-Manager report:
Temperature info displayed in CMM-Manager report


    • Related Articles

    • 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 ...
    • Save Report Automatically for use with Prolink QC-CALC Realtime

      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 QC-CALC each time the program is run. Set Report Properties as follows: View the ...
    • Save Report Automatically with each Program Run

      Once you've taught a program and create Report(s) it is possible to configure CMM-Manager program to automatically save report document each time the program is run. You can save report in the following formats: HTML Microsoft Excel Body-in-White ...
    • Edit Report Header - Image or Text

      It's possible to replace text in the top of Report Header with your own image as shown below. CMM-Manager Report Header From Preferences... CMM-Manager Preferences>Report Choose the Image option and then specify .BMP image as shown here... ...
    • Creating a Dynamic Data Export (DDE) Report

      Dynamic Data Export (DDE) is a powerful tool that allows you to control the export of report data to Microsoft Excel. For each type of report, the DDE dialog displays a grid similar to that report type and allows you to specify which report cells are ...