09-02-2015 02:51 PM
Hi,
Here you are.
Extract .zip to your maschine.
A Demo.seq and StepType Dll is implemented.
Please add in SearchDirectories of TestStand the Path to Demo.seq and enable sub directories.
Source code is also included. Just to see how this stuff works with c++.
Regards
Juergen
09-03-2015 06:24 AM
Hi,
If you dont want to use the DLL, then you may try changing the TS properties from TestStand. For example to use newthread or not you can play with the below variable as per the swtich condition,
RunState.Step.TS.SData.ThreadOpt=1 //makes the sequence to rrun in new thread
RunState.Step.TS.SData.ThreadOpt=0 //Makes the sequence call to run within the same thread
Similar way , you can mange to create new execution or Run in remote computer as well by changing TS.Sdata parameters.
But you have to be cautious as these paremeters are internal variables and entering wrong values may create diffrent results.
09-03-2015 07:48 AM
Hi
you are right. BUT: As you have mentioned you accessing the variables in a undocumented way.
So i am just wondering why NI is spending a huge effort in API documentation.
I am always prefering API calls to TS properties, because they are safe.
The expression field supports TS API, so there is no reason why not using the API.
Regards
Juergen
09-03-2015 04:48 PM
Thank you very much! j_dodek, your code seems very useful, my problem is I still do not know how to translate that code to CVI LabWindows. But I am still trying to achieve it.
Ranjith_Naduvil, that way does work, the only problem is, that code is not going to run until the sequence starts.
That should not be a problem, except because in my editing sequence necessarily I need to place Wait to thread steps. And in the configuration of these steps I would need to know which steps were going to Run In A New Thread for select them (not happening now because is until the sequence starts that we know the way to run of the steps).
###################
09-04-2015 12:22 AM - edited 09-04-2015 12:24 AM
Hi,
To find the TS-function it is very important that you add tsadpcvi.fp to your project and #include "tsadpcvi.h"
HRESULT CVIFUNC TS_SequenceCallModuleGetMultithreadingAndRemoteExecOption (CAObjHandle objectHandle,
ERRORINFO *errorInfo,
enum TSEnum_SeqCallMultithreadOptions *propertyValue);
HRESULT CVIFUNC TS_SequenceCallModuleSetMultithreadingAndRemoteExecOption (CAObjHandle objectHandle,
ERRORINFO *errorInfo,
enum TSEnum_SeqCallMultithreadOptions propertyValue);
If this stuff is working i think you should pimp your StepType!
When reading your last message i read that you have to add a wait-step when thread-button is hit.
You have a CustomStepType - So let it do for you!
Regards
Juergen
09-05-2015 02:29 PM - edited 09-05-2015 02:44 PM
It works now!
j_dodek, thanks a lot for your help. Indeed, I was using the function TS_SequenceCallModuleSetMultithreadingAndRemoteExe
My problem was not sending the correct parameter. Instead of sending "Step.Module", I was always sending "ThisContext" or "ThisContext.Step" thinking that would work.
My function at the end was something like:
void ModifyPropertyRunInNewThread(CAObjHandle context) { //Variable to read the state of the switch int StateOfTheSwitch; //Value for errors ERRORINFO errorInfo; //Value from QuitUserInferface int ReturnValue; //Load panel in memory if ((panelHandle = LoadPanelEx (0,"CVI_Example.uir", PANEL, __CVIUserHInst)) < 0 ) { //If there is a error, terminate the function return; } //Show panel in screen DisplayPanel (panelHandle); //Read status of the RunInNewThread property from TestStand TS_SequenceCallModuleGetMultithreadingAndRemoteExecOption( context, &errorInfo, &StateOfTheSwitch ); if(StateOfTheSwitch == 0) SetCtrlVal(panelHandle, PANEL_switchTHREAD, 0); if(StateOfTheSwitch == 1) SetCtrlVal(panelHandle, PANEL_switchTHREAD, 1); //Variable to catch the data return from the RunInterface() ReturnValue = RunUserInterface(); //Data return from the QuitUserInterface if(ReturnValue == 1) { //Read which value are we going to send to the TestStand interface GetCtrlVal(panelHandle, PANEL_switchTHREAD, &StateOfTheSwitch); //Constants for the function //TSConst_SeqCallMultithread_None = 0 //TSConst_SeqCallMultithread_NewThread = 1 //Set the MultithreadingAndRemoteExecOption according to the state of the switch if(StateOfTheSwitch == 0) TS_SequenceCallModuleSetMultithreadingAndRemoteExecOption( context, &errorInfo, 0 ); if(StateOfTheSwitch == 1) TS_SequenceCallModuleSetMultithreadingAndRemoteExecOption( context, &errorInfo, 1 ); } //Close the panel DiscardPanel(panelHandle); }
Attached to this message I include the example I used to probe the function.
09-07-2015 08:46 AM