NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically creating a SequenceCall step and setting the arguments/parameters with TestStand API

Solved!
Go to solution

I am using Python to translate a program code of an automated test to a teststand 2017 sequence. I need to set  function parameters and don't know how.

This is what I do to create the step and set name and use current file property. It works so far, but when I open the generated sequence file there is a red exclamation mark stating that the arguments do not match the parameters of the sequence to be called.

 

If i use step.Module.UsePrototype = True then the exclamation mark is gone, but the Use prototype checkbox in the generated step is UNchecked.

 

This is an extract from my code. 

 

step = engine.NewStep("Sequence Adapter","SequenceCall")
step.Name = (step.StepType.Name) +" "+ str(index)
step.Module.UseCurFile = True
step.Module.SeqName = sub_seq.name

step.Module.UsePrototype = True

#ToDo: Set Parameters "Var1" to 10
MainSEQref.InsertStep(step,index, stepGroup["StepGroup_Main"])

 

Can anyone help please? I assume I have to do something with the step.Module.ActualArgs Property but I am stuck for two weeks at this problem now and I have tried almost everything. Thanks!

0 Kudos
Message 1 of 3
(178 Views)

SequenceCallModule

Use objects from the SequenceCallModule class to specify and obtain Sequence Adapter-specific information about the code module that steps or step type substeps execute. Use the Step.Module property to obtain a reference to a SequenceCallModule object. To access the properties and methods of a specific module class, query the Module object for the interface of the module-specific interface you want to acquire.

Typically, you use this class only when you are writing a sequence editor.

To access the properties and methods of the Module class, use the AsModule method to obtain an object.

You can use the Module.LoadPrototype method to load the prototype for the module that the step specifies.

 

 

SequenceCallParameters

Use objects from the SequenceCallParameters class to configure and obtain parameters for a module that uses the Sequence Adapter.

Use the SequenceCallModule.Parameters property to obtain the collection of parameters for a module.

Properties

Count (Read Only)
Item (Read Only)

 

0 Kudos
Message 2 of 3
(169 Views)
Solution
Accepted by topic author Chris_KL

Hi ee-jallen,

 

thanks for your reply. I think it is always easier to have an example, that's why I am absolutely confused why the Teststand examples only do half of the job (missing out the parameter handover). The API documentation is more than confusing.

 

So after posting my request I managed to find the solution myself.

 

#"Info: step" is the SequenceCall step to sub_seq.

#Note: Just step.Module.LoadPrototype() does not work, as it does not find the variables afterwards.

 

step.Module.LoadPrototypeFromSequence (sub_seq,1)

variables = step.Module.ActualArgs
var1_handle = variable.GetPropertyObject("Var1",0)
var1_handle.Expr = "20"

 

Kind regards, Chris

0 Kudos
Message 3 of 3
(142 Views)