取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 11 条)
2,295 次查看

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 项奖励
2 条消息(共 11 条)
2,279 次查看

@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 项奖励
3 条消息(共 11 条)
2,272 次查看

Could LV's auto wiring algorithms be kicking in?

 

Also, is this reproducible and\or consistent?

0 项奖励
4 条消息(共 11 条)
2,227 次查看

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 项奖励
5 条消息(共 11 条)
2,210 次查看

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."
6 条消息(共 11 条)
2,206 次查看

@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 项奖励
7 条消息(共 11 条)
2,190 次查看

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 项奖励
8 条消息(共 11 条)
2,169 次查看

@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 项奖励
9 条消息(共 11 条)
2,151 次查看

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."
10 条消息(共 11 条)
2,116 次查看