LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get connector pane names programatically with ActiveX?

I am learning how to use LabVIEW's ActiveX automation to call LabVIEW VIs from Python. 

The following code works as expected (the comments are a little too verbose, but they help):

# Example: calling LabVIEW from Python

# grab the LabVIEW ActiveX interface
# generated with the Python COM Makepy utility
import labview_pycom

# grab a handle to the LabVIEW 8 application
lv = labview_pycom.Application()

# open up a VI -- path, password, reserve handle (t/f)
vi = lv.GetVIReference(r"C:\Test VIs\Hex Adder.vi", "", True)

# call the VI with named parameters and corresponding values
#
# pass ALL parameters here -- input and output;
# - output parameter values are don't cares
# - will return names of all passed parameters and values
returns = vi.Call(["String", "String 2", "Sum", "hex Sum"], ["1", "2", 0, ""])

print returns


My Hex Adder.vi takes two strings "String" and "String 2", parses them into integers, and adds them.  It outputs an integer, "Sum", and the sum as a string, "hex Sum".

Output:

((u'String', u'String 2', u'Sum', u'hex Sum'), (u'1', u'2', 3, u'00000003'))


I explicitly pass names of items on the connector pane in vi.call( ... ), and that's OK in this application.  I want to know, though, what names and values I could pass, without dissecting the connector pane in LabVIEW.

Is it possible to ask LabVIEW, through a function call, the names of all the front panel controls or items on the connector pane? 
The GetControlValue(...) and SetControlValue(...) take named parameters -- but I want a list of the names they can take.

Thanks!

Matthew Ploguh
0 Kudos
Message 1 of 5
(3,160 Views)
I am not sure if the ActiveX server exposes a method to get a VI's controls.

Why don't you just write a VI that uses "Open VI Reference" and the VI server properties to enumerate the controls on the VI? You can then call this VI from python to get the parameters of the VI that you really want to call.

Pramod


Message Edited by PramodS on 02-14-2008 05:30 AM
0 Kudos
Message 2 of 5
(3,146 Views)
Thanks!  Sounds like a reasonably easy workaround without any drawbacks.
0 Kudos
Message 3 of 5
(3,126 Views)

Hi, Am working to get all the control and indicators names from a VI which am calling in my .net c# code. I am using interop.LabVIEW. dll. It doesn't expose any method to get the control names in the VI.Also i want to get the connector pane information in my c# code. I am following this link. https://forums.ni.com/t5/Example-Programs/Running-or-Calling-a-VI-using-the-LabVIEW-ActiveX-Automati...

I came across this topic, So, is there any workable solution on this?

0 Kudos
Message 4 of 5
(2,192 Views)

Probably not beyond the solution already proposed earlier in the thread. VI Server was introduced in LabVIEW 5.0 (almost 22 years ago) and had a fairly limited interface at that time. It had three major interface possibilities, the first was the native interface through property nodes, the remote TCP/IP interface and ActiveX. They had about the same feature set back then. After that the internal VI Server interface got extended with every new LabVIEW version and the TCP/IP interface got adapted accordingly as far as the functionality was considered safe for remote access. The ActiveX interface however only got minor updates and never any fundamental extension of functionality, one reason probably being that it was anyhow not a multiplatform technology in LabVIEW. And with the current state of ActiveX and LabVIEW it never will!

ActiveX is a legacy technology even if some of the underlaying COM technology is still used in .Net nowadays.

The future is going to be LabVIEW NXG with its heavily .Net based user layer and most extensibility in there is based on .Net.

So if you want to make this work you have to create a VI with a known name and interface that you can call with the current ActiveX interface and include that in your LabVIEW project and configure the ActiveX interface to allow access to it. Then call that from your external client and bootstrap your own interface based on this.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(2,175 Views)