11-20-2018 08:58 AM
Hello,
I have a fairly large LabVIEW project which I have organized into various folders and sub-folders on disk as seen in the following screenshot.
I am following the design guide for building an effective hardware abstraction layer so I have parent interface classes in the HAL folder (grouped by the type of hardware) and the actual implementations in the DSSP folder (again grouped by the type). On of the member VI methods I want to have for every piece of hardware is one which returns an image for the hardware called Get Image.vi. This will be overridden from the GenericHALObject by the actual hardware objects and dynamic dispatching will call the correct VI.
My question is how to organize these images in the source code and final built application. Right now I am storing the images for each DSSP in the folder with the LabVIEW class and am having the Get Image method use the path of the current VI to find the image. However, I know this will not work when calling the GenericHALObject method nor when I build the final application into an executable. Ideally the images (and any other files I need) would either be embedded in the final executable or better yet with a DLL or something similar) that contains the DSSP or alternatively the actual file gets placed with the EXE. I also need this to be able to work when debugging the application within the development environment.
Any suggestions as to the best way to do this?
Thanks!
Solved! Go to Solution.
11-20-2018 10:05 AM
One option is to store the images in the VIs themselves as the default data in the image indicator. Then you no longer have external image files to maintain.
The next option I would go with would be to put the images in an "images" folder next to the project file. Then you can use relative paths using the Application Directory. This function gives you the path of the folder containing the project file (in the IDE) or the executable (in the RunTime Engine). Just put the images in an "images" folder next the the executable and nothing in your code needs to change between the IDE and exe.
11-20-2018 11:04 AM
I didn't realize the default value for a picture is actually stored in the VI itself. That solution works perfectly! Thanks!