atradef Posted April 22, 2009 Report Share Posted April 22, 2009 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. Quote Link to comment
Aristos Queue Posted April 22, 2009 Report Share Posted April 22, 2009 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. Quote Link to comment
atradef Posted April 23, 2009 Author Report Share Posted April 23, 2009 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! Quote Link to comment
crelf Posted April 27, 2009 Report Share Posted April 27, 2009 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. Quote Link to comment
vugie Posted April 28, 2009 Report Share Posted April 28, 2009 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". Quote Link to comment
JLMommy Posted September 27, 2012 Report Share Posted September 27, 2012 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 Quote Link to comment
hooovahh Posted September 27, 2012 Report Share Posted September 27, 2012 Also check out this VI. <LabVIEW Dir>\vi.lib\Utility\traverseref.llb\Traverse for GObjects.vi 1 Quote Link to comment
Darren Posted October 1, 2012 Report Share Posted October 1, 2012 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). 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.