LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting : How to get for a VI instance its own SubVI Refnum

Solved!
Go to solution

Anyway Aristos, it was kind to give it a try !

I think this should be possible since a double click on a subvi opens a clone. I mean this subvi instance and this clone are linked somewhere... but this is not accessible to "simple" LabVIEW users...

0 Kudos
Message 11 of 31
(5,044 Views)

Emmanuel,

not really being sure I understood your problem correctly I'd suggest a small SubVI (my solution is named 'curpath_advanced.vi') within your SubVI. Curpath_advanced itself can access some properties of its caller (AKA your instanced SubVI) by using the callchain node and some VI-server actions.

This way it can return the actual instance's name and could return the reference as well.

Here's the BD:

Bild1.png

My library is still in LV7.11, but this was opened in LV2013. I also replaced a subVI with its relevant content. But I think this is easy to rebuild and to adapt to your requirements.

HTH   and

Greetings from Germany!

--

LuI

0 Kudos
Message 12 of 31
(5,044 Views)

Lul, thanks for your help but it won't help... your VI deals with VI refnum... here, we're talking about subVI refnums...
Greetings from France

0 Kudos
Message 13 of 31
(5,044 Views)

Ha, got you!

Put the obove mentioned code in a NEW subVI that is placed into YOUR subVI. Than the first element of the array returned by the call_chain node is the instance the new SubVI is sitting in - which is what I understood you wanted to achieve.  Give it a short try, it works in several projects I have done so far using multiple instances of given vit's.

With this technique you can retrieve the Ref of your SubVI and return it its callers.

--

LuI

0 Kudos
Message 14 of 31
(5,044 Views)

Sorry Lul, what your code get is only VI refnum... not at all subVI refnum... those a re completely different objects...
You're speaking of the VI instance of a VI (yes, it's a subVI) and I am speaking of a diagram object subVI...

0 Kudos
Message 15 of 31
(5,044 Views)

So it seems the naming conventions for scripting objects seems to be not that specific.

Sorry for my wrong understanding...

0 Kudos
Message 16 of 31
(5,044 Views)

Please don't be sorry... it was so kind from you to take time on my problem.

To resume, in terms of typing, we could say (sorry this is from French LabVIEW) :

vi-vs-subvi.bmp

0 Kudos
Message 17 of 31
(5,044 Views)

I don't believe it is possible from G code to get this info. I searched through all of our public (and not so public) properties and methods to see if there would be any tricky way to do this. I also talked to some of the compiler/execution guys but did not find anything useful for you. LabVIEW obviously has this information internally so that it can have a first rate debugger. However, that information is not exposed to G code.

There might be some interesting/tricky way to gather this info, but I cannot think of a way to do it and could not find anyone who could.

0 Kudos
Message 18 of 31
(5,044 Views)

It seems that a VI express can do that (just take a look of a VI express) ... Am I wrong ?

0 Kudos
Message 19 of 31
(5,044 Views)
Solution
Accepted by topic author Manu56

Finally... if your VI is VI express then you can achieve this... what a mess !

0 Kudos
Message 20 of 31
(5,044 Views)