Showing results for 
Search instead for 
Did you mean: 

Micro-Nuggets !!! ~~~~ Post 'em if you got 'em


It's already been mentioned to use "Conditional Disable Structures" to achieve different behaviors when RUN_TIME_ENGINE is TRUE or FALSE. I also really like to use conditional disable symbols for when I do or don't have hardware connected to my computer. You go to Project > Properties > Conditional Disable Symbols to add your own symbols. So as an example, I'll have one subdiagram for "Camera==TRUE", and another for "Camera==FALSE,default".


You could also use a case structure, but with conditional disable structures, the unused subdiagrams do not effect your final code. (For example, a broken VI in the inactive subdiagram will not prevent your application from running). You might even want to exclude certain VIs from a build because they require a toolkit that a specific target computer won't have.



One thing I never cared for about the conditional disable symbols is that you have to open up the dialog, and then type in the value for each symbol, which is a little cumbersome. Today I found out about two VIs: GetSymbols and SetSymbols. They are located in "C:\Program Files (x86)\National Instruments\LabVIEW 20xx\resource\plugins\Utility\IfDef.llb". You can use these to modify the conditional disable symbols of your project! I made a quick GUI to make it easier to edit the symbols, you could also use this as part of your pre-build actions to make sure you don't forget to enable the hardware before building an executable.




Message 361 of 361