06-28-2013 10:10 PM
Is there a way to read comments in a LabVIEW block diagram from external program like C#, VB, etc...
This will be useful for documentation.
06-29-2013 01:44 PM
What's the end-goal? It seems like this would be way easier to accomplish with LabVIEW scripting rather than going through a different language.
06-29-2013 01:58 PM
Short answer: no.
Long answer: yes, but you might need to do some work.
The first option is simply to read the VI file. The problem with that is that a) it's compressed and b) you have to know the structure, which is not publicly documented.
The second option is to use the VI server properties to read the comments, but I'm fairly sure they're not exposed through LV's ActiveX interface.
Which brings you to the third option, which is to write a VI which will get a path to another VI and then use the VI server properties accessible by enabling scripting to return the text in the comments. You then compile that VI as a DLL function or a function in a .NET interop assembly and call it.
Note that this requires accessing properties which might not be available in the run-time engine, so you might have to actually do this through LV itself (e.g. by opening an ActiveX connection and running the VI in LabVIEW.
06-29-2013 03:52 PM
06-29-2013 03:58 PM
06-30-2013 12:34 AM
Thanks guys for all the help. I have much to learn but you have given me a great start.
06-30-2013 01:19 AM
Note that the diagram is a hierarchy of elements, so your code will only return the comments which are in the top level of the diagram (i.e. not inside structures). If you enabled scripting, you should have a scripting palette inside the application control palette, which should have a traversal VI which will return all objects of a requested class. You can use that to get the comments.
07-01-2013 02:22 AM
This ofcourse assumes people have been good at writing comments and using the comments primitive, instead of simply placing string constants and whatnot as i've seen examples of? Do it extrace comments of front panel? Does it also extract vi-documentation, i often find that a better information source.
/Y