08-04-2016 10:14 AM
I'm trying to use the C# API in order to create a sequence file that can be loaded into TestStand. When I try to create a step, i'm given the error:
Additional information: Step type 'Action' not found in type list
I'm using the following:
class Teststand { Engine engine; SequenceFile file; public Teststand() { engine = new Engine(); } public void new_sequence() { file = engine.NewSequenceFile(); Sequence seq = engine.NewSequence(); seq.Name = "Example"; Step step = engine.NewStep( "None Adapter", "Action" ); step.Name = "Step Test"; save_sequence_file( @"C:\Users\me\Desktop\output.seq" ); } public void save_sequence_file(string file_path) { file.Save(file_path); } } }
I know that I'm not adding the step to the sequence file just yet, but surely that wouldn't be the cause of the issue? Why can't it find the step type? I've tried multiple types and even tried
StepTypes.StepType_Action
Which just gives me the same idea.
I'm very confused as to how to specify the type correctly, can anyone help?
Solved! Go to Solution.
08-04-2016 10:57 AM
Hi adam_,
It is recommended that you add the new Step to the TypeUsageList of the Sequence File it is being inserted into:
class Teststand { Engine engine; SequenceFile file; public Teststand() { engine = new Engine(); engine.LoadTypePaletteFilesEx(TypeConflictHandlerTypes.ConflictHandler_Prompt, 0); } public void new_sequence() { file = engine.NewSequenceFile(); Sequence seq = engine.NewSequence(); seq.Name = "Example"; file.InsertSequenceEx(file.NumSequences, seq); Step step = engine.NewStep("None Adapter", "Action"); step.Name = "Step Test"; file.AsPropertyObjectFile().TypeUsageList.AddUsedTypes(step.AsPropertyObject()); seq.InsertStep(step, 0, StepGroups.StepGroup_Main); save_sequence_file(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\output.seq"); } public void save_sequence_file(string file_path) { file.Save(file_path); } } }
Here are the things that I have added to your code:
Regards,
Jeff
08-05-2016 02:43 AM
Thanks for your detailed response! I've now managed to get it working however with some slight changes. I thought it'd be worth posting what I changed in case another forum user has the same issue. With the code provided the step wasn't being inserted, however after looking through the example code provided in the TestStand installation folder I found that you need to insert your step into 'MainSequence' like so:
file = engine.NewSequenceFile(); Sequence seq = file.GetSequenceByName("MainSequence");
Thanks again for your help!