Jump to content

How to get all terminals/wires of a block diagram object?


SDietrich

Recommended Posts

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.

Link to comment

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.

Link to comment

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!

Link to comment

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.

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.