Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

using Vision development module in c#

I am very new to NI products, and recently start using it for my company vision system, I am using a Visual C# 2005 with Vision development module 8.5. Founded that everytime i do something like:
            CWIMAQControlsLib.CWIMAQEdgeCoordinatesReportClass reports = new CWIMAQControlsLib.CWIMAQEdgeCoordinatesReportClass();
            CWIMAQControlsLib.CWIMAQEdgeOptions eo = new CWIMAQControlsLib.CWIMAQEdgeOptions();
            CWIMAQControlsLib.CWIMAQLines lines = new CWIMAQControlsLib.CWIMAQLines();
                    
            eo.SubPixelAccuracy = CWIMAQControlsLib.CWIMAQSubPixelAccuracyValues.cwimaqSubPixelOneTenth;
            axCWIMAQVision1.Rake(m_imgCam2, axCWIMAQViewer2.Regions,
                CWIMAQControlsLib.CWIMAQRakeScanDirections.cwimaqScanLeftToRight, reports, eo,
                CWIMAQControlsLib.CWIMAQEdgeProcesses.cwimaqEdgeProcessFirst, 4, (object)lines);
 
            CWIMAQControlsLib.CWIMAQPoint pt = new CWIMAQControlsLib.CWIMAQPoint();
            pt.Initialize(reports.FirstEdgePoints.Item(i).X, reports.FirstEdgePoints.Item(i).Y);

It will always exit whenever i make a reference to
reports.FirstEdgePoints.Item(i), it will always exit by itself without any error being show out, this happend to almost every collection type, except the overlays. The reports are comfirmed to be valid because the count property is non-zero everytime, and I can use a Overlays.Item(1).DrawConnectedPoints() to draw out the founded edge points. Am I missing something here?

0 Kudos
Message 1 of 2
(3,380 Views)
it is because NI collections are start from 1 instead of zero...
0 Kudos
Message 2 of 2
(3,378 Views)