Example Code

Quick Drop - Vertically Align Objects

Code and Documents

Attachment

Download All

Overview

This Quick Drop plugin vertically aligns any block diagram object to the next adjacent connection terminal regardless of wire joints or node spacing. Unlike the built in align tools and block diagram cleanup, this plugin aligns the connection terminals rather than total bound position. An optimization routine prioritizes the selected objects depending on their position and corrects for expandable primitives such as the build array or unbundle by name functions. This means that your wires are straight, your block diagram is clean and you don't have to spend hours cleaning up that spaghetti code!

There are 2 modes of operation depending on the block diagram object selection:

Objects Selected

If one or more objects are selected this vertically aligns the selection from left to right using the bottom left input connection terminal. Alternatively, holding shift aligns right to left using the bottom right output connection terminal.

VerticalAlign_Selected.png

No Selection

If no objects are selected this vertically and horizontally aligns all control & indicator terminals to the sides of the block diagram. Alternatively, holding shift only horizontally aligns the control & indicator terminals while maintaining the vertical position.

VerticalAlign_NoSelect - Copy.png

Install Instructions

1. Unzip and copy the VI's (including the '_RyLabsQD' folder) to the Quick Drop plugins folder ('<LabVIEW>\resource\dialog\QuickDrop\plugins').

2. Under the Quick Drop Ctrl-Key Shortcut tab, verify that 'RyLabsQD_AlignTerminals.vi' is assigned to a character (Default is 'Ctrl-A').

3. To use, select objects to vertically align on the block diagram and press 'Ctrl-Space + Ctrl-A'.

QuickDropFolder.png

Screenshots

This plugin is extremely useful for quickly cleaning up code. Here are a few examples:

AlignExamples.png

Feedback is welcome and appreciated!

LabVIEW: 2013+

Author: Ryan Pacini (CLA)

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

Comments
Eric_BOB
Member
Member
on

Hi. That look nice.

Is-it possible to have it in LV2011.

Best regards

Eric

rcpacini
Member
Member
on

I've attached a LV2011 version. Let me know if you have issues.

Eric_BOB
Member
Member
on

Hi Ryan

Thanks for conversion. After a few tests, it work right with LV2011. But it run correctly, if you only select one object (control, tunnel,..) at the same time (there is bad alignement).I have test with one control one node and one indicator (connect to top tunnels), and select the control and indicator, and finally only  the control is aligned. Perhaps it's not a good combinaison... It will be better if we can make few moves at time.

rcpacini
Member
Member
on

Can you attach your test VI? Not sure if I understand your example.

Note: If there are only source/sink wires, the alternate option will toggle between the top and bottom alignment (i.e. Two source terminals &amp; no sink terminals: Default = align to bottom-left input terminal, Shift = align to top-left input terminal)

Contributors