04-19-2021 04:48 PM - edited 04-19-2021 04:49 PM
Hi,
Could you help please on how to create an array of different Custom Data Types?
I have created already 2 different Custom Data Types in TestStand.
Now I need to create an array of different Custom Data Types, so for exaple:
MyArrayOfDifferentDatatypes[0][0] = MyPoint1
MyArrayOfDifferentDatatypes[1][0] = MyPoint1
MyArrayOfDifferentDatatypes[0[1] = MyPoint2
MyArrayOfDifferentDatatypes[1[1] = MyPoint2
The thing why I need to create something like this is because I have a big #DEFINE list in C that I'm trying to simulate in TestStand using Custom Data Types. I need to use these "DEFINES" over all the Sequence so I if for any reason any DEFINE value changes I will have only to modify the Custom Data Types so changes will be reflected over all the Sequence.
Or of you know a way on how to simulate a C DEFINE list in TestStand let me know.
I'm using TestStand 2016 SP1
Thanks for the help.
Solved! Go to Solution.
04-20-2021 03:15 PM
I'm not exactly sure what you mean by simulate C define, but I've attached a sequence that illustrates different ways to make a single array that contains different custom data types.
04-20-2021 03:39 PM
@James,
Thanks for your reply!
I have a code in C that I'm trying to port into teststand, the current code I have have several functions that uses several of the already defined values in the .h file in the C project.
example:
#define POINT1 "12345"
...
...
#define POINT300 "54565"
I need to use these #define values in all my C code functions and since I will call these functions from testand I would need to pass these values to the C function, but since teststand do not know the value of the actual #define I need to pass the #define value "12345" instead the #define (POINT1) itself, also I have decided to use CustomDataType to stay away from global variables in testand.
Thanks for your help. the sequence worked.
PS if you have a better way to do this please share it.
04-20-2021 04:48 PM - edited 04-20-2021 04:50 PM
TestStand definitely doesn't have C-like macros or header files.
If you were strictly using numeric values instead of strings, defining an enumeration type might be an option.
Instead of creating a datatype per constant, you could instead provide multiple constants with a single datatype by making a type based on Container, maybe call it MyPoints, and adding sub-fields in the container type for each constant, such as Point1 and Point2. You will still need to instantiate a variable of that type somewhere to be able to reference your 'constants', but you only have to add a single variable of that type to make all its fields available to expressions in your sequence.
In the type editor, you could go to Properties>>Advanced>>Flags>>Type Flags>>Instance Default Flags and checkmark PropFlags_NotEditable on each field to make the fields seem a little more 'constant', but they will still be possible to assign to programmatically.