NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling VBAI from TestStand using .NET Adapter

Solved!
Go to solution

Hello,

Does anyone have a working example of calling VBAI inspections from TestStand via the .NET Adapter?  Is this possible?  I know there are LabView VIs available, but I'd rather use .Net.  My example sequence here causes an unknown error on the Open Inspection step (yes I do have an inspection located on C:\ and I have tried various combinations of file path escape characters like \\ and \\\\).  The other steps do not cause errors but obviously do not return valid data since the inspection is not open.  Performing these same steps using the LabView VIs works just fine.

 

Here's the error I get:

An exception occurred inside the call to .NET member 'OpenInspection':
NationalInstruments.VBAI.VBAIException: Vision Builder AI: (Hex 0xFFFA9662) An unknown error occurred
at NationalInstruments.VBAI.Internal.ExceptionBuilder.VBAIError(Error error)
at NationalInstruments.VBAI.VBAIEngine.OpenInspection(String path)

 

Any ideas?  I provided a sample sequence file and a screenshot.

 

Thanks.

Download All
0 Kudos
Message 1 of 5
(4,425 Views)

Hello Drojas,

 

Do you have the ability to run the .NET examples in another program like Visual Studio to verify their functionality?

 

What versions of TestStand and VBAI are you using?

 

I am able to reproduce your issue on my system.  I'll continue looking into this from my end. 

 

Regards.

 

0 Kudos
Message 2 of 5
(4,392 Views)

ChristophersonJ,

 

I am using TestStand 2014 (32-bit) and VBAI 2014 (32-bit)  (64-bit is out of the question right now since the sequence will eventually need to call other dlls that were not designed for 64-bit).

 

As for running .Net examples, yes, the provided .Net examples from Vision Builder (in the C:\ProgramFiles (x86)/National Instruments/Vision Builder AI 2014/API Examples/dotNET Examples folder) run just fine and reviewing the code from those is how I recreated the steps in TestStand.  Everything from creating the object and launching the engine, to providing the OpenInspection() method the path parameter to running the inspection once...etc.

 

I hope you find something that I am overlooking.

 

Thanks.

0 Kudos
Message 3 of 5
(4,387 Views)
Solution
Accepted by topic author drojas

I'm not very familiar with TestStand, but when I replaced the variable for the path with a constant "c:\\test.vbai" it worked for me. Not sure how TestStand passes around those string variables, but using a constant worked. After I loaded the inspection, I got an error when it tried to get the measurements at the end. I'm not sure how to correctly pass the dotNET structure in TestStand, but in Visual Studio, it just works with a simple call like this:

InspectionMeasurements[] data = engine.GetInspectionMeasurements(null, out timeStamp);

 

Maybe someone more familiar with Test Stand can explain how to pass a string to a dotNET call using a variable from TestStand.

Hope this helps,

Brad

Message 4 of 5
(4,374 Views)

Brad,

I don't know why this works, but indeed, once I hard coded the path instead of using a variable, it worked.  I don't like it, but it works.  So now I'm going to tackle the error in the InspectionMeasurements because I am passing it the correct structure.  It seems the problem points all the way down into the numArrayData[].  Maybe TestStand has limitations of populating arrays inside a container inside an array of structs....or something like that.

 

Thanks again.

0 Kudos
Message 5 of 5
(4,358 Views)