07-02-2008 06:46 AM
Hi Ravinder,
i will check it later, i have no Python now.
Mike
07-02-2008 07:00 AM
07-02-2008 07:43 AM
Some how I feel like I am doing you an injustice by responding but...
If you wrote VIs that accessed the cluster elelments you are after, you could call those from Python and let them do the dirty work.
Ben
07-02-2008 08:02 AM
08-08-2008 11:44 AM
08-14-2008 04:09 PM
Hi Robert,
Thank you for your reply. I was able to read/write complete cluster in a perticular order. But my wish is to access any given member of a cluster. I think it is not possible. So, I left that method.
Thank you,
Ravinder
08-14-2008 05:17 PM
Hi Ravinder
The elements in a cluster have a default order which you can observe by right clicking on the cluster and select "Reorder controls in cluster...."
Here you can set any order you wish, or just observe the naturel order which is the order the controls were originally added to the cluster.
the Python call to get control value returns a tuple with the elements in the same order. If an element is an array or cluster then that element is retrned as a tuple.
For my test case I have a cluster with a numeric value, an boolean, an array, and another cluster with a string and slider.
def cTest(self): #This is a class method. The class initializer gets the reference to the vi
tcState = list(self.VI.getcontrolvalue('TC')) # Pick up the tuple and change it to a list
tcState[0] = tcState[0] + 0.5 # increment numeric value
if(tcState[2][3]): # Check the state of the boolean array and...
tcState[1] = True # Turn on the button if the item is on.
sub = list(tcState[3]) # Convert the internal cluster tuple to a list
sub[0] = "New text" # Change the text element
sub[1] = 4.32 # and the slider.
tcState[3] = sub # replace the original sub clusters' tuple
self.VI.setcontrolvalue('TC',tcState) # and send the new value back to the VI!
Python is looking like a great way to add scripting and automated testing no changes to the underlying VI.
Hope this helps.
Robert
08-18-2008 10:28 AM
Hi Robert,
Yah.....It looks very easy. Thank you...Once we get tuple to list we can play round it.....I'm using python and LabVIEW together to automate the test system. I think python and LV combination helps greately to automate test systems.
Thanks..
Ravinder
07-18-2014 01:36 AM
R u trying to interface Labview VI and Python or exe built from Labview and Python?
07-18-2014 01:50 AM