Jump to content

Vanishing reference - how to idenify object on a diagram


Recommended Posts

The problem is:

I'm taking a reference to a topmost VI and set some properties to some objects on its block diagram using SetTag method of GObject class. I'm getting references to these objects from selection list, so I do not care where these objects are located. Now I would like to store information on which objects I modified (lets say using SetTag method of top level diagram). Storing references themselves obviously does not work, because they change each time VI is closed and opened again. So how to identify an object somewhere deep in diagram structure, not to have to traverse whole diagram each time VI is opened, searching for the particular tags?

I thinked of creating sth like object's address by recursively checking what is and index of the object in its parent's AllObjects[] property. But such approach is somewhat too complicated, as not all block diagram objects exist in AllObjects[] array (i.e. wires do not), so they need special handling. I'm also not sure whether such addressed would be "resistant" to modifications in block diagram.

I'm working on tool which would dynamicly "tie" comments to particular objects - i.e. to top-left corner of a loop to keep it there even if loop is resized, or to a wire. It may be also more general block diagram grouping tool (Yen, don't even say this...). So it would be good to store information about groups created when VI is closed.

BTW - GObject class has a Traverse method - anyone knows what is it for and how to use it?

Link to comment

First I suggest strongly that you do traverse the diagram and search for tagged items. That is the safest way to guarantee that the tags remain when objects are copied or moved or when the diagram is edited in an environment where the tool is not being used. Second there is no straight forward way to get a unique static indentifier for each graphic object I can think of.

Consider the following situation. You have two identical case structures with both the same label. The only identifier you can get for such a structure is the structure label. Because the label is the same for the two structures, it is no longer unique. You could try to make the identifier unique by using the position and the label pair as an identifier. However, the position of a gobject is not either unique but multiple objects can have same position as well. I would say all build in scripting properties are non-unique that is each property value can be shared with multiple objects.

The only unique identifier I can think of is one that you write by yourself as a tag to the objects. If you assign all objects on block diagram a unique tag, then you would have a ID scheme that would allow you to identify objects on block diagram uniquely and would allow you to locate them without traversing all diagram objects or at least some subspace of all diagram objects. Howevere this doesn't solve the problem of moving items as then the path to the object becomes invalid. I guess it's impossible to track all movements of any object unless you have access to LabVIEW source code.

Tomi

Link to comment

QUOTE(vugie @ Feb 28 2008, 12:18 PM)

You're off the hook in this case. I did create http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=270836#M270836' target="_blank">a very simplistic demo of using tags to control the size and position of FP elements, but not for the BD. Also, that was just a proof of concept example - it didn't even move the controls.

By the way, there is a VI for traversing the diagram in <vi.lib>\Utility\traverseref.llb, but I don't know if it will help you.

Link to comment

QUOTE(vugie @ Feb 28 2008, 11:18 AM)

I'm working on tool which would dynamicly "tie" comments to particular objects - i.e. to top-left corner of a loop to keep it there even if loop is resized, or to a wire.

Why? This can be done in LabVIEW normally. No need for tagging.

If you show the label of a loop it will (by default) stick to the loop.

And a loop can have a description as well.

Ton

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.