Jump to content

Calling LabVIEW VI's from Python


Recommended Posts

Hi Ppl,

I'm trying to call LabVIEW VI's from python using the LabVIEW ActiveX or the LabVIEW run time engine ActiveX that can be enabled in Advanced options of application builder.

The problem that I'm facing is: I'm using the VirtualInstrument.Call() method to execute VI's and pass parameters to and from the VI"s. While using this method I'm able to pass arguments to simple controls easily ex. arrays, numerics booleans

However when I tried to pass data to a cluster as in the attachment Data 1 in this form I'm getting errors:

Python code:

...

...

#Parameters

Channel_1=[1,2,3]

Channel_2=[1,2,3]

Data=[Channel_1,Channel_2]

Read="TRUE"

ParameterNames=("Data","Read")

Parameters=[Data,Read]

VIPath="C:\Users\Sathish\Desktop\Calling LabVIEW VIs from Python using LVRTE\Complex Data.vi"

#Get VI Reference

Application._FlagAsMethod("GetVIReference")

VirtualInstrument = Application.GetVIReference(VIPath)

#Open VI front panel in hidden mode

VirtualInstrument._FlagAsMethod("OpenFrontPanel")

VirtualInstrument.OpenFrontPanel(True,3)

#Call VI

print ("Calling LabVIEW VI\n")

VirtualInstrument._FlagAsMethod("Call")

VirtualInstrument.Call(ParameterNames,Parameters)

...

...

...

Error Msg:

VirtualInstrument.Call(ParameterNames,Parameters)

File "<COMObject <unknown>>", line 2, in Call

com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352571), 2)

However the same code works for the second attachment Data 2

What I infer is that Python is not able to differentiate a 2D array data type from a cluster having sub clusters with same number of elements, as in our example a top level cluster having two sub clusters with 3 numeric. Is there any way to solve this problem. How do I explicitly tell python that this is a cluster and not an array ?

Thanks,

Sathish

post-18003-096213900 1281710241_thumb.jp

post-18003-038523500 1281710261_thumb.jp

Edited by lordsathish
Link to comment
  • 2 weeks later...

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.