03-17-2011 04:19 AM
Hello,
I am looking for a way to create or modify a LabVIEW VI by script, e.g. Python, VBA or similar.
Is there an interface that allows doing actions like dragging VIs and lines or setting parameters?
Thanks,
Christian
03-17-2011 07:49 AM
Have you explored vi scripting (avaliable native in 2010 but can be unlocked in earlier versions)?
Macro expansion is much easier in a text based language, vi scripting is not a simple ask, which bes the question what are you trying to acomplish? sometimes there is an easier way than scripting.
03-17-2011 09:00 AM
I haven't tried vi scripting yet but will definitely have a look at it.
What I am trying to do is, that based on some user definitions a LabVIEW application should be created from existing VI's and parameters should be set accordingly.
First step would be to provide a GUI to the user where the desired features can be selected. The script needs to do some kind of dependency analysis of course, in order to check that the combination of the selected features is allowed.
Based on this, a script in the background would than build the complete VI, deploy it to RT targets or just open it for the user.
Christian
03-17-2011 09:08 AM
Try looking into LVOOP.
I used that to develop an app like you described a couple of years ago. No scripting required. I can add new functions to the existing exe if the customer asks.
It took a lot of work but it did work.
Ben
03-17-2011 09:17 AM
Speaking from experience, I might comment that writing a scripting application will also take a lot of work. I have been using and supporting scripting internally here at National Instruments for over a decade. Use something else if you can. Scripting is powerful, but scripting what is essentially a 2D drawing, not a linear list, has a lot of hidden issues, especially if you want the final product to look good. If you need it though, go for it. You haven't mentioned any functionality that we are not shipping.
One final caveat - scripting requires a development environment. You need to be able to compile your final code, and the run-time engine does not have a compiler.
03-17-2011 09:28 AM
I am aware that there will be lot of effort writing the scripting application but since the goal is to allow users which are definitely not familiar with LabVIEW to customize the final application to their needs, I think it is worth spending the time. It is fine if the block diagram does not look good, because users won't see it. Front panel needs to be nice of course.
Compiling shouldn't be a problem since there will be a full LabVIEW installation available on each user system.
Thank you for your replies.
Christian
03-17-2011 09:39 AM
Could you breifly outline a couple of the "customizations" you hope to provide?
it would help us help you.
Ben
03-17-2011 10:46 AM
Yes, I can try to give you an idea of the application.
The application domain is test benches. There are several test benches, the overall type is the same but each of them has some different settings, different test items and different types of tests.
One of the tasks is to have a bunch of controllers (like PID) that make sure that predefined setpoints for signals are meet.
There are two requirements:
1. The test bench user should not need to modify the LabVIEW application manually.
2. A generic solution is needed that runs on all test benches, has the same/similar user interface has no difference in usage.
What I try to accomplish is to get a kind of framework where the user just defines for which test bench, test item and test type the application is needed.
Based on this, the application is created automatically, containing no dead code but the correct controllers, uses the correct I/Os and so on. For features that are available in the application, the corresponding front panel items are visible, for non existing features, no front panel items are shown.
Does that make clear what I need to do?
Christian
03-17-2011 11:10 AM
@ChristianEC wrote:
Yes, I can try to give you an idea of the application.
...
Does that make clear what I need to do?
Christian
Yes, thatnk you.
Have you investigated using TestStand?
I don't use it myself, I have associates that do those projects. It should cover most or all of your needs.
But if you want to "roll-your-own" then look into LVOOP. One of the demos that ship for LVOOP examines how Dynamic Dispatching can be used to test different widgets using a single architecture.
Take care,
Ben
03-18-2011 08:12 AM
I would like to second Ben's suggestion to use LabVIEW Classes. It sounds like you want a hardware abstraction layer, and LabVOOP excels at this sort of thing. It is also a lot easier than doing it with scripting. You can find out more in the presentation here. The presentation includes an example and links to code for a hardware abstraction layer.
Good luck! Let us know if you need more help.