10-17-2012 01:24 AM
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 ?
Solved! Go to Solution.
10-17-2012 04:18 AM
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
Regards
Juergen
10-17-2012 10:08 AM
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
10-17-2012 11:54 PM
Inserting a step of type "MyType" within the sequence editor works fine. It inherits the the module setup.
10-18-2012 12:42 AM
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
10-18-2012 01:00 PM
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