I heard a feature request today for a menu item for “Close all windows but this one.”
It’s a reasonable request, but I’m not sure it’s worth adding an item to the (already large) set of menus in LabVIEW today.
That’s because there’s already a way to close windows other than visiting them one by one: the All Windows dialog.
- From the menu, select Window>>All Windows or use the keyboard shortcut Ctrl+Shift+W.
- In the dialog, select all, either by using the standard listbox multi-selection (click and Shift+Click) or by using the keyboard shortcut Ctrl+A.
- Deselect the window(s) you want to keep open, e.g. by using Ctrl+Click.
- Press the Close Windows button.
In addition, when you’re working in a project (which you really should do!), there’s a menu item in the Project Explorer for exactly what was requested: File>>Close All (this Project).
These menu items are handy when you want to “clean up” after debugging many subVIs.
Have you ever wanted to customize the appearance of a type def wire, e.g. by making it a different color? Unfortunately, you can’t.
But you can customize the appearance of wires for a given LabVIEW Class (LVClass) type! This is another way that LVClasses are like type defs with superpowers.
To customize an LVClass wire appearance, right-click on the LVClass item in the Project tree and select Properties.
In the Properties dialog, select the Wire Appearance category and change the radio button to “Use custom design.”
Then you can have fun playing with the pattern, colors and size!
After talking to a few people who were learning LabVIEW Object-Oriented Programming (LVOOP) at NIWeek, I decided to revisit an introduction to LVOOP here on my blog.
You can think of a LabVIEW Class (LVClass) as a cluster with superpowers. An LVClass has many of the advantages of a type definition but it also gives you much more.
Creating a LabVIEW Class
To create an LVClass, you should be in a Project. (It’s not required, but I strongly recommend it).
Right-click on a target (such as My Computer) in your Project Explorer window and select “New>>Class.”
The CTL item is not a separate file on disk. It is the private data control for the LVClass. Every LVClass must have one (and only one) private data control, and it is saved in the .lvclass file on disk.
Edit the CTL file and you will see an empty cluster. This is the heart of your LVClass. It is where you define the data members.
Let’s say you want two data members: a Color box and a Boolean. You simply add controls to the cluster.
You may think there is a similarity between this Widget class private data control and a type definition. And you would be correct! But the users of this LVClass cannot unbundle the cluster to access the elements – only VIs that are members of the LVClass can do that.
If you want VIs outside of the LVClass to know about a data member – for example, to be able to read the value of the color box – then you need to create a VI for Data Member Access. Rather than bundling/unbundling the cluster, VIs outside of the class must use the interface VI.
So you can think of an LVClass as being like a type def cluster that’s a “black box” to the VIs that use it. They can “see” the interfaces (e.g. that they can read a color) but they have no idea what else is in the cluster.
The encapsulation of the LVClass also makes it easy to perform actions whenever a data member is read or written. As the designer of the LVClass, you know that there is no way a VI can read or write these data members without going through the VI interfaces you have created for the LVClass.
More on LVClasses later! If you have any questions on the basics, feel free to post them in the Comments. If you have any questions beyond the basics, there’s this place online where the most amazing experts hang out called LAVA…
LabVIEW 2012 introduces a feature requested on the Idea Exchange: Subdiagram labels.
These labels are a part of structures such as while loops and case structures. Unlike free labels placed inside the structure, a subdiagram label automatically resizes with the structure.
You can also color the label using the Coloring (aka paintbrush) tool. Select the Coloring tool using the Tools palette, which is shown using the View>>Tools Palette menu.
Since you can also color the structure itself, you can create interesting effects such as this:
In LabVIEW 2012, new Project templates and Sample Projects help you get started with a project as quickly as possible.
Some of the best weapons against “spaghetti code” – diagrams that are hard to read and impossible to maintain – are design patterns such as the Simple State Machine and Queued Message Handler. The Project templates promote starting with one of these tried-and-true designs.
You can also create your own Project templates and Sample projects, but I’ll talk about that more in a future post.
To use the new Project Templates and Sample Projects, you’ll use the Create Project dialog. You can access this dialog by clicking the Create Project button on the LabVIEW 2012 Getting Started window. It’s also in the File menu and the Project menu.
The Create Project dialog lists the available Project templates and Sample Projects. I am only showing the core set; modules and toolkits can install additional items.
If necessary, you can narrow your choices by selecting a category in the left-hand column or typing keywords in the Search box.
After selecting your starting point, you click Next. Depending on the item you have chosen, you may see a different dialog than the one below. For the Simple State Machine, you need to decide your project’s name and location on disk. You can optionally prefix your file names (in case you want to make all your VI names unique across multiple projects) and define a custom icon overlay.
When you click Finish, you will have a new project to work with. This project is a customized copy of the template, so you don’t need to worry about edits to the VIs interfering with other applications (which can happen when people edit examples).
You can now open the Main VI and explore the contents of your project. Areas where you will probably want to focus on writing your own functionality are highlighted with blue comments. Here is the Main VI of the Simple State Machine template:
You may also want to review the Project Documentation, which explains the template (or Sample Project) in great detail.
We believe that the Project templates and Sample Projects will not only get you to a working application faster, but also lay the groundwork for applications that can be extended and maintained long into the future.
When you first launch LabVIEW 2012, you’ll see a Welcome pane with resources for learning about LabVIEW and the new features in this version.
- The first link is for the NI LabVIEW Skills Guide, which I mentioned in an earlier post.
- The second is for the list of new features.
- The third link is a new Help topic that guides you through the recommended process for upgrading your VIs to the latest version of LabVIEW.
After you close the Welcome pane (and you can uncheck the Show on launch box if you don’t want it to appear every time you launch LabVIEW), you’ll see the redesigned Getting Started window:
There are two basic points of entry: do you want to create a project or open an existing file?
Note that we are strongly encouraging everyone to work in projects. However, New VI is still in the menu if you need it.
Along the bottom, you have resources and news. Click on the links to bring up the Find Drivers and Add-ons pane, the Community and Support pane, or the Welcome pane (which you saw on first launch).
After you create a project or open files, the Getting Started window will display recently-used items.
If you want to see more items, you can resize the entire window. If you want to keep items from “falling off” the list, you can pin them by mousing over them and clicking the pin button that appears.
I hope you enjoy using the new Getting Started window!
One of the coolest new features of LabVIEW 2012 isn’t even in LabVIEW itself. I’m talking about the new LabVIEW Skills Guide. LabVIEW 2012 promotes this website on the Getting Started window, but you don’t need LabVIEW 2012 to access it.
The LabVIEW Skills Guide strives to be the fastest path to success with LabVIEW and National Instruments hardware. If you’re new to LabVIEW, it helps you learn the skills you need. If you’re training a colleague, it provides you with the tools to help. Even if you’ve been using LabVIEW for years, you may discover a new area of interest!
We’d love to hear your feedback on how well the LabVIEW Skills Guide works for you and suggestions for future enhancements.
by Christina in NI Week
NIWeek 2012 is almost here!
There are many excellent sessions planned. You can see the complete list at ni.com/niweek, but here are the ones that I’m most excited about. Obviously I can’t attend them all, though, since some of them are at the same time! I need clones…
A Scalable Plug-In Architecture for Monitoring Distributed Real-Time Applications
Thursday, August 9 > 10:30–11:30 a.m. > Room 16A
Fabiola De la Cueva, Delacor
Watch LabVIEW Champion and LabVIEW Architects Forum Founder Fabiola De la Cueva demonstrate a scalable, configurable plug-in-based architecture for monitoring multiple distributed targets even if the targets are different system types. Examine advanced techniques like LabVIEW object-oriented programming and subpanelling and take the code home with you.
Wednesday, August 8 > 3:30–5:30 p.m. > Room 18C
Stephen Mercer and Allen Smith, NI
Explore how the Actor Framework (AF), part of LabVIEW 2012, helps you build LabVIEW applications involving multiple parallel tasks that must communicate with each other. With AF, you can reuse more code and avoid many of the common deadlock and race conditions of parallel systems. Some knowledge of AF and LabVIEW object-oriented programming is helpful for this session. See ni.com/actorframework.
Build a VI Package With VI Package Manager
Tuesday, August 7 > 10:30–11:30 a.m. > Room 18C
Robert Des Rosier, NI
Learn how to set up the most efficient processes to build and distribute VIs and utilities for free. This session includes tips on how to package your LabVIEW code in reusable components that are easy to track and share with other users. In addition, see how to easily install VIs on multiple computers and versions of LabVIEW as well as license your LabVIEW packages to quickly turn your code into a commercial product.
Code Review Best Practices
Tuesday, August 7 > 10:30–11:30 a.m. > Room 18B
Nancy Hollenback and Brian Powell, NI LabVIEW R&D engineers review all (yes, ALL) code that goes into the product and encourage you to do the same. In this session, examine best practices and learn how your team can use these ideas.
Custom Code Deserves Custom Analysis
Thursday, August 9 > 1:00–2:00 p.m. > Ballroom G
Elaine Ramundo, Bloomy Controls, Inc., and Ellen Zhang, NI
Examine how to use the LabVIEW VI Analyzer Toolkit to help automate large project code reviews, especially when creating custom rules for specific code base/project needs. This session includes a demo and tutorial worksheet.
Data Communication With LabVIEW
Tuesday, August 7 > 3:30–4:30 p.m. > Room 12B
Grant Heimbach, NI
Get an overview of some of the most effective techniques for sending and receiving data and commands within a LabVIEW application. See how to stop multiple loops, send messages to an undefined number of plug-ins, set up two-way communication, communicate in a distributed embedded system, and address other common challenges.
Everything You Ever Wanted to Know About Functional Global Variables
Wednesday, August 8 > 3:30–4:30 p.m. > Room 19B
Nancy Hollenback, NI
As a longtime foundational design pattern in the LabVIEW community, the functional global variable (FGV) meets many common challenges but can also be overused. Join this discussion of best practices for global data storage and the transition from FGVs to data value references.
Explore Tools to Customize LabVIEW
Wednesday, August 8 > 2:15–3:15 p.m. > Room 18D
David Ladolcetta, NI
Customize LabVIEW by adding functions to the LabVIEW Project Explorer. Also learn to access additional resources and tools to improve the LabVIEW development environment.
Forget-Me-Not Seat Sensor Protects Children
Thursday, August 9 > 2:15–3:15 p.m. > Room 19A
Keith Schaub, Wireless SOC Test
Learn how Wireless SOC Test used LabVIEW and other tools to develop an inexpensive and highly reliable safety system to protect infants and children in car seats. This system, called Forget-Me-Not, alerts you if a child is placed in the seat, becomes unrestrained, or is inadvertently left in the vehicle.
Inside the LabVIEW 2012 Core Templates
Thursday, August 9 > 10:30–11:30 a.m. > Room 18D
Elijah Kerry, NI
Spend time with the new templates and sample projects in LabVIEW 2012 with technical experts in the room who can answer questions.
LabVIEW 2012 Advanced Design Templates and Sample Projects
Tuesday, August 7 > 3:30–4:30 p.m. > Room 19A
Elijah Kerry, NI
Focus on the more complex templates and sample projects in LabVIEW 2012 and explore concepts like how to create and add your own.
LabVIEW Classes: The State of the Art
Tuesday, August 7 > 2:15–3:15 p.m. > Room 19A
Stephen Mercer, NI
Review LabVIEW object-oriented programming (OOP) trends over the last year with LabVIEW OOP Lead Developer Stephen Mercer. This session includes interesting tricks and tips, new 2012 features, and tales from other users to educate and entertain.
Parallelizing the Unparallelizable
Wednesday, August 8 > 2:15–3:15 p.m. > Room 16A
Christian Altenbach, UCLA
LabVIEW is well suited for parallelization, but fully using a large number of cores requires smart code design. LabVIEW Champion Christian Altenbach shows you how to design code to automatically scale as more cores become available, even if the important loops are initially not directly parallelizable. Also examine benchmarks.
Secret Sauce: Non-LabVIEW Tools to Make You a Better LabVIEW Developer
Tuesday, August 7 > 10:30–11:30 a.m. > Room 12B
Justin Goeres, JKI
If you could save one hour a day by working smarter, how much more value could you create and how much less stress would you feel? LabVIEW Champion Justin Goeres shows you how to manage your code, projects, and commitments using the same free and low-cost tools JKI engineers use.
Software Engineering Best Practices for LabVIEW
Tuesday, August 7 > 4:45–5:45 p.m. > Room 19B
Elijah Kerry, NI
The complexity of today’s challenging applications requires effective software engineering, meaning development practices that ensure the scalability and maintainability of software. Learn how applying these practices correctly improves overall application quality and developer productivity as well as lowers maintenance costs.
Tips and Tricks to Speed LabVIEW Development
Thursday, August 9 > 10:30–11:30 a.m. > Ballroom E
Darren Nattinger, NI
Hear from the “world’s fastest LabVIEW programmer” about some simple techniques that can help you code more quickly. Also learn about little known LabVIEW features, advanced functions, and other tools that can help you save development time.
Also, don’t forget about the LAVA/OpenG BBQ on Tuesday night!
There is a channel on YouTube providing lessons from LabVIEW Core 3. Here’s the description:
This is a pilot project driven from National Instruments UK. Leave your comments, what you like or what you did not like, to guide future development of our course formats.
The third course of the National Instruments LabVIEW learning path, LabVIEW Core 3, increases proficiency by exposing you to best practices for designing, developing, testing, and deploying LabVIEW applications.
You need access to LabVIEW Core 3 course manual, to be able to complete the exercises and course project. If you have a current software contract (SSP) with NI, you can get all 38 modules in DVD and course manual for £179 (GPB), equivalent to 56% discount, directly from NI UK Office at firstname.lastname@example.org or call us on +44(0)1635 572 400.
PS. As disclosure, I do work for National Instruments and I am passionate about training and improving skills of LabVIEW users.
by Christina in Administrivia
Sorry for the long absence from the blog. I’ve been really busy for the past six months. Those of you in the LabVIEW 2012 Beta program know why!
If you’re not in the Beta program, there’s still time to request to participate. Just go to ni.com/beta and select LabVIEW 2012.