08-28-2020 03:02 AM
Hello everybody,
is it possible to get all the step types used by a sequence already in the PreUUTLoop?
Thanks for your help.
Solved! Go to Solution.
09-02-2020 08:43 PM
Pointing on your client sequence you should be able to get the Sequence file path.
Then you can open the file and iterate through all steps in the sequence. For each step you can get their type.
If you find a sequence, you'll have to dive into it or open the file it points to.
A recursive algorithm can make this process generic.
However if a sequence call is evaluated at runtime using variables you'll be screwed.
09-03-2020 03:29 AM
So if my sequence files grow a bit larger, it will take a while to go through all the steps.
Maybe i could save the result in a file global, so i don´t have to do it twice. Additional i could check if the file version have changed til the last go throug, so i could update the result if necessary.
Ok thanks for your advice. I hoped that there is something already implemented, but OK. 🙂
09-03-2020 05:33 AM
If there is something implemented already, I don't know it. But it doesn't mean that it doesn't exist ! 🙂
Be careful with file globals, they are not persistent when modified at run time. You must specifically write them into your sequence file and then save this one ! This is a little bit tricky.
But I wonder why you need to know the step types at run time. Could you share more insights about your needs?
On the other end, thinking more about it, every type is stored within the sequence file (you can see that in the Types view). But I don't know how the Editor lists them. There might be, maybe, an entry somewhere in the sequence file that summarizes them all. Otherwise it means that the Editor does the exploration as I wrote it in my previous post. In any case, I would search from the sequence file object.
09-03-2020 07:35 AM
Ah thats a good hint about the file globals.
I tried to specifie which hardware is needed to run this sequence file. So on the different step types i could differentitate the needed hardware.
In the TestSTand API is the GetTypes method, but i don´t get it to work for the loaded sequence. I always get all types and not only the used ones.
09-03-2020 08:32 AM
If you can get a reference to the file, .AsPropertyObjectFile.TypeUsageList should give you all of the types in the file.
As for the fileglobals topic, PropertyObject Attributes like a sequence file attribute would be another place you could store this kind of data: https://zone.ni.com/reference/en-XX/help/370052AA-01/tsref/infotopics/db_edit_param_attributes/
Hope this helps!
Trent
09-06-2020 11:47 PM
Ok, the TypeUsagList seems to work. To get the name of the type i have to go throug the list with TypeUsageList.GetTypeDefinition(i).Name or is there a better way?
I created the attributes in edit -> Sequence File Proberties -> Advanced -> Attributes. But how could i edit them during runtime in the DoPreUUT? And is it possible to create them during runtime?
Thanks for your help.
09-08-2020 07:54 AM
Ok, i found a way to set the attributes during runtime in the DoPreUUT:
RunState.ProcessModelClient.AsPropertyObjectFile.AsSequenceFile.Data.Attributes.SetValBoolean(LookUpString,1,True)
and with Option = 1 you are able to create them.
Thank you all for your help.