NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone have example code of using TestStand API in LabView to clone a step

I am looking for a simple example of using the TestStand API in LabView (not VB, not C), to clone a step from a sequence file, and insert that as a step in a new sequence file. I am spending a lot of time in a trial and error and one example would take me a long way!
0 Kudos
Message 1 of 8
(4,966 Views)
Hello Drew,

Here is an example, LV 6.1 TS 2.0. What you need to do is:

1. Get a reference to the step you want to clone as a PropertyObject reference.
2. Clone the step.
3. Clone will return a reference that is of the PropertyObject class. Type cast this to a step reference.
4. Insert this type casted reference into your sequence. I used Sequence.InsertStep, that will insert the step into the sequence called NewSequence in the cleanup group.

Don't forget to make sure that the LV step points to location in which you stored the Clone.vi on your hard drive.

Hope this helps!

Cheers!
Message 2 of 8
(4,968 Views)
This is a good example. I intent use it in my program.
Do you have any examples for scanning existing steps and delete them all?
I would also need to clean up all existing step steps before I start cloning steps that I want to populate the sequence.
0 Kudos
Message 3 of 8
(4,946 Views)
I was told that if you want to clone steps which uses TS API, you need to have a developement license on any computer that runs the program. I was planning to deploy my program on a PC that runs only Run-time engine. Do you know about this license policy?
0 Kudos
Message 4 of 8
(4,944 Views)
Hello,

The deployment license does not allow you to modify any sequences. Cloning steps is modifying a sequence; therefore, it cannot be done with merely the deployment license.

Regards,

Aaron B.
National Instruments
0 Kudos
Message 5 of 8
(4,927 Views)
Thank you Aaron.
What kind of license options are there if I want to use clone but can't afford full development license?
0 Kudos
Message 6 of 8
(4,925 Views)
Hello,

The answer to your question is, no, you cannot clone without the development license; however, there should be ways to accomplish your objectives without cloning. For instance, you can have a step already created and change its properties programmatically. If you need to clone a step many times and do not know the amount until run-time, you could use a looping structure to execute the same step many times and programmatically make changes to it each time (of course you would determine the number of iterations at run-time). Let me know if there are any specific questions I can help you with regarding this idea. Take care and good luck!

Regards,

Aaron B.
National Instruments
0 Kudos
Message 7 of 8
(4,908 Views)

Hi Ryan,

thanks for the example,... it helped a bit.

But now I have a new problem: the step seem to be copied, but when I try to access the module an unknown error occours (17309). I have the feeling that only the step is cloned without any (linked) content. So the new Step will not be executable as long as the Module is not cloned and linked. I tried to play with the clone options to get a real 1-by-1 copy (don't care about the step-ID), but even with Options: "Do not share Properties (0x8000000)", "Required Identical Structure (0x2000)" and "Copy all Flags (0x20000000)" the error occours when trying to access the module of the clone.

 

The attachment: First I tried to generate a new TestStand Sequence by adding new steps and setting all options (parameters are not needed but appeared in Teststand editor when I choose the option: "Use new Execution"). The name of this parameter is Sequence (type = string). What is this parameter good for and why do I need it? An empty string would be enough, but I was not able to fill this parameter from Labview.....

 

Then I thought it would be easier to use a template with one step and just clone this step and change them afterwards (here call different sequences in each new step).

The file: BuildSequenceOfTests_TS_template.vi uses the cloning, while the file BuildSequenceOfTests_TS.vi generates new steps from scratch.

 

Thanks and best regards

M. Schreiner  

 

Download All
0 Kudos
Message 8 of 8
(3,580 Views)