LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting Sometimes Deletes Wire

I have a reference to an output terminal of a SubVI call.  I execute this code to disconnect the terminal from the wire:

dt.png

Sometimes it just disconnects leaving the broken wire (which is what I want);  and sometimes the wire gets deleted (which I don't want because I need that wire later).

Whether or not the wire gets deleted seems to depend on which particular SubVI (in both cases it's an Express VI), and which particular terminal is involved.

I can't figure out what the difference is that sometimes causes the wire to disappear and sometimes remain intact.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 1 of 11
(1,382 Views)

Any chance it has to do with either bends in the wire or branches in the wire? I can't reproduce it right now, but I feel like I've seen wires behave differently if they're straight vs bent or maybe branched vs. single-wired.

0 Kudos
Message 2 of 11
(1,366 Views)

@BertMcMahan wrote:

Any chance it has to do with either bends in the wire or branches in the wire? I can't reproduce it right now, but I feel like I've seen wires behave differently if they're straight vs bent or maybe branched vs. single-wired.


That was my first thought; but nope.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 11
(1,359 Views)

Could LV's auto wiring algorithms be kicking in?

 

Also, is this reproducible and\or consistent?

0 Kudos
Message 4 of 11
(1,314 Views)

wiebe@CARYA wrote:

Could LV's auto wiring algorithms be kicking in?

 

Also, is this reproducible and\or consistent?


Turning off autowiring didn't help.

It's somewhat reproducible.  The attached code manifests the problem, but if you edit "BUG.vi", the problem sometimes goes away (and may come back if you edit again).

  1. Unzip the file.
  2. Open the block diagram of BUG.vi
  3. Double-click on the Express VI.
  4. Click "OK" to close the configuration window.
  5. The error wires will be lost.

The loss of the wires happens when 

paul_cardinale_0-1648566579297.png

 runs in "..\Universal Dialog Box\Support\Common\Utility\Scripting\Disconnect-Reconnect Wires on SubVI.vi"

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 11
(1,297 Views)

Just found it:  If the wire length is 32 pixels or less, the wire gets deleted, greater than that, and it remains intact.

"If you weren't supposed to push it, it wouldn't be a button."
Message 6 of 11
(1,293 Views)

@paul_cardinale wrote:

Just found it:  If the wire length is 32 pixels or less, the wire gets deleted, greater than that, and it remains intact.


Definitely not desirable behavior when you're scripting...

0 Kudos
Message 7 of 11
(1,277 Views)

wiebe@CARYA wrote:

@paul_cardinale wrote:

Just found it:  If the wire length is 32 pixels or less, the wire gets deleted, greater than that, and it remains intact.


Definitely not desirable behavior when you're scripting...


Same thing happens with manual editing.

Still scratching my head on a workaround.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 11
(1,256 Views)

@paul_cardinale wrote:

wiebe@CARYA wrote:

@paul_cardinale wrote:

Just found it:  If the wire length is 32 pixels or less, the wire gets deleted, greater than that, and it remains intact.


Definitely not desirable behavior when you're scripting...


Same thing happens with manual editing.

Still scratching my head on a workaround.


I guess a workaround is to 'record' the wire, disconnect the terminal, and if the wire is deleted, recreate the wire... If there's another terminal, you could use create described wire. If not, well, it's a lot of work... Both cases you loose the original UID...

 

You could try to re-route the wire (add joints, give it some length) so it isn't deleted. I suppose you can reroute in a way that it's easy to undo the rerouting.

0 Kudos
Message 9 of 11
(1,238 Views)

wiebe@CARYA wrote:

@paul_cardinale wrote:

wiebe@CARYA wrote:

@paul_cardinale wrote:

Just found it:  If the wire length is 32 pixels or less, the wire gets deleted, greater than that, and it remains intact.


Definitely not desirable behavior when you're scripting...


Same thing happens with manual editing.

Still scratching my head on a workaround.


I guess a workaround is to 'record' the wire, disconnect the terminal, and if the wire is deleted, recreate the wire... If there's another terminal, you could use create described wire. If not, well, it's a lot of work... Both cases you loose the original UID...

 

You could try to re-route the wire (add joints, give it some length) so it isn't deleted. I suppose you can reroute in a way that it's easy to undo the rerouting.


I discovered that the deletion won't happen if, after the disconnect, there are at least 2 terminals still connected.

So my workaround is:

  1. Place a wire-holder SubVI (it has a single terminal that's a variant)
  2. Connect the wire-holder SubVI to the wire.
  3. Disconnect the wire from the desired terminal.
  4. Delete the wire-holder SubVI

In the end, this leaves loose wire ends, so I have to remove those after I've reconnected.

"If you weren't supposed to push it, it wouldn't be a button."
Message 10 of 11
(1,203 Views)