LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting Vi Files to XML or some other Readable format.

Due to security reasons of my building, Vi files are not acceptable for movement between certain systems as they are a form of binary file. I was wondering if there was a LabView provided tool to export/convert Vi files to XML or some other human readable format that could then be imported/converted back into .vi.

 

I understand that you can get around this by taking screenshots and recreating said .vi files on the other system, but I wanted to see if there was an already existent tool from LabView.

 

Thank you.

0 Kudos
Message 1 of 9
(129 Views)

Hi joem,

 


@joem333 wrote:

I was wondering if there was a LabView provided tool to export/convert Vi files to XML or some other human readable format that could then be imported/converted back into .vi.


There was a very similar question last week

 

And there is this old resource.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(106 Views)

Are these "binary" restrictions coming from a human or from some kind of security software?

 

I ask because usually, restrictions on "binary" files mean that they restrict files that contain direct machine code, such as .EXE files and .DLL files, which can contain viruses or other malicious code hidden inside them.  If the restriction is only meant to block that kind of code, then a VI should be fine, as a VI file is just another interpreted file, the same way a Python or Java code file is.  It may just be that you need to convince whatever person or system is checking your files that this is actually the case.

 

As far as I know there's no direct way to convert a VI to XML.  LabVIEW NXG (RIP) did save its files as "plaintext" but that's not helpful here.  In theory you can use VI scripting to get all GObjects in a VI and read all their properties, but I believe there are a number of properties that can't really be set by scripting so trying to use a text dump of that to recreate any VI by hand would probably be impossible.

 

If "taking screenshots and recreating said .vi files" is actually an option, that implies you can send image files somehow.  If so, do you know about "snippets"?   If you highlight a selection on the block diagram (i.e. everything...) you can go to the Edit menu and choose "Create VI snippet from selection", which lets you save that selection as a PNG file.  The benefit of this is that PNG files have the ability to store information in them besides just the image, which LabVIEW uses to embed information about the objects inside them, which allows you to drop a PNG created this way on a block diagram and re-create everything exactly, including non-visible things like items in frames of structures not visible on the screen at the time.

0 Kudos
Message 3 of 9
(105 Views)

Unless I am mistaken, that appears to get the vi to XML but not necessarily from XML to vi afterwards. The big part here would be to get from vi to a human readable format to verify everything inside and then be able to convert that back into a vi file on the other system.

0 Kudos
Message 4 of 9
(89 Views)

Hi joem,

 


@joem333 wrote:

The big part here would be to get from vi to a human readable format to verify everything inside and then be able to convert that back into a vi file on the other system.


Yes.

 

You can use scripting to convert a VI (block diagram) into readable text.

You can also use scripting to convert the same readable text back into the VI (block diagram)!

 

Btw. using PNG snippets would violate that "binary file" restriction, too. Even more so because the "G code" part is hidden inside some additional data chunks in the PNG image file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(74 Views)

Do you know of an example as to how someone else has maybe done this move from block diagram to readable text and back?

Unsure as to how that would be done to be honest.

Thank you in advance, I really appreciate it.

0 Kudos
Message 6 of 9
(66 Views)

@joem333 wrote:

Do you know of an example as to how someone else has maybe done this move from block diagram to readable text and back?

Unsure as to how that would be done to be honest.

Thank you in advance, I really appreciate it.


You have yet to specify the nature of the "security reasons" and how the rules are made and enforced.

 

Is this an automatic screening done by some sort of extremely aggressive anti-virus?  Is it some security guy in your IT department who has gone mad with rules?  Does a person need to manually read the file contents in Notepad somehow?

 

I mean, if all you need to do is turn the files into files that only contain "readable" characters, you could just write a very small program that converts a .vi file to Hexadecimal characters represented in ASCII, and then another program on the other side that converts them back to a .vi file later.

 

The way you're describing this sounds like one of three categories:

1. You are in a situation where someone has implemented some form of "security by insanity" and you're trying to figure out how to do your job despite that.

2. Someone has implemented reasonable security measures that doesn't understand LabVIEW, and you're trying to work with them to find an acceptable solution.

3. Someone has implemented reasonable security measures that doesn't understand LabVIEW, and you're trying to work around them without them knowing.

 

In other words, I think you're presenting us with the "Y" in an "XY" problem.  Description here:

  • User wants to do X.
  • User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
  • User doesn't know how to do Y either.
  • User asks for help with Y.
  • Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
  • After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn't even a suitable solution for X.

Y is your "convert a VI to XML" problem.  Tell us what "X" is.

0 Kudos
Message 7 of 9
(36 Views)

There is software out there that will convert any file into a hex file and back again.  I suggest using something like that.

0 Kudos
Message 8 of 9
(30 Views)

@GerdW wrote:

Hi joem,

 


@joem333 wrote:

The big part here would be to get from vi to a human readable format to verify everything inside and then be able to convert that back into a vi file on the other system.


Yes.

 

You can use scripting to convert a VI (block diagram) into readable text.

You can also use scripting to convert the same readable text back into the VI (block diagram)!

 


Sure, but it can get really tricky when you bump into things like Express VIs and XNodes.

0 Kudos
Message 9 of 9
(28 Views)