From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrapping LabVIEW and NI DAQmx libraries for Python.

All,

 

     I've started wrapping the DAQmx and other LabVIEW libraries for python using ctypes. I really like doing some things in python and other in LabVIEW, so I'd like to have the same functionality available for both. I've hosted the tiniest bit of code (mostly just proof of concept) on github. Let me know if anyone else would be interested in this. I'd love some help hashing it out.

 

- Ken

 

http://github.com/erdosmiller/pydaqmx/tree/master

0 Kudos
Message 1 of 12
(10,486 Views)

Hi Ken,

 

Have you tried creating a LabVIEW DLL using Application Builder then calling that from Python?

Stephen Meserve
National Instruments
0 Kudos
Message 2 of 12
(10,453 Views)
I'm not sure what the point of this would be... I'm trying to code a bit of DAQmx setup in Python because the patterns in LabVIEW are painful.
0 Kudos
Message 3 of 12
(10,451 Views)

Hi Ken,

 

Writing a Python wrapper for the NI-DAQmx C API by hand sounds extremely tedious. Have you looked into automated wrapper generation tools such as SWIG? Even writing your own ad-hoc parser for NIDAQmx.h and generating wrappers from that would probably save you a lot of time.

 

Another approach would be to use the NI-DAQmx .NET API from IronPython.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 4 of 12
(10,443 Views)

Brad,

 

The thought had crossed my mind, I've been thinking about doing my own auto-generator. I'll check out the .net api as well.

 

- Ken 

0 Kudos
Message 5 of 12
(10,441 Views)

Hello Ken,

 

I have used python's ctypeslib with small modifications to wrap most of NI's IVI drivers (NI-FGEN, NI-RFSG, NI-RFSA...). When I find the time, I can check how well this technique can be applied to NI-DAQ.

 

Best regards

Martin Gustafsson

0 Kudos
Message 6 of 12
(10,291 Views)
I too started wrapping the NIDAQmx driver, using the ctypes code generator. It is hosted on http://code.google.com/p/pydaqmx/
Message 7 of 12
(10,096 Views)
Thomas, great to see! Keep up the good work!
0 Kudos
Message 8 of 12
(10,080 Views)

Hi Thomas L, thanks for the nice work. 

I'm a little confused how to use pydaqmx you posted on google code.    

Could you be so kind and point to some examples snippets or brief docs ?

 

 

Thanks,

 

lmk@hd 

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 9 of 12
(9,843 Views)

Hello,

 

thanks a lot to the maintainers of daqmxbase-swig (DAQmx wrapper using SWIG) and pydaqmx (ctypes wrapper, for Python only). That's great work, but isn't it actually NI's job to provide good high-level APIs for their hardware for the major programming languages? With Python gaining market share in the experiment control and scientific computing sector, it has become standard for many small DAQ manufacturers to provide python high-level APIs. Any comment on this from NI people? I personally won't go back to LabView after having tried scientific computing with Python. If no good drivers ain't there, I won't buy the silicon...

 

Thererfore I'd like to encourage NI to provide a nice SWIG wrapper for the DAQmx library (object-oriented would be nice!). It's not that hard, really...

 

Greetings,

Tobias

http://code.google.com/p/pi3diamond/

 

 

 

0 Kudos
Message 10 of 12
(9,550 Views)