How to control LabView VI front panel switches (on/off, bar adjuster) using Python scripts?

余生长醉 提交于 2019-12-02 04:56:05

问题


I have a LabView front panel controlling switches and sensor voltage adjustors to the hardware and need to control these with a Python script. I do not have much knowledge of LabView. Please explain how this could be done.


回答1:


I found one reference on the LabVIEW discussion board that succeeded in this, it uses the following code:

import win32com.client //load the interface
labview = win32com.client.Dispatch("Labview.Application") //get a ref to the Labview application
VI = labview.getvireference(r'C:\TEMP\python.vi') //load the VI
VI.setcontrolvalue('Numeric','5') //set the control 'numeric' to 5

It seems like you need the win32com.client library in Python.




回答2:


You can also push data between LabVIEW and Python using Mark E. Smith's excellent XML-RPC package.



来源:https://stackoverflow.com/questions/3524479/how-to-control-labview-vi-front-panel-switches-on-off-bar-adjuster-using-pyth

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!