NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain process model name in CVI

How can I get the name of the process model in CVI?

The process model is switched between sequential and batch model and need to obtain the name of the currently used process model.

 

In the fiunction

CVIVALLBACK ApplicationMgr_OnStartExecution(

CAObjHandle caServerObjHandle, void* caCallBackData, TSUIObj_Execution execution, TSUIObj_Thread thread, VBOOL initiallyHidden)

{

CAObjHandle processModelSeqFileName;
char *processModelName = {0};

tsErrChk( TS_ExecutionGetModelSequenceFile (gMainWindow.engine, &errorInfo, &processModelSeqFileName));
tsErrChk( TS_SequenceGetName (processModelSeqFileName, &errorInfo, &processModelName));

........

 

if(processModelSeqFileName)
CA_DiscardObjHandle(processModelSeqFileName);
CA_FreeMemory(processModelName);

}

 

The function TS_ExecutionGetModelSequenceFile () returns "No such interface supported"?

TIA.

*************************************************
CLD
*************************************************
0 Kudos
Message 1 of 6
(3,185 Views)

TS_ExecutionGetModelSequenceFile is a function on the Execution class as denotes by the TS_Execution prefix. Its first parameter must be an execution, not the engine.  

 

The TS_SequenceGetName call has a similar issue.

0 Kudos
Message 2 of 6
(3,181 Views)

Yes I did test using Execution and still the same error is returned.

*************************************************
CLD
*************************************************
0 Kudos
Message 3 of 6
(3,177 Views)

James,

 

Here is how the function looked like:
tsErrChk( TS_ExecutionGetModelSequenceFile (execution, &errorInfo, &processModelSeqFileName));


But execution is of TSUIObj_Execution execution, beleive it should not matter, correct?

 

*************************************************
CLD
*************************************************
0 Kudos
Message 4 of 6
(3,174 Views)

Here are the changes made that got rid of the error but still does not get the process model path. processModelName in TS_SeqFileGetModelSeqFile returns "none" always and SeqFileObject is zero, any ideas?

 

if(execution)
{

tsErrChk( TS_ExecutionGetModelSequenceFile (execution, &errorInfo, &processModelSeqFileHdl));
if( processModelSeqFileHdl )
{
tsErrChk( TS_SeqFileGetModelSeqFile (processModelSeqFileHdl, &errorInfo, &processModelName, &SeqFileObject ));
if( SeqFileObject )
tsErrChk( TS_SeqFileGetModelPath (SeqFileObject, &errorInfo, &processModelPath));
}
}

*************************************************
CLD
*************************************************
0 Kudos
Message 5 of 6
(3,160 Views)

Hello lvrat,

 

You could use SequenceFile.GetModelAbsolutePath. Once you have the path, you could just parse the name from the last position of the string.

 

Regards,

 

Jeff L.

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