Jump to content

Cleaning up wires


Recommended Posts

QUOTE(zoogies @ Jun 25 2007, 01:11 PM)

I do this a lot: have some messy, ugly, or tangled wires running together, and going through each one, right clicking, and pressing "clean up." Is there a shortcut for this, or better yet, a "clean all wires" shortcut?

No. And you're not the only one who wishes for such a tool.

Link to comment

QUOTE(Aristos Queue @ Jun 25 2007, 11:19 AM)

Actually there is one I wrote in 2004. It is available on http://forums.ni.com/ni/board/message?board.id=170&message.id=79506&query.id=716773#M79506' target="_blank">NI forum (Eventhough I though I post it on LAVA too, I was unable to find it).

Note: Since that time, a lot of new class of objects have been added to LabVIEW. Therefore it might not work as well on LV 8.x (for example finding wire in flat sequence, disable structure or the like will most likely fail).

PJM

Link to comment

QUOTE(PJM_labview @ Jun 25 2007, 11:55 AM)

Actually there is one I wrote in 2004. It is available on http://forums.ni.com/ni/board/message?board.id=170&message.id=79506&query.id=716773#M79506' target="_blank">NI forum (Eventhough I though I post it on LAVA too, I was unable to find it).

Note: Since that time, a lot of new class of objects have been added to LabVIEW. Therefore it might not work as well on LV 8.x (for example finding wire in flat sequence, disable structure or the like will most likely fail).

PJM

You can (and should) use the built-in traversal VI for obtaining all Wire references:

<LabVIEW>\vi.lib\Utility\traverseref.llb\TRef Traverse for References.vi

This is updated by NI and will (should) work for any new obj types introduced to LabVIEW.

-Jim

Link to comment

QUOTE(zoogies @ Jun 25 2007, 07:11 PM)

<plug mode="own code">

The http://forums.lavag.org/downloads-file87.html' target="_blank">Scripting Tools toolkit in the code repository has, as an example, a little program that can be put into your project folder that will find all wire references and run the clean-up wire method on them. The toolkit is LV 8.2, so if you're using 8.0 then it's not much use to you.

</plug>

Link to comment

Here's a utility that uses scripting in 8.x to perform the cleanup wires using two core VIs located in the "<LabVIEW>\vi.lib\Utility" directory.

Details on those two VIs:

"allVIsInMemory.llb\Get User Application Reference.vi" gets the application reference of the launching VI using the output of the "App.MenuLaunchVI" scripting property node.

"traverseref.llb\TRef Traverse for References.vi" gets all of the object references in the VI to search for wires.

I couldn't get the "scripting tools:Get all Objects.vi" to work in LV 8.2.1. It would gather objects, but probing into it on my system I found that it couldn't find any wires. Not sure why, but Jim Kring pointed out that the traverseref.llb VIs were updated by NI and that one seemed to work fine for me in both LV 8.0.1 and LV8.2.1.

I put the following VI into my <LabVIEW>/project directory in LV 8.0.1 and LV 8.2.1 and it shows up in the "Tools" menu as "Clean Up Wires...". Let me know how this works for you*

http://forums.lavag.org/index.php?act=attach&type=post&id=6235 (LV8.0.1)

*note: I couldn't figure out how to set the docmods so that LabVIEW would know that the VI had changed (hence prompting for a save on close) after this VI executes. Can anyone help me out with that?

Link to comment

UPDATE:

--------

I've fixed the "Clean Up Wires.vi" utility so that it works with Undo and records modifications on the BD (prompts for save). I'm unsure though whether the desired undo behavior would be to undo each wire individually or to undo the whole cleanup in one shot. The current version works on each wire individually.

http://forums.lavag.org/index.php?act=attach&type=post&id=6248 (LV8.0.1)

Link to comment

QUOTE(orko @ Jun 27 2007, 06:44 PM)

UPDATE:

--------

I've fixed the "Clean Up Wires.vi" utility so that it works with Undo and records modifications on the BD (prompts for save). I'm unsure though whether the desired undo behavior would be to undo each wire individually or to undo the whole cleanup in one shot. The current version works on each wire individually.

Each wire individually doesn't sound intuitive to me. Usually every user action is considered an Undo Transaction and selecting your wiring cleaner tool in the menu would seem to me one single user action. Imagine your tool doing 500 wire modifications and then the user realizes he wants to undo the operation just before he selected your tool. Ouch!!!!!!

Rolf Kalbermatter

Link to comment

QUOTE(orko @ Jun 26 2007, 11:19 PM)

Ah, yes. I had a slight failure to engage brain when I wrote my version. It'll be fixed in the next release of the Scripting Tools (a Wire is a GObject, but isn't returned by the All Objects[] method of the Diagram class...). Using the Traverse for References is neater in many ways I suspect, but why not ask Traverse for References just to return Wire class references, rather than GObjects and then filtering as at present ?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.