NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

InsertStep API Call

Solved!
Go to solution

I'am trying to create a testsequence with CVI wjith the following code:

#include "c:\Appl\National Instruments\TestStand 4.2.1\API\CVI\tsapicvi.h"
CAObjHandle TSEngine;
 CAObjHandle SequenceFile;
 CAObjHandle MainSequence;
 CAObjHandle Step;
 int status;
 int main(void) {
   status = TS_NewEngine ("", &TSEngine);
 
  status = TS_EngineNewSeqFile (TSEngine, NULL, &SequenceFile);  
   
  status = TS_SeqFileGetSequenceByName (SequenceFile, NULL, "MainSequence", &MainSequence);
  status = TS_EngineLoadTypePaletteFilesEx (TSEngine, NULL, TS_ConflictHandler_Error, 0);
 
  status = TS_EngineNewStep (TSEngine, NULL, TS_FlexCVIAdapterKeyName, "MyType", &Step);
  status = TS_StepSetName(Step,NULL,"Bla bla bla" ) ;
 
  status = TS_SequenceInsertStep(MainSequence,NULL,Step,0,TS_StepGroup_Main) ;
 
  status = TS_SeqFileSave(SequenceFile,NULL,"C:\\newSequence.seq" );
  
 //Release
  status = TS_EngineReleaseSeqFileEx (TSEngine, NULL, SequenceFile, 0, NULL);
 }

 

That createst a new sequence with one Step called as expected ,"Bla bla bla". The problem is that the Steptype "MyType" includes a default module setup but the created step has an empty module setup. I would have expected that the new step gets its modules setup from the step type template.   What I'am missing here ? 

0 Kudos
Message 1 of 6
(3,588 Views)

Hi Markus,

 

You need a reference to the Module.

And it should be casted to DllModule.

With DllModule-Object you are able to all the stuff you like

 

In this Thead there is an Example who it works with LabViewModule

http://forums.ni.com/t5/NI-TestStand/Create-a-LabVIEW-Step-dynamically/m-p/976702/highlight/true#M25...

 

Regards

 

Juergen

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

What happens when you insert a new step with your type in a sequence using the sequence editor? Does it have an empty module? Perhaps something is not configured correctly on the step type. Are you using an OnNewStep substep?

 

-Doug

0 Kudos
Message 3 of 6
(3,571 Views)

Inserting a step of type "MyType" within the sequence editor works fine. It inherits the the module setup.  

0 Kudos
Message 4 of 6
(3,562 Views)

Hi,

 

It seems that I have missunderstood, Sorry.

 

I remembered that i had the same problem.

It was caused that on the maschine the StepType was not present at all.

because it was inside a Models' SequenceFile and when start editor it was loaded.

In your code you are creating a new Engine Object and SequenceFile.

so take sure that your StepType is inside the Maschine Type Palettes.

or call Engine.GetTypeNames() to check if your TypeName is present.

 

Hope this helps

 

Juergen 

 

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 6
(3,557 Views)
Solution
Accepted by topic author mkossmann

I see what the problem is. You should be passing an empty string for the adapter key name parameter to your call to Engine.NewStep. According to the API help for Engine.NewStep for that parameter: "Pass an empty string to use the adapter the step type designates..."

 

Hope this helps,

-Doug

Message 6 of 6
(3,543 Views)