Jump to content

Get external Refnums from inside a SubVI


aitorB

Recommended Posts

Good morning,

I am new on writing on this forum so I hope the question can be placed here, as it is related with Scripting. I have a main VI where I place an small round shaped SubVI, for debugging purposes. I need that SubVI to take (WHEN RUNTIME) the information of the Wire Tag connected to it. And not only that Tag but aditional information related to other blocks near it.

My main VI is shown at the first image. This is the VI I want to debug, but it could be any (This is an small example to try to make the code work)image.png.2c990ac5f4d383a17ed9a54dc1364e99.png

This is the code I have generated into that "My Custom Probe VI". The code intends to retrieve the information shown at the image above.

image.png.ec0975ec09b985286a0699da3358f3e2.png

So, I can get information from the current VI wire (The VI acting as SubVI), but not from the wire at the main VI, that is what I would like to do. After having the reference to that wire I guess I could find any other reference on that main VI. Is it possible to do what I need? And, if it is, what am I missing?

Thanks in advance,

Aitor.

Link to comment

The thing is I need the reference of that wire connected to my SubVI, if I get the parent reference then I can not know which VI is getting executed (As I may have and I will have (as shown at the image) more than one of that SubVIs) so I could take the information from that certain wire or going backwards any information from the main VI and not from the SubVI.

image.png.620343dd1a0d1002645da36743902c67.png

Link to comment

You may want to consider using a Data Agnostic Smart Probe instead of a subVI. From that probe, you can get a reference to the calling VI. And I think there are ways to figure out which probes are on which wires, etc.

Here's my nugget post on Data Agnostic Smart Probes: https://forums.ni.com/t5/LabVIEW/Darren-s-Occasional-Nugget-02-23-2018/m-p/3759109

  • Like 1
Link to comment
14 hours ago, Darren said:

And I think there are ways to figure out which probes are on which wires, etc.

So you mean I may do scripting inside that probe, by making that probe know on which wire it is located? On the other hand, that obligues me to have the probe watch window always opened, as if I close it then my probes disappear, right? By the way, I was planning to add those probes programatically where I needed, so if they disappear will not be a big deal either, as I can put them back again... Because there is no way that the probe watch window does not open, and the process of the probe happens at background, isn´t it?

Thanks in advance,

Aitor

Link to comment

I've written tools before that involved scripting probes onto wires. The way I facilitated communication between the executing probe and the scripting framework was through a named queue. I could pass the name of the probe VI (which ends up being the name shown in the first column of the Probe Watch Window) to my scripting framework. Meanwhile, my scripting framework had used the "AttachProbe" method of the Wire class to create the probe. This method returns a Probe reference, which you can then use with a property node to read the "ProbeVI" property, which gives you a VI reference, and you can read the VI Name property to match up which Probe VI got attached to which wire.

Note that the "ProbeVI" property is private, so you'll have to do some digging on how to enable private properties/methods if you haven't already. 

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
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.