DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnPropSet from GPI-Dll

Hey!
 
I think this would have been asked before, but I could not find the answer.. so..
 
I am creating a Waveform-Channel from a GPI-dll. Transferring the data works fine, but now I am stuck at the offset and increment parameters which I cannot set. Following some examples here, I have created the following code:
 

#import

"DIAdem.tlb" no_namespace

::CoInitialize(NULL);

ITOCommandPtr pITOCommandT;

pITOCommandT.CreateInstance(

"DIAdem.ToCommand");

pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet(10, \"wf_start_offset\", 1.734)"));

::CoUninitialize();

 

Actually, the 10 as a channel number is hardcoded here, in the program, I am getting it when creating the channel, via

hDataObjTData = hDataObjChannelGet( szDataObjNameT,f_size_,1,1);

int chn = hDataObjTData;

And then chn contains the channel number. Don't know if that is the way to go, but it's the only solution I have found quickly..

Anyhow, the CmdExecuteSync-call always fails. I have tried it with call, without call, " and ' as quotation marks, and also with and without brackets.

What have I missed, how does it work?

Many thx!!

0 Kudos
Message 1 of 4
(3,366 Views)

Actually, after trying this

//pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet(10, \"wf_start_offset\", 1.734)"));

//pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet 10, \"wf_start_offset\", 1.734"));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet(10, \"wf_start_offset\", 1.734)"));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10, \"wf_start_offset\", 1.734"));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 \"wf_start_offset\" 1.734"));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 'wf_start_offset' 1.734"));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet(10, \"wf_start_offset\", 2)"));

//pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet(10, \"wf_start_offset\", \"1.734\")"));

//pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet 10, \"wf_start_offset\", \"1.734\""));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet(10, \"wf_start_offset\", \"1.734\")")); // <- good

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10, \"wf_start_offset\", \"1.734\"")); // <- good

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 \"wf_start_offset\" \"1.734\""));

//pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 'wf_start_offset' '1.734'"));

I found out that the last parameter also needs quotation marks. Did I miss this in the documentation??

I already have a new problem though: how can I tell DIAdem that this is a waveform channel?

This one, it does not like:

_snprintf(temp,

sizeof(temp), "ChnPropSet %i, \"waveform\", \"Yes\"", chn);

pITOCommandT->CmdExecuteSync(_variant_t(temp));

, just like these lines of code

// wf_samples

_snprintf(temp,

sizeof(temp), "ChnPropSet %i, \"wf_samples\", \"%i\"", chn, length);

pITOCommandT->CmdExecuteSync(_variant_t(temp));

// wf_time_pref

_snprintf(temp,

sizeof(temp), "ChnPropSet %i, \"wf_time_pref\", \"relative\"", chn);

So, again, I don't know what to do..

Any ideas?

0 Kudos
Message 2 of 4
(3,360 Views)

Hi diadev,

the channel property "waveform" is read-only.
Check out this command instead (requires DIAdem 10.1 or higher):

ChnWfPropSet(ChnNoStr, WfXName, WfXUnitString, WfStartOffset, WfIncrement)

This command also converts a normal channel to a waveform channel if necessary.

Generally use ChnPropValSet instead of ChnPropSet (requires also DIAdem 10.1) when setting other channel properties:

ChnPropValSet(TargetChn, PropName, PropValue)

The last parameter of ChnPropValSet is a variant, the one of ChnPropSet is always a string.

I hope this helps,
Christian

0 Kudos
Message 3 of 4
(3,356 Views)
Thx a lot!! It did work!
 
All our customers now have to upgrade to 10.1.. but hey..
 
🙂
0 Kudos
Message 4 of 4
(3,343 Views)