Example Code

LVOOP Assistant

Code and Documents

Attachment

   VI Server/Scripting Category Winner


lvoop assistant.png

Summary

Scripting was released in LabVIEW 8.6.1 by NI Labs and made its official debut (publicly exposed in palette in without additional addons) in LabVIEW 2010.

I love the fact it now native in LabVIEW as I find Scripting invaluable in creating tools to speed up my development processes and in reducing repetitive tasks (so I can spend time learning new stuff!).

One area in particular that I find Scripting very handy is in support for LVOOP.

This example comprises a bunch of actions I use all the time and was able to automate.

It is currently an example of what I like - but I hope to make it much more configurable in the near future.

This package includes Quick Drop and Tools Menu plugins.

So you can access this plugin thorough either way, depending on what you like best.

I recommend checking out the Video Demonstration section (below) as the you can easily and quickly see what the plugin does.

Video Demonstrations

Here are some videos demonstrating the LVOOP Assistant plugin. There are links to more videos below.

Editing Icons (with Layer support): http://www.screencast.com/t/OwxyUtE9pWEz

<object id="scPlayer" class="embeddedObject" width="740" height="699" type="application/x-shockwave-flash" data="http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/b059f458-ccd2-4be2-aeca-3cc80f0a1..." >  <param name="movie" value="http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/b059f458-ccd2-4be2-aeca-3cc80f0a1..." />  <param name="quality" value="high" />  <param name="bgcolor" value="#FFFFFF" />  <param name="flashVars" value="thumb=http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/b059f458-ccd2-4be2-aeca-3cc80f0a1..." />  <param name="allowFullScreen" value="true" />  <param name="scale" value="showall" />  <param name="allowScriptAccess" value="always" />  <param name="base" value="http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/b059f458-ccd2-4be2-aeca-3cc80f0a1..." />  Unable to display content. Adobe Flash is required. </object>

Methods Sandbox: http://www.screencast.com/t/ZTJkOWQxYTQt

<object id="scPlayer" class="embeddedObject" width="1009" height="728" type="application/x-shockwave-flash" data="http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/c0a6f59c-b35d-422e-8e1c-4c1e1705d..." >  <param name="movie" value="http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/c0a6f59c-b35d-422e-8e1c-4c1e1705d..." />  <param name="quality" value="high" />  <param name="bgcolor" value="#FFFFFF" />  <param name="flashVars" value="thumb=http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/c0a6f59c-b35d-422e-8e1c-4c1e1705d..." />  <param name="allowFullScreen" value="true" />  <param name="scale" value="showall" />  <param name="allowScriptAccess" value="always" />  <param name="base" value="http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/c0a6f59c-b35d-422e-8e1c-4c1e1705d..." />  Unable to display content. Adobe Flash is required. </object>

Here are some more videos demonstrating the LVOOP Assistant plugin.

Installation Help: http://www.screencast.com/t/70DD7mcN77

Launch from Quick Drop Plugin + LabVIEW 2009 example: http://www.screencast.com/t/wqNKObpFmHlR

Launch from Tools Menu + LabVIEW 2010 example: http://www.screencast.com/t/USN9RTOhyeYs

Unsaved Class (limited features explained): http://www.screencast.com/t/NTI0M2EzN

Rename LVOOP Front Panel Object Labels: http://www.screencast.com/t/NTZiZDg0Yj

Scoped Virtual Folders: http://www.screencast.com/t/MDcxODVmO

Create Constructor from Template: http://www.screencast.com/t/MTcwMWM5OT

Icon Transparency Support: http://www.screencast.com/t/NzhlYmQ1Y

Function

LVOOP Assistant is a Tool designed to assist with setting up a LVOOP Class.

The LVOOP Assistant supports:
Changing Class Icons themes with native LVOOP colors, custom colors or random colours - no need to update both the Class Icon and Class Control Icon
Icon Layers due to the integration of the Icon Editor API - all existing Layer information is preserved
Using a Sandbox to create Static and Dynamic methods from user templates - I can use my own method templates so there is no need to edit the native ones each time to the way that I like
Creating a Constructor method from a user template - creates the Constructor from my own template
Creating Scoped Virtual Folders - all the folder names and scoping I use to organise Class method VIs can quickly and easily be added to the Class
Renaming LVOOP FP Object Labels - this handles if you have ever renamed a Class and find it annoying that your Class Input/Output labels are now wrong
Cloning a method VI - easy clone a method from one Class to another

Parts of this plugin were designed to be use with method templates i.e. VIs that have Class In, Class Out

