04-05-2009 05:59 AM
Hi Everybody, I develop an application using VB.NET and VISION. Here is an example of code:
Dim Image As New NationalInstruments.CWIMAQControls.CWIMAQImage Dim line As New NationalInstruments.CWIMAQControls.CWIMAQImage Dim data(,) As Byte Dim ligne As New NationalInstruments.CWIMAQControls.CWIMAQLine
Image.Type = NationalInstruments.CWIMAQControls.CWIMAQImageTypes.cwimaqImageTypeU8 line.Type = NationalInstruments.CWIMAQControls.CWIMAQImageTypes.cwimaqImageTypeU8 line.SetSize(1, 100) Image.SetSize(100, 100) ReDim data(1, 100)
data = line.ImageToArray() ligne.Initialize(1, 1, 1, 100)
AxCWIMAQVision1.SetPixel2(line, New NationalInstruments.CWIMAQControls.CWIMAQPoint, 1) // Ok with this function AxCWIMAQVision1.SetLine2(image, ligne, data) // Exception Thrown here
I understand well that AxCWimaqVision is an active X control and NI supplied a wrapper code of the C++ VISION DLL for DotNet. So we have to pass VARIANT type.
Thanks a lot!! |
Solved! Go to Solution.
04-06-2009 11:01 AM
Hi kikou,
You're using the ImagetoArray function, which creates a 2D array. The array is just an array with one column, so it seems like a 1D array. You will need to bring this down to a 1D array to use it in the SetLine2 function.
04-08-2009 03:07 AM