SDietrich Posted October 24, 2014 Report Share Posted October 24, 2014 Hi all, I want to write a quick drop plugin and it will deal with selecting things on the block diagram. It needs to traverse along wires to find things that are connected to the object the user selected. So the first question is: How do I get all terminals (or wires) of a GObject? TopLvlDiag.SelList[] returns an array of GObjects and that does not have a property like Wires[] or Terms[]. At the moment I tend to use a big case structure and cast the GObject to whatever class the object is (Node, Constant, Tunnel, ...) and use the Terms[] property of that. Isn't there are more elegant, easier and less error prone method? FYI: I already have SuperSecretPrivateSpecialStuff=True. Thanks for any idea or advice. Quote Link to comment
hooovahh Posted October 24, 2014 Report Share Posted October 24, 2014 Use the Traverse for GObjects function on the palette. Provide it a reference to the VI and tell it to search on the block diagram. As for the class to search for enter "Wire". It will return all the references of that class type on the block diagram but it will be returned on generic GObjects. You'll need to use the "More Specific Class" to turn it into a wire reference. Quote Link to comment
SDietrich Posted October 24, 2014 Author Report Share Posted October 24, 2014 Use the Traverse for GObjects function on the palette. Provide it a reference to the VI and tell it to search on the block diagram. As for the class to search for enter "Wire". It will return all the references of that class type on the block diagram but it will be returned on generic GObjects. You'll need to use the "More Specific Class" to turn it into a wire reference. Hm, that finds all wires on the block diagram, not just the ones connected to a GObject the user selected. But maybe I can check each wire for whether it is connected to the object in question. Thanks! Quote Link to comment
hooovahh Posted October 24, 2014 Report Share Posted October 24, 2014 Oh sorry I was confused. If the selected object is under the class "Node" then you can use the property node to read the terminals on it. Then for each terminal you can find the wire. Have you looked at the other shipped QuickDrop functions? It helps to see how others have done similar tasks 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.