Therefore, for LVOOP templates, the following Connector Panes are supported (the # numbers relate to Scripting if you haven't seen them before):

#4815 - 4x2x2x4

#4833 - 5x3x3x5

#4834 - 6x4x4x6

#4835 - 8x4x4x8

See here to learn more about creating your own keyboard shortcuts using Quick Drop Plugins.

Steps to Execute Code

  1. Download the attached .zip file distribution
  2. Install both packages into VIPM (jgcode_rsc_qdp_lvoop_assistant-0.16-1.ogp, jgcode_rpk_ni_icon_editor_api>=2.1)
    1. This package has no other dependencies
  3. Restart LabVIEW (if open) to refresh Tool Menu

Installing into LabVIEW 2010

The source code for this example is in LabVIEW 2009 and therefore a recompile is necessary to optimise performance in later versions of LabVIEW.

It is recommended that you un-check Mass Compile VIs After Package Installation if installing into LabVIEW 2010 as it will take a long time.



vipm.png

However, the plugin itself is able to realise a new installation and self-compile in LabVIEW 2010.

Additionally this process has been optimised.

This only needs to happen once - after that the plugin runs as normal.

compile.png

mass.png

File Locations

This package will install a quick drop plugin to LabVIEW\resource\dialog\QuickDrop\plugins

This package will install tools menu plugins to LabVIEW\project\JGCODE Tools\LVOOP Assitant

This package will install the support libraries to LabVIEW\vi.lib\addons\_JGCODE Toolkits\LVOOP Assitant

Persistant data is saved to \data\settings.ini (relative to support libraries directory)

Quick Drop

Press Ctrl + Space to activate Quick Drop on a Class Method VI then press Ctrl + X to launch the LVOOP Assistant GUI

quick drop.png

Ensure that the x.vi does not already exist as a Quick Drop Plugin otherwise this will overwrite it.

If so backup your x.vi before you install - if you do not have a x.vi Quick Drop plugin then do not worry!

Tools Menu

Select this plugin from the Tools Menu: Tools >> JGCODE Tools >> LVOOP Assistant >> Run to launch the LVOOP Assistant GUI.

Tools.png

Examples

  1. Open a new Project
  2. Open a new Class
  3. Save the new Class to disk (this exposed more options in the plugin)
  4. Either create a new Class Method VI or open the Class Control
  5. Launch the LVOOP Assistant using Quick Drop or the through the Tools Menu


If you activate this tool on a non Class Member VI, the plugin will silently exit.


Screenshots

screenshot6.png

screenshot3.png

screenshot.png

screenshot4.png

screenshot5.png

screenshot2.png

VI Snippet

A VI Snipper is not applicable in this example as the deliverable is a LabVIEW plugin.

Bonus!

This distribution contains the Icon Editor API package. This Icon Editor API was released by National Instruments (namely through Thomas Sandrisser - ThSa). The original code (available here) has not been edited in any way, it has only been recompiled to sit natively under <user.lib> (not <User Desktop> as per the download) so it is a symbolic location. It has been included in a package so that it can be easily installed in LabVIEW. It is a great API that allows you to manipulate Icon Layers which related to the Enhanced Icon Editor, new to LabVIEW 2009. Check out the NI Community Group here.

Additionally I have extended the Icon Editor API package with my own code library (separate to the original code library) to include additional features such as a native interface for Classes and also functions that operator on the Layer Data. This package is a dependency of the LVOOP Assistant and not included in the build as the Icon Editor API calls code outside of LabVIEW symbolic paths (i.e. where the Icon Editor itself sits under <LabVIEW>\resource\plugins\NIIconEditor\etc...). This means that any calling code will break as the links will change from your src tree to dist location. The workaround for this was to keep all calls to this code under <user.lib> and separate in the Icon Editor API package.

I thought I would mention this as you may find the Icon Editor API useful and compliments this example.

I am hoping in the future that this API could be included natively with LabVIEW in a way that the above issues would no longer be a problem.

Please vote for this Idea on the Idea Exchange Forum to make this happen!

IconEditorApi2.png

IconEditorApi.png

jgcode.png

Author Notes

I love to share code therefore, an earlier version of this example has been previously release on LAVA however, according to Todd this is within the rules, given that the code is differentiated between versions. The main feature of release v0.16 is native support for LabVIEW 2010. The distribution code is LabVIEW 2009 but it will automatically handle an optimized mass-compile of the code on first call to speed up the tool (otherwise the code would compile each time the tool is loaded which is unacceptable as it quite a large distribution contains libraries/classes etc...)

VI attached below

Certified LabVIEW Architect * LabVIEW Champion

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Charles_CLA
Active Participant
Active Participant
on

Jonathon, I'm trying to get your code working in LabVIEW 2013 and having some difficulty. Are there known compatibility issues with newer versions of LabVIEW?

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Contributors