aitorB Posted August 7, 2019 Report Share Posted August 7, 2019 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) 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. 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. Quote Link to comment
Gribo Posted August 7, 2019 Report Share Posted August 7, 2019 OpenG has a 'Get parent VI reference' VI, It might help you. Quote Link to comment
aitorB Posted August 7, 2019 Author Report Share Posted August 7, 2019 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. Quote Link to comment
Darren Posted August 7, 2019 Report Share Posted August 7, 2019 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 1 Quote Link to comment
aitorB Posted August 8, 2019 Author Report Share Posted August 8, 2019 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 Quote Link to comment
Darren Posted August 8, 2019 Report Share Posted August 8, 2019 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.