Jump to content

can't get reference to subVI on BD


atradef

Recommended Posts

Hey guys,

I made a scripting VI that creates a new VI and places a case structure on its block diagram. It then places down several subVIs inside of the True case (the purpose of this is to force Labview to load these subVIs into memory). I can save and exit - this is all fine.

The problem is that when I try to delete these subVIs off the block diagram. I can get a reference to this VI and its block diagram, but when I call the "All objects" or "subVIs" property, Labview doesn't return references to those subVIs - only the case structure and the terminal. Is it because they're located inside of the case structure? Even if from the case structure reference I still can't get a reference to those subVIs so that I can delete them. Does anyone know if I can do this?

Thanks in advance.

Link to comment

QUOTE (Aristos Queue @ Apr 21 2009, 10:00 PM)

On the case structure, ask for the Diagrams property of the case structure. For each diagram, get the subVIs on that diagram. Repeat recursively for any nested structure on the diagram.

Amazing! Took me a while even with those exact directions, but I got it eventually. Thanks! :star:

Link to comment

QUOTE (atradef @ Apr 21 2009, 04:46 PM)

I can get a reference to this VI and its block diagram, but when I call the "All objects" or "subVIs" property, Labview doesn't return references to those subVIs - only the case structure and the terminal.

That's beacuse the subVIs aren't on the VI's diagram per se - they're on the case structure's case's diagram (each case in a case structure is a diagram owned by the case structure). You'll need to find the case structure (it's a great idea to label your case structures so you can find them by name) and then look at each of the cases (diagrams) inside it. So (I'm doing this from memory, so it might be a bit wrong) find the case structure through the AllObjs, then make the reference a case structure reference (use "to more specific class"), then you should be able to see all the diagrams in it (I *think* they're called "pages"?) - then you should be able to get AllObjs on the pages and see the subVIs.

Link to comment

QUOTE (crelf @ Apr 26 2009, 11:34 PM)

... then you should be able to see all the diagrams in it (I *think* they're called "pages"?) - then you should be able to get AllObjs on the pages and see the subVIs.

they are called "frames".

Link to comment
  • 3 years later...

Attached is a VI that searches recursively and returns all objects in the block diagram of the specified VI. I only handled the flat sequence, stacked sequence, while loop, for loop, event structure, disable structure, timed loop, timed sequence and in place element structure - if any more are needed they could be easily added. Figured it would at least be a starting point for someone trying to accomplish this.

- Becky

GetAllBDObjectsLV2011.vi

Link to comment

Also check out this VI.

<LabVIEW Dir>\vi.lib\Utility\traverseref.llb\Traverse for GObjects.vi

Traverse for GObjects.vi is available in Quick Drop/the palettes, so it's documented. It helps you find all the objects of a particular class within an arbitrarily nested panel, diagram, or object. As for finding a specific object with a specific label, there's a VI for that too, although it's not documented...check out <LabVIEW Dir>\vi.lib\Utility\traverseref.llb\TRef Find Object By Label.vi. This VI wraps Traverse for GObjects.vi with extra code to do the label matching. Let me know if y'all have any questions about either of these VIs (or any of the other goodies in traverseref.llb, for that matter).

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.