GetSelectedLineFromViewer Method
Syntax
CWMachineVision.GetSelectedLineFromViewer Viewer, Line [, Index]
Return Type
On success, this method returns 0. On failure, this function returns a negative number.
Purpose
Returns a copy of the line 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 line.
Line As CWIMAQLine
On return, this parameter contains a copy of the line 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() 'Inputs to LightMeterLine Dim SearchArea As New CWIMAQLine Dim Transformation As New CWMVCoordinateTransformation 'Outputs of LightMeterLine Dim Report As New CWMVLightMeterLineReport 'Get the line from the viewer. CWMachineVision1.GetSelectedLineFromViewer CWIMAQViewer1, SearchArea 'Measure the intensity inside the search region CWMachineVision1.LightMeterLine CWIMAQViewer1.Image, SearchArea, Report, , Transformation 'Display the mean intensity in a text box Text1.Text = Report.MeanIntensity End Sub