vugie Posted February 29, 2008 Report Share Posted February 29, 2008 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? Quote Link to comment
Tomi Maila Posted February 29, 2008 Report Share Posted February 29, 2008 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 Quote Link to comment
Aristos Queue Posted February 29, 2008 Report Share Posted February 29, 2008 QUOTE(Tomi Maila @ Feb 28 2008, 08:04 AM) the tags remain when objects are copied or moved If the tagged object does get copied, the tags will be copied as well. That could be a problem depending on the type of application you're working on. Quote Link to comment
Yair Posted February 29, 2008 Report Share Posted February 29, 2008 QUOTE(vugie @ Feb 28 2008, 12:18 PM) It may be also more general block diagram grouping tool (Yen, don't even say this...). 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. Quote Link to comment
Ton Plomp Posted February 29, 2008 Report Share Posted February 29, 2008 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 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.