Jump to content

How to tag objects


Stardom

Recommended Posts

I didn't look at the code, but I assume it uses the tagging methods. These methods are private and should be available for the GObject class (which tunnels and sequences inherit from). Specifically, there's a Set Tag method which gets a tag name and value. I don't think they're accessible if you use the scripting API, but they should be available if you use the superprivate INI key.

LV 8.6 and later has VIs in vi.lib which allow reading and writing tags, but they namespace the tags, so they might not help you.

Link to comment

So how am i supposed to get the refnum of the tunnel for these vis? I was hoping there was some easy method of clicking an object and setting the tag while im in the edit mode for the vi. I dont want to do this from scripting, it is a static template after all, but it sounds almost like i would have to change the tag of the object using a script which accessed the vi, somehow found the tunnel references, and then called the get tag/set tag methods using the refnums?

Link to comment

So how am i supposed to get the refnum of the tunnel for these vis? I was hoping there was some easy method of clicking an object and setting the tag while im in the edit mode for the vi. I dont want to do this from scripting, it is a static template after all, but it sounds almost like i would have to change the tag of the object using a script which accessed the vi, somehow found the tunnel references, and then called the get tag/set tag methods using the refnums?

Yes, this is exactly what you would have to do. That's the only mechanism that exists.
Link to comment

Yes, this is exactly what you would have to do. That's the only mechanism that exists.

Is there any way to customize labview so that you can double click on any object and it would show the value of an existing tag for the object? It would be much easier to identify an object this way . Then i could just write a unique tag value to each object...

Link to comment

Is there any way to customize labview so that you can double click on any object and it would show the value of an existing tag for the object?

Sort of, but you would have to build it yourself. Both the BD and the FP have a property called Selection List[] which returns an array of reference to all selected objects. You can go over all the objects in that list and get or set their tags.

If you want a leg up, there are a few frameworks which allow writing selection-based utilities (JKI right-click framework, Quick Drop shortcuts and LVSpeak, do a search). You can also build a floating tool which will be open all the time which is useful if you're going to do several of those in sequence. Do a search for "scripting springboard" to see an example and a tutorial.

Link to comment

Sort of, but you would have to build it yourself. Both the BD and the FP have a property called Selection List[] which returns an array of reference to all selected objects. You can go over all the objects in that list and get or set their tags.

Is there a way to find the tags if you don't already know the names?  The Tag.Get Tag method requires a Tag Name.

post-7534-127072262941_thumb.png

Stardom, this is a way to get the SelList[] using a VI kept in the Projects folder.

Link to comment

Is there a way to find the tags if you don't already know the names?

Not as far as I know. You could try hacking it out of the binary data, but I don't think it's worth the effort. I have some vauge recollection that the tags are saved somewhere in the VI in a global table (i.e. separate from the control itself), but that's an implementation detail and not much help if you don't know what the binary structure of the VI is. In any case, this is less of an issue than it might seem at first, because to do something with the tag you need to have code running which expects the specific tag. I agree that there are cases which potentially could benefit from being able to list tags (e.g. if you want to dynamically invoke some code without having to scan for each of the values in advance), but this can be worked around.

Also, just to clarify - the VI class does have a method for getting the tag names. The GObject class does not.

Link to comment

For some reason I seem to also have a vague recollection of seeing something like that. Tag Name is a required input, so you have to wire it, but maybe there's a special string for this? An empty string, * and ? don't work. It's quite possible I'm confusing this with something else.

Also, one correction (not that it's particularly important) - the methods belong to the Generic class, not GObject.

Link to comment

How do you gain access to that private method?

I tried

SuperSecretPrivateSpecialStuff=True

in my ini file, but when i created an invoke node which was connected to the GObject, the only method i found was

SetHeapDocModForObject and Object Highlight.

Link to comment

I managed to create what i wanted using the sprinboard thing. Im still not sure how to gain access to private methods though.....

You need Scripting Workbench and/or PMS Assistant.

I drilled into this topic a little bit and here is VI to read all tag names from VI of given reference. It gets only persistent tags. LV 8.2 - it uses resource manager library, I'm not sure wether it is in same place in newer versions.

Get VI Tag Names.vi

Link to comment

it uses resource manager library, I'm not sure wether it is in same place in newer versions.

It's not, at least in 2010. I didn't bother looking for where it is. Anyway, this seems to be the binary hacking method I refered to earlier.

The tag methods should be accessible either by installing the scripting API from NI or adding the correct superprivatekey (or both, for all I know). That's all I have on my machine and I see them.

Link to comment

I am attempting to find how i can tag objects in vi templates as in the example in the codebase:

http://lavag.org/ind...ads&showfile=58

Specifically,

array dimension array - array 1D template.vi

In it, two tunnels are tagged (with the number 0 and 2) and the sequence is tagged as 'script.'

Thanks :yes:

Since you've already got the Array XNides I'm guessing you will have the Scripting Tools package as well ? If you have, then you also have (in the examples folder) a VI that will allow you to set tags on objects in the block diagram.

That is in fact the routine that is used for tagging the template in the all the array XNodes. The Scripting Tools also includes routines to wire and XNode's terminals by tag (which is why the tunnels have 'odd' tags - they correspond to the names of the terminals in the XNode. The basic approach is to move the object tagged as 'script' into the XNode's working diagram, then connect wires to all objects that are tagged with the same name as the terminal name. If the number of inputs is constant then the Generate Code ability is simply needs to select the correct template as a static VI reference and then do the move and wire operations.

Link to comment

Alright, so recently ive run into some trouble with using the scripting tools package. I've been attempting to tag an array control, but when i copy it from the template (the tempmlate consists of a numeric array which is tagged, thats all) and move it to a new vi, the tag disappears! I've noticed that the tag doesn't disappear on the sequences and tunnels used in the example vi's, but they disappear for array controls.

See thte attached screenshot. The first 'find and move' works, but then the find tag doesn't find anything afterwards. However, i can successfully retrieve the tag using the 'tagged object output' of 'find and move'.

Anyone?

post-17346-127144092933_thumb.png

Link to comment

Alright, so recently ive run into some trouble with using the scripting tools package. I've been attempting to tag an array control, but when i copy it from the template (the tempmlate consists of a numeric array which is tagged, thats all) and move it to a new vi, the tag disappears! I've noticed that the tag doesn't disappear on the sequences and tunnels used in the example vi's, but they disappear for array controls.

See thte attached screenshot. The first 'find and move' works, but then the find tag doesn't find anything afterwards. However, i can successfully retrieve the tag using the 'tagged object output' of 'find and move'.

Anyone?

Ok, that's weird.

The only thing I can see that looks a bit odd on your BD is that it looks like you have a new line after Tag0 on the Find Tagged Object. Unless you tell it to do a regular expression search then it will do an exact string match. It may be that you want to use the Get Tag routine instead which doesn't check the value (I'm sure there is a good reason why the Find Tag... methods filter on the tag value but I can't for the life of me remember why now !)

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.