NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

To pass parameter values to the object reference of action step in sequence file of teststand programatically using C#.

//Initialize the Engine

            EngineClass myEngine = new EngineClass();

            myEngine.LoadTypePaletteFilesEx(TypeConflictHandlerTypes.ConflictHandler_Prompt, 0);

           

            Step myStep = myEngine.NewStep(AdapterKeyNames.DotNetAdapterKeyname,StepTypes.StepType_Action);

            myStep.Name = "object";

 

            DotNetModule dotnetmodule = myStep.Module as DotNetModule;

            dotnetmodule.SetAssembly(DotNetModuleAssemblyLocations.DotNetModule_AssemblyLocation_File,@"C:sequence.dll");

            dotnetmodule.ClassName = "CN";

            dotnetmodule.MemberType = DotNetModuleMemberTypes.DotNetMember_GetProperty;

            dotnetmodule.MemberName = "ISI";  

 

mySequence.Locals.NewSubProperty("object", PropertyValueTypes.PropValType_Reference, false, "", 0);        

Sequence mySequence = myEngine.NewSequence();

            mySequence.Locals.NewSubProperty(varName, PropertyValueTypes.PropValType_Reference, false, String.Empty, 0);

mySequence.InsertStep(myStep, 0, StepGroups.StepGroup_Main);

            SequenceFile seqFile = myEngine.NewSequenceFile();

            seqFile.InsertSequence(mySequence);

seqFile.Save("C:\\mySeq.seq");

 

 

 

I have done this,dynamically creating a sequence file in teststand programatically through c#.

 

Problem is

1.I created an action step and object Reference variable for the step, but i am not able to pass  parameter values to the objectReference 

 

2.I am not able to load the sequence in to the main Sequence of the sequence file in the teststand. How can I do these two things.

0 Kudos
Message 1 of 4
(3,589 Views)

Hi

 

I refer my comments to this thread

http://forums.ni.com/ni/board/message?board.id=330&message.id=27047&jump=true

 

juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 4
(3,572 Views)
I created the object reference variable programatically for action step through c# in teststand sequence file. but i am not able to pass the parameter values to the object reference.How can I do that?
0 Kudos
Message 3 of 4
(3,564 Views)

Hi,

 

have you ever followed on my Links ?!?!?

 

If not please jump to this one

http://forums.ni.com/ni/board/message?board.id=330&thread.id=26880 

and read the the answer from Mannoch

starting with this words:

Anthony -

 

Currently, functionality for retrieving the Metadata Token for a class constructor or member is not fully provided in the TestStand .NET Adapter API. The DotNetModule.GetConstructorMetadataToken() and DotNetModule.GetMetadataToken() methods only return the correct Metadata Token when the member/constructor prototypes have already been loaded. Thus, in the case of your code, when you call DotNetModule.GetMetadataToken(), the method is returning -1 because the member prototype for the Step you are referring to has not yet been loaded.

 

 

That means have to do a workaround for your stuff.

 

 

Juergen

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 4
(3,561 Views)