NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Get LoopNumIterations from different SequenceContext

Hi there,
 
my problem is that I need to know the LoopNumIterations and LoopIndex from a different SequenceContext. The question is how to get a SequenceContext from a different Sequence or is there a better method to do this?
 
My Operator Interface is written in C# and the ProcessModelPostStep Sequence is sending PostUIMessage(10001,0,"",RunState.CallingStep,True). The Eventhandler of this PostUIMessage in my Operator Interface needs to know if the CallingStep is looping or not and if looping I need to know the loopnumiterations and the loopindex
0 Kudos
Message 1 of 4
(3,271 Views)

Hi,

Within the ProcessModelPostStep, 'RunState.Caller.RunState.Caller.Step.TS.LoopType' will tell you whether the caller step is looping.

If its the Step that is looping then RunState.Caller.Step.TS.LoopType will indicating its loop type.

This is a string property and will contain "NoLooping" as the default.

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(3,264 Views)

No unfortunately not. I mean the looping witch is set in the step property not the from the context menü (TestStand 4.0)

The Information I need is in SequenceContext (RunState).LoopIndex and SequenceContext.LoopNumIterations. The problem is that my evant handler has an other SequenceContext because it is in an other Sequence "ProcessModelPostStep" and not "MainSequence" or somthing like that. I can't use the following pseudocode because the variables loopidx and loopnumit are always 0

int

frameID = 0,loopidx=0,loopnumit=0;

NationalInstruments.TestStand.Interop.API.SequenceContext ctx = niExcecution.ForegroundThread.GetSequenceContext(0, out frameID);

loopidx=ctx.LoopIndex;

loopnumit=ctx.LoopNumIterations;

0 Kudos
Message 3 of 4
(3,262 Views)

Hi,

You dont what to be using the Foreground Thread because thats the thread your OI is running in, You need the back ground thread pointed too by an index value.

The obtaining the SequenceContext of that thread you need to get down to the Step reference to identify whether its looping before obtain the loopindex etc.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 4
(3,256 Views)