NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a custom Type from Python output parameter

Hellow

We are currently developing test sequences in TestStand that load DLLs developed in the C language. In order to configure the tests, we load the configuration of the instruments from an external file (JSON). However, each configuration has a different structure, so a Python program is responsible for processing the file to extract these configurations for TestStand. The problem is how to create a custom type based on the structure returned by Python. This needs to be done at runtime, this means  the structure is not known until the sequence is executed.

Thank You.

0 Kudos
Message 1 of 7
(877 Views)

Well…. Typedefinitions are not dynamic…. So they are probably no solution to your problem.

 

Not really knowing how to use the TS API in Python…. You should be able to create PropertyObjects from your code module, e.g. creating containers with containing objects as you desire.

 

yet… how do you want to use this dynamically created data? How does your TS code know how to interpret this dynamically/ arbitrarily composed structures?

0 Kudos
Message 2 of 7
(835 Views)

What is your Python module returning to TestStand?  Strings and Numbers?

If you are returning to strings and numbers to TestStand, you could certainly create a dynamic PropertyObject of Type "Container" using Expression steps.  Then you can add whatever you want to this container (strings and numbers) including the info from the Python module.

0 Kudos
Message 3 of 7
(829 Views)

Hi

Python returns a container. The structure of this container is unkown from teststand util the execution  of my test sequence.

0 Kudos
Message 4 of 7
(795 Views)

@ibtissem_2022 wrote:

Hi

Python returns a container. The structure of this container is unkown from teststand util the execution  of my test sequence.


So.... if you want to baiscally be able to return kinda anything within this container, you should figure out a clever way of telling your TestStand sequence how to handle this anything.

0 Kudos
Message 5 of 7
(772 Views)

Maybe 2 python calls, with the first one returning an enum or string describing the container structure for a 2nd call to use?

0 Kudos
Message 6 of 7
(683 Views)

I have a very similar issue that I am trying to resolve. How were you able to solve this?

 

Thanks

Randy

0 Kudos
Message 7 of 7
(12 Views)