NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a SequenceCall step

Hi All,

I am trying to programatically insert a step of type "SequenceCall". How exactly do I populate the parameters for the call using the TS API. Following is an XML representation of an ActualArgs property with 1 param that I got using the GetXML method. How do I add parameters to the ActualArgs property? The Type for "Param1" is "Obj", but no such type that can be be passed to the NewPropertyObject method.

<Prop Name='ActualArgs' Type='Arguments' Flags='0x200000'>
    <Prop Name='Param1' Type='Obj' TypeName='SequenceArgument' Flags='0x0'>
        <Prop Name='UseDef' Type='Boolean' Flags='0x0'>

        <Prop Name='Expr' Type='String' TypeName='Expression' Flags='0x0'>
        <Prop Name='ParamType' Type='Number' Flags='0x0'>
        <Prop Name='UserData' Type='Obj' Flags='0x200000'>
    </Prop>

Thanks,
Harsha
0 Kudos
Message 1 of 4
(3,301 Views)
I made some progress here. When create a new property of type "PropValType_NamedType" and pass the name as "SequenceArgument", the function automatically creates the entire argument structure. I feel the API documentation in TestStand should mention these features, I stumbled upon this by trial and error.

Anyway looks like my problem is nearly solved.

Thanks,
Harsha
0 Kudos
Message 2 of 4
(3,298 Views)
Hey Harsha,

Usually the way you would load parameters with the TestStand API is to use the LoadParameters method or the LoadParametersFromSequence method for that specific SequenceCallModule. Once you have loaded the parameters you can access them via the Parameters property of the SequenceCallModule. Take note that you must call one of these LoadParameter functions before accessing the Parameters property. I would recommend taking a look at the help for SequenceCallModule, SequenceCallParameters, and SequenceCallParameter.  I have also posted some C# code below that should give a general idea of how to create a new step, set some of the properties for the sequencecallmodule, and set up the parameters to use their default values.  Hope this helps!

                //Create new step of type SequenceCall and set Name
                Step myStep = myEngine.NewStep(AdapterKeyNames.SequenceAdapterKeyName,
                                            StepTypes.StepType_SequenceCall);
                myStep.Name = "MySequenceCall";

                //Obtain the code module from the step
                SequenceCallModule myModule = myStep.Module as SequenceCallModule;

                //Set properties of the module
                myModule.SequenceFilePath = "C:\test.seq";
                myModule.SequenceName = "MainSequence";
                myModule.UseSequenceParameterPrototype = false;
                myModule.LoadParameters(false, "C:\test.seq", "MainSequence");
                       
                //Loop through and set each parameter to use default value           
                foreach(SequenceCallParameter myParam in myModule.Parameters)           
                {               
                    myParam.UseDefaultValue = true;
                }
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 3 of 4
(3,278 Views)
Pat,

This way works great! I have eliminated a lot of unnecessary code. Thank you!

Harsga
0 Kudos
Message 4 of 4
(3,270 Views)