[INTERNAL] Interfacing IDL with LabVIEW
Topic
Although there is no toolkit item in the LabVIEW 8 Development System that provides a direct interface to IDL scripts or programs, there are several indirect ways to implement such an interface. Many of the options are described and demonstrated with examples at Exelis Visual Information Solutions' Code Contribution Library site. This Help Article is posted to provide a short synopsis of those options and provide the links to the examples that will help you build your own interface.
Discussion
There are two kinds of interfaces that can wed IDL and LabVIEW functionality with relatively few levels of indirection. One such interface takes advantage of both languages' implementation of TCP/IP socket protocol. The LabVIEW Development System has toolkit nodes that make it fairly easy in a graphic interface to set up connecting to a local port/socket, reading from that socket a message protocol of your own design, and/or directing an instruments' output to that socket. IDL has a library of TCP/IP functions (SOCKET, FILE_POLL_INPUT) which can implement a corresponding messaging protocol for communicating with the instrument socket. Once the protocol is set, and the few lines of socket connection, listening, transmitting and disconnection code are written, interpreting and visualizing the data IDL-style is ready as soon as the logic for READU/READF and WRITEU/PRINTF is determined.
Examples of the interface via TCP/IP sockets are provided by two applications at Exelis' Code Contribution Library site. The 'LabVIEWgrSocket.pro' example at:
is more rudimentary and probably easier to start with. The "iDAQ.zip" application posted at:
brings the National Instruments' data acquisition server's data stream into an iTools IPLOT window. This second example adds the layer of code complexity of subclassing from IDL's iTools library, while providing in return a much richer GUI for manipulating the visualization of the instreaming data. Both examples are based on an underlying LabVIEWitSocket class library file that you can reuse in your own IDL/LabVIEW socket interface.
The alternative interface option that we recommend is to use the LabVIEW Development System's interface to ActiveX controls. An embeddable IDL ActiveX Control can be made either with IDL's built-in IDLDrawX3 ActiveX Control or with a custom ActiveX control based on a Microsoft COM object made with IDL's COM Export Bridge Technology. See the "IDL Connectivity Bridges" pdf file (located in [IDL_DIR]/help/pdf/ directory), the COM Object sections in its "Exporting from IDL" chapter, for more information on the IDL side of this interface.
The use of an IDL ActiveX control allows you to integrate IDL processing and graphics, even event handling, into a LabVIEW VI virtual instrument program. Exelis' Code Contribution Library has not only two examples of implementation of this interface, but a full PDF tutorial that steps you through the process on both the LabVIEW Development System and the IDL Development Environment. The example that includes the full tutorial is 'LV_IDL_ActiveX_Tutorial.zip' at URL:
The example 'LabVIEW_IDLActiveX.zip ' at:
is for the reader who already knows how to use LabVIEW's 'Import ActiveX Control' tool and how to address IDL methods throught the IDLDrawX3 control. Both examples demonstrate implementation using the IDLDrawX3 control, which is no longer being maintained after IDL 6.4 (documentation on it ended in version 6.3). Note, however, that it is easy to extrapolate from that example to an implementation that involves your own IDL COM Object-based ActiveX control.
The Code Contribution Library may receive more LabVIEW interface examples in the future. Rather than just follow our links above, click on the 'User Community -> Code Library' option in this web page's top-level menu, and type "labview" in the Search box presented there. That should put links to all examples, old and new, on one page. And we certainly encourage you to post on this Code Contribution the instructions and source code for any successful interfaces that you create.