NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

dot Net source for geting Limits of a step in a sequence file

Please provide dot net source code to get the limits and variables under a particular step object from a sequence file. This is for reading an already existing sequence file.
 
Thanks & Regards,
  Rengith.M
0 Kudos
Message 1 of 2
(3,006 Views)
Hello Rengith,

Below is some example code that should do most of what you would like.  It will of course need to be customized to your needs, and modified to accomplish your specific tasks, but it should be a good starting point for you:

            // Create the engine
            Engine myEngine = new Engine();

            SequenceFile mySeqFile;
            Sequence mySequence;
            Step myStep;
            double lowLimit, highLimit;
            string varName;

            // Get the sequence file in question
            mySeqFile = myEngine.GetSequenceFileEx("C:\\TestSequence.seq", 0, TypeConflictHandlerTypes.ConflictHandler_Prompt);
            // Get the sequence in question
            mySequence = mySeqFile.GetSequenceByName("MainSequence");
            // Get the step in question
            myStep = mySequence.GetStep(2, StepGroups.StepGroup_Main);
            // Get the limits using the lookup string "Limits.Low/High"
            lowLimit = myStep.AsPropertyObject().GetValNumber("Limits.Low", 0);
            highLimit = myStep.AsPropertyObject().GetValNumber("Limits.High", 0);

            // Get the name of the variable you are storing results in, may be different depending on adapter type
            varName = myStep.AsPropertyObject().GetValString("TS.SData.ViCall.Parms[0].ArgVal", 0);

            Console.WriteLine("The low limit is " + Convert.ToString(lowLimit));
            Console.WriteLine("The high limit is " + Convert.ToString(highLimit));
            Console.WriteLine("The property to store the value in is " + varName);
            Console.Read();

            // Release the sequence file
            myEngine.ReleaseSequenceFileEx(mySeqFile, 0);
            // Close the Engine
            myEngine.ShutDown(true);

I would certainly suggest looking through our TestStand API Reference Help, which can be found here, and specifically the document "Using TestStand API Objects", found here.


NickB
National Instruments
Applications Engineering
0 Kudos
Message 2 of 2
(2,988 Views)