Determining whether an image is calibrated or not . . .
All --
I'm writing application and am now up to IPP904.
If there is SPATIAL CALIBRATION on the ACTIVE IMAGE, the following returns the UNITS ABBREVIATION for the SPATIAL CALIBRATION
"ActiveX Automation: Object var is 'Nothing'."
via
ThisApplication.ActiveImage.SpatialCalibration.
and everything I've tried seems to generate an error if the image is not calibrated.
I can build upon this error handling concept to have the program handle the NOT CALIBRATED situation but my question is . . . .
Is there a more graceful way to handle sensing whether an image is calibrated?
Thanks.
-- Matt
I'm writing application and am now up to IPP904.
If there is SPATIAL CALIBRATION on the ACTIVE IMAGE, the following returns the UNITS ABBREVIATION for the SPATIAL CALIBRATION
'Learn the abbreviation for the active calibration unit Dim MySpatialCalibrationUnitAbbrev As String MySpatialCalibrationUnitAbbrev = ThisApplication.ActiveImage.SpatialCalibration.UnitAbbrevIf there is not a SPATIAL CALIBRATION on the ACTIVE IMAGE, the previous code returns the following ERROR
"ActiveX Automation: Object var is 'Nothing'."
via
'Set up error handling On Error GoTo MyHandler 'Learn the abbreviation for the active calibration unit Dim MySpatialCalibrationUnitAbbrev As String MySpatialCalibrationUnitAbbrev = ThisApplication.ActiveImage.SpatialCalibration.UnitAbbrev MyHandler: Debug.Print ErrorI've looked at all of the options behind
ThisApplication.ActiveImage.SpatialCalibration.
and everything I've tried seems to generate an error if the image is not calibrated.
I can build upon this error handling concept to have the program handle the NOT CALIBRATED situation but my question is . . . .
Is there a more graceful way to handle sensing whether an image is calibrated?
Thanks.
-- Matt
0
Best Answer
-
The correct syntax would be:
Sub PrintCalibration If ThisApplication.ActiveImage.SpatialCalibration IsNot Nothing Then Debug.Print ThisApplication.ActiveImage.SpatialCalibration.UnitAbbrev End If End Sub
0
Answers
Thank you for your example.
I've changed my code to:
-- Matt
-- Matt