From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

c# insert sequence

Hey,

 

I'm trying to create a c# program that will create a sequence, insert sequences into that sequence, and then insert steps into those sequences.  So far, I've created the sequence like this:

 

String seqname = "Name001.seq";

String defaultPath = "C:\\Users\\Public\\Desktop\\";

Engine myEng = new Engine();

 

//Create a new sequence file
SequenceFile mySeqFile = myEng.NewSequenceFile();
mySeqFile.Path = defaultPath + seqname;
mySeqFile.AsPropertyObjectFile().WriteFile(WriteFileFormat.WriteFileFormat_Current);

 

This creates a sequence file on my desktop that is named "Name001.seq".  What I want to do is to insert a sequence to this file.  What I tried to do is this:

 

Sequence myseq = myEng.NewSequence();
myseq.Name = "My Sequence";

mySeqFile.InsertSequenceEx(1,myseq);

 

However, when I open up "Name001.seq" it shows a MainSequence sequence that is empty, and nothing else.  Does anyone know what I'm doing wrong?

 

- Mike

 

 

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

Hi Mike,

 

just visit this thread

http://forums.ni.com/t5/NI-TestStand/Insert-SubSequence-Call-Step-using-TS-API/m-p/628857#M17591

 

To insert your sequence into the MainSequence you have to create a SequenceCall step and insert it.

 

// Create

stepSeqCall = engine.NewStep(AdapterKeyNames.SequenceAdapterKeyName, "SequenceCall");

// Paramenter stuff

--> See link

// insert

seqMain.InsertStep(stepSeqCall, nSeq,StepGroups.StepGroup_Main);

 

Regards

 

Juergen

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

Thanks for the help! My issue was that I wasn't saving the file, so the sequence that I inserted wasn't being saved.  I've been able to add sequences and steps to my file, but the issue I'm running into now is populating the parameters of those steps.  From the examples I've seen, normally you'd modify the parameter of a specific step using a SetValString command such as:

 

Step.AsPropertyObject.SetValString( lookupString, options, newValue)

 

However, I'm working with several custom steps that I didn't create myself, and the properties haven't been adjusted based on the parameters they added.  Is there any way of adjusting the parameter values of these steps?

 

- Mike

0 Kudos
Message 3 of 4
(3,424 Views)

Hi Mike,

 

that depends on the custom step type, normally step type stuff is stored in the step object.

Have you ever clicked in editors Variables pane on Step when your step type is selected ?

there you shoud see the your parameters. Maybe there where hidden, Configure->StationOptions->Preferences->ShowHiddenProperties
makes them visible.

 

Hope that helps

 

Juergen

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