From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rearrange bundle unbundle node

I like nice and clean diagram. Very often I need to change order of cluster (un)bundle by name terminals, preserving wire connections. This wonderfull idea has been offered 6 years ago and forgotten. 

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Rearrange-Unbundle-and-Bundle-By-Name/idi-p/1210059

Has nothing been done yet?

Quick drop plugin, Ctrl+B. Select (un)bundle node. Plugin shows listbox with node items. Drag them to reorder and apply.

First version, so it is not perfect.

Message 1 of 8
(3,696 Views)

An almost-foolproof way to automatically enforce whatever order of elements you want is to always create a TypeDef for your clusters.  When you Bundle/Unbundle By Name a TypeDef'ed cluster, the order of the Elements are whatever you decided in the TypeDef.  Of course, if you have TypeDef A with one order, and TypeDef B with another (but otherwise similarly-named-and-typed Elements), all bets are off unless you take the trouble to reconcile the disparate definitions.

 

Bob Schor

0 Kudos
Message 2 of 8
(3,693 Views)

It is not about the order of elements in the cluster, it is about order of terminals in bundle-unbundle by name.

Sometimes the order of terminals can avoid a lot of wire crossing.

0 Kudos
Message 3 of 8
(3,671 Views)

I don't know Bob, I think this can be used pretty well in conjunction with type def'd clusters.  For esthetic and code cleanliness I think this could be a useful tool.  Plenty of times I'll have a cluster being unbundled and a wire on the buttom goes up and a wire on top goes down.  This is usually the result of some refactoring where code pieces were moved around, but the unbundle is left in the order it was in.  I did a quick test with this and I could see using it.  However I think you're going to want to reconsider the default shortcut, since B is used by a plugin shipped with LabVIEW already.

0 Kudos
Message 4 of 8
(3,667 Views)

I am using this code as part of a plugin I'm writing, and I found an important bug that you may wish to correct.

 

The script works well when any cluster element has only a single unbranched wire attached. However, if you have a branched wire that terminates on a  tunnel, deleting the wire deletes those terminals, and they are not rewired by your script. Consider this diagram:

Capture.PNG

It's a trivial example, but common during development... I know I need those indexed boolean values, and I don't want those wires deleted.

 

You can fix this by replacing the Wire:Delete method with Wire:Disconnect Terminal. This preserves the wire and thus all its other terminals. If there are wire bits laying around afterward, there's a method to clean those up as well. 

 

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
Message 5 of 8
(2,451 Views)

You should attach your VI script that shows what it is you are trying to do.

 

Why do you consider this a bug?  To me it sounds like you want the  Delete method wire to be different than what it is defined for.

 

My understanding is that a wire is everything that exists between its source and all its terminals.  Within that wire are joints that define where the individual segments meet or bend.

 

This is only a bug if the function only does something that the designer did not intend it to do.  It is not a bug if the user of the function thinks it should be doing something different than the designer intended.

0 Kudos
Message 6 of 8
(2,422 Views)

Hi RavensFan, this is not about what I want to do, it is about the purported function of the quick-drop script that is the topic of this thread

 

From the original post:

"Very often I need to change order of cluster (un)bundle by name terminals, preserving wire connections."

 

I have described a case in which the plugin fails (aka a bug), because rather than disconnecting a wire (the method to use that fixes the bug), the script first deletes the wire, and thus does not preserve the wire connections.

 

Please review carefully. 

 

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 7 of 8
(2,395 Views)

MyCFAVisit wrote:

Hi RavensFan, this is not about what I want to do, it is about the purported function of the quick-drop script that is the topic of this thread

 

From the original post:

"Very often I need to change order of cluster (un)bundle by name terminals, preserving wire connections."

 

I have described a case in which the plugin fails (aka a bug), because rather than disconnecting a wire (the method to use that fixes the bug), the script first deletes the wire, and thus does not preserve the wire connections.

 

Please review carefully. 

 

 


I think this can be used pretty well in conjunction with type def'd clusters.  For esthetic and code cleanliness I think this could be a useful tool.  Plenty of times I'll have a cluster being unbundled and a wire on the buttom goes up and a wire on top goes down.  This is usually the result of some refactoring where code pieces were moved around, but the unbundle is left in the order it was in.

0 Kudos
Message 8 of 8
(2,363 Views)