lordsathish Posted August 13, 2010 Report Share Posted August 13, 2010 (edited) 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 Edited August 13, 2010 by lordsathish Quote Link to comment
Rob Calhoun Posted August 13, 2010 Report Share Posted August 13, 2010 The data types that can be passed via ActiveX are determined by COM, not by LabView. I'm not sure that there is a way to pass a cluster/struct directly using COM. You might be able to pass it as a variant type. That is the usual catch-all in ActiveX world. See this link. Or just throw a simple-types wrapper around your LabView function. Quote Link to comment
lordsathish Posted August 14, 2010 Author Report Share Posted August 14, 2010 (edited) But I was able pass these data in perl. I was using variant data in perl. But there is no way that I could use a variant data type in python. Edited August 14, 2010 by lordsathish Quote Link to comment
joshxdr Posted August 28, 2010 Report Share Posted August 28, 2010 Would it be possible to build your vi into a DLL and make your python code talk to the DLL? Do you have an application builder license? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.