NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Decompose and index an object reference of a list/array

Solved!
Go to solution

Using TestStand I am trying to figure out how to decompose and index an object reference to a list/array. My sequence is attached. I have received some guidance from the 3rd party developer and some VB code of what should be done. I am having a problem translating it into TestStand. VB code follows description.

 

I am using .NET to run a 3rd party software using an imaging system and running 3rd party software sequence of tests. In TestStand, my "GetCurrentTests" step, when given an object reference for a specific sequence, returns an object reference of type "object reference(system.collections.generic.list'1[Radiant.Imaging.TSEngine.ICommand]); expected to return a list of tests in the 3rd party sequence. 

 

The next steps "GetCurrentPattern" needs to index through this list in order to get, and subsequently set and show the specific test's display pattern to run the specific test on. The class of this next step is RadiantImaging.TSEngine.ICommand(interface) and returns an object reference(radiantImaging.PatternGenerator.Patterns.Patternbase): a reference to the pattern.

 

What I am confused about is decomposing the return value "object reference(system.collections.generic.list'1[Radiant.Imaging.TSEngine.ICommand])" in order to provide the ?indexed object reference for "GetCurrent Pattern" step.

 

VB code is below provided to me that demonstrates how it can be done in VB. I am not familar enough with TestStand, .NET and VB to decompose this>

 

Any suggestions or guidance is greatly appreciated.

 

VB Code:

 

Public Class Form1

Private mPG As PatternGenerator.IPatternGenerator

Private WithEvents mTestSequence As TSEngine.TestSequence Private Sub InitializeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InitializeButton.Click

TSEngine.Settings.MeasurementSource = TSEngine.MeasurementSources.Camera

TSEngine.Settings.SaveMeasurementsToDatabase = False

TSEngine.Settings.SaveResultsToDatabase = True

TSEngine.Settings.SerialNumberAllowDuplicates = True

mPG = TSEngine.CurrentPatternGenerator

TSEngine.Initialize(
"C:\PM Calibration 4616197.rdb")

TSEngine.Databasename = "C:\default Alpha_PEK_Date.pts"

TSEngine.InitializeCamera()

End Sub

 Private Sub RunButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunButton.Click

mTestSequence = New TSEngine.TestSequence(1)

Dim result As TSEngine.Tests.ResultEnum

For i As Integer = 0 To mTestSequence.NumberTests

Dim p As PatternGenerator.Patterns.PatternBase

p = mTestSequence.CommandList(i).Pattern

p.PatternGenerator = mPG

mPG.MonitorType = PatternGenerator.Monitor.PrimaryPartial

'p.PatternGenerator.MonitorType = PatternGenerator.Monitor.PrimaryPartial

p.PatternGenerator = mPG

p.Show()

result = mTestSequence.RunSingleTest(i)

Dim results As List(Of TSEngine.IResult) = mTestSequence.CommandList(i).Result

results(i).Name

mTestSequence.CommandList(i).ResultMeasurement.

Next

End Sub

0 Kudos
Message 1 of 5
(4,384 Views)

mobiux,

 

When you acquired this 3rd party code was there any instructions or guidance given on how to implement this in TestStand? Have you tried compiling the VB code into a DLL and just calling that in TestStand to perform you task?

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

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

Steven, thanks for your reply;

 

There was limited documentation provided on there API, but no documentation or guidanace on how to implement in TestStand.

 

I have not tried compiling the VB code into a DLL and call from TestStand. I know the VB code works, the goal is to get it to work in TestStand. This particular portion is a work around attempt for something that is already not working in TestStand. My desire is to implement it into TestStand with as few complications or work arounds as possible.

 

THis particular sequence of steps is necessary not only for driving the pattern for a test, but also for getting the measurements and results of a test, it is my goal to implement soley in TestStand unless it can not be done in TestStand. Is there reason to believe that this can not be accomplished by TestStand?

 

Regards...

0 Kudos
Message 3 of 5
(4,353 Views)

mobiux,

 

It is my understanding you have an open phone service request with us. We're looking into the issue right now of how best to accomplish this. When we come up with a result we'll post back here as well for completeness.

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

0 Kudos
Message 4 of 5
(4,336 Views)
Solution
Accepted by topic author mobiux

Solution from tech support: "I spoke with R&D and they informed me that the data type in question is a Generic class which is not supported with the .NET adapter. You can pass that data type from one code module to another using an Object Reference data type but you can not manipulate Generic classes from within TestStand.

You can find this information in the TestStand Help under NI TestStand Environment Reference Help»TestStand Adapters».NET Adapters».NET Adapter».NET Call Parameters»Unsupported Parameters. The workaround here would be to call a code module that performs that action for you."

 

Edit .NET Call Parameters

Unsupported Parameters

The TestStand .NET Adapter cannot call methods and properties that have jagged arrays as parameters or return types and does not support structs that have jagged array members.

Additionally, the .NET Adapter does not support creating or calling methods on generic classes.

 

My solution was to implement the above in VB.NET since TestStand .NET adaptor does not support generic .NET data types.

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