Jump to content

Access individual cluster elements through Python


Recommended Posts

Hi....

My project has many(500 to 800) controls and indicators which are spread over many individual vis. I wish to control all these vis from a single (main) vi. I am using "call by reference" technique, which is the best way (I hope !!). To handle these controls easily I'm using clusters. I shall control this main vi from Python. I know how to access each individual LabVIEW control terminal from Python. I kept all these control and indicator terminals in side clusters. Now, I'm able to read and write whole cluster at a time, which is not my requirement. I want to read or write only one cluster element at a given time. I tried a lot but I'm unable to work it out. Pls...help me to solve my problem. I have one more doubt, Instead of keeping all controls and indicators in main vi directly, I'm simply merging into clusters. This merging process (into clusters) takes place in individual vis. Is this step increses/decreses complexity of model ?? We want to keep the code as less complex as possible.

Thank you,

Ravinder

Link to comment

QUOTE (Ravi0709 @ Jul 2 2008, 03:44 AM)

Hi....

My project has many(500 to 800) controls and indicators which are spread over many individual vis. I wish to control all these vis from a single (main) vi. I am using "call by reference" technique, which is the best way (I hope !!). To handle these controls easily I'm using clusters. I shall control this main vi from Python. I know how to access each individual LabVIEW control terminal from Python. I kept all these control and indicator terminals in side clusters. Now, I'm able to read and write whole cluster at a time, which is not my requirement. I want to read or write only one cluster element at a given time. I tried a lot but I'm unable to work it out. Pls...help me to solve my problem. I have one more doubt, Instead of keeping all controls and indicators in main vi directly, I'm simply merging into clusters. This merging process (into clusters) takes place in individual vis. Is this step increses/decreses complexity of model ?? We want to keep the code as less complex as possible.

Thank you,

Ravinder

I presume you access LabVIEW from Python using ActiveX interface. This interface doesn't allow to get/set elements of a cluster directly. However, you can make VIs that wrap VI Server calls to get/set control value using control references and invoke them from Python.

Make a list (array or cluster) of references to all controls of interest (use the Controls[] property to access references to cluster elements). Cast them to U32 ans pass the list to the Python application.

From Python, call the wrappers VI to get/set the controls using the control reference and the value.

I have not tried this method nor ever used Python so consider that suggestion as a pointer to the solution to your problem. I hope that helps.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.