I am trying to use the IAdvancedCmd Interface without success.
I Am trying to use is as ICmd (which is working for me) but I always receive this "TYPE MISMATCH" error
I use the handles offered by TL.Application (cmd and cmd.Advancedcmd)
As example, I receive the error calculating a Block Average
Dim blockAveraged As LMSTestLabAutomation.IBlock2
Dim currentBlockOctave As LMSTestLabAutomation.IBlock2
currentBlockOctave = TL.cmd.BLOCK_OCTAVE(currentBlock)
blockAveraged = TL.cmd.AdvancedCmd.BLOCK_AVERAGE_STATISTICS(AvgParam, AvgType, blockAveraged, currentBlockOctave)
blockLoudness = TL.cmd.AdvancedCmd.BLOCK_LOUDNESS(currentBlockOctave, SoundField)
I think that I'm not doing the proper use of the interface, but can't figure out how...
Thanks in advance
Solved! Go to Solution.
below you can find a small code snippet for the problems.
Indeed the syntax on the command are not correct.
oScalar = tl.cmd.AdvancedCmd.BLOCK_LOUDNESS(oBlock, LMSTestLabAutomation.CONST_EnumSoundField.SoundFieldFree)
Remark1: you must provide an Octave block
Remark2: result is a scalar value
2. Average Statistics:
oBlock = tl.cmd.AdvancedCmd.BLOCK_AVERAGE_STATISTICS(1, LMSTestLabAutomation.CONST_EnumStatisticFunction.StatisticFunctionEnergy_average, oBlock, oBlock)
hopefull this will help you.
Hi bvlassa, Thank you very much for your reply
I tried your proposal without success. Still this "TYPE Mismatch"
I reprogrammed the code in C#, and now I get an error in line wich I was seein just browsing in the object browser: "System.MissingMemberException"
Indeed, you are able to unfold all the functions from TestLabAutomation.Application.cmd
But TestLabAutomation.Application.cmd.cmdAdvanced does not have "children", the Handle is empty
This is what I was seeing from the beginning ...
Now the question is: Is it a mistake of my installation or a bug in the Automation Module???
The TestLabAutomation.CMD.AdvancedCmd is not working in C#, this is a BUG, that you may report through GTAC. This functionality is currently only working on VB.Net.
1. Block_Loudness, this function is also available in the TestLabAutomation.CMD, so you can use it from here.
sc = tl.cmd.BLOCK_LOUDNESS(bl, LMSTestLabAutomation.CONST_EnumSoundField.SoundFieldFree);
2. Block_Average_Statistics, this is not available in LmsTestLabAutomation, so for this we can use the CreateObject method.
In the Automation Documentation Tool you can find function (object) called: Snippet
This object performs the same calculation as the Block_Average_Statistics. Find below small snippet:
bl = (LMSTestLabAutomation.IBlock2)db.GetItem(@"Section1/Octave/Octave 1\/3 Point1"); sf = tl.Factory.CreateEnumerate("LmsHq::DataModelC::BlockStatistics::CEnumStatisticFunction", 1); map = tl.CreateAttributeMap(); map.Add("SourceBlock", bl); //LMSTestLabAutomation.IBlock2 map.Add("PrevAvgBlock", bl); //LMSTestLabAutomation.IBlock2 map.Add("AvgType", sf); //LMSTestLabAutomation.Enumerate map.Add("AvgParam", 1); //real map.Add("AvgTimeConstant", 1); //real bl = (LMSTestLabAutomation.IBlock2)tl.CreateObject("LmsHq::DataModelC::BlockStatistics::CAveragedBlock", map);
Hopefull, this will help,
It works!!!!! And not only this: you helped me to understand how to use the Snippets.
Many doors have been opened to me now, thanks to your help.
Thank you very much!!!