GetSelectedAnnulusFromViewer Method

NI Vision for Visual Basic

GetSelectedAnnulusFromViewer Method

Syntax

CWMachineVision.GetSelectedAnnulusFromViewer Viewer, Annulus [, Index]

Return Type

Long

On success, this method returns 0. On failure, this function returns a negative number.

Purpose

Returns a copy of the annulus at the specified index from the region of interest on the viewer.

Remarks

If a different shape is at the specified index, or the specified index is invalid, this method raises an error.

Parameters

Viewer As CWIMAQViewer

The viewer that contains the region of interest from which you want to get the annulus.

Annulus As CWIMAQAnnulus

On return, this parameter contains a copy of the annulus that is selected on the viewer.

Index As Variant

[Optional] The index of the Region in the CWIMAQViewer.Regions collection. Set this parameter to the appropriate index when the viewer contains multiple regions of interest.

Example

Private Sub Run_Click()
    'Input objects
    Dim SearchAnnulus As New CWIMAQAnnulus
    Dim Options As New CWMVCommonEdgeOptions
    Dim Transformation As New CWMVCoordinateTransformation
    
    'Output objects
    Dim Report As New CWMVFindConcentricEdgeReport
    
    'Get the currently selected annulus from the viewer
    CWMachineVision1.GetSelectedAnnulusFromViewer CWIMAQViewer1, SearchAnnulus
                                                           
    ' Find objects on the Viewer image in the selected rectangle
    CWMachineVision1.FindConcentricEdge CWIMAQViewer1.Image, SearchAnnulus, _
                                        cwimaqScanCounterClockwise, Report, Options, Transformation
End Sub

See Also

SetupViewerForAnnulusSelection

CWIMAQViewer.Regions

CWIMAQRegion.Shape

FindConcentricEdge