02-11-2016 09:52 AM
So lets say I have a VI. Using scripting I can find all objects of a particular type on the block diagram. Now is there an easy way to say draw a Disabled Diagram structure around all nodes I found?
Like lets say I want to find all property nodes on a block, and disable them. The only solution I found was to find all property nodes, using the Traverse for GObjects, then I can make a new Disabled Structure with the New VI object, place it at the same location, and bounds as the property node, with the same owner. But then I still need to move the property node into the disabled case of the structure. But then I have all kinds of broken wires that were once wired to the property node that I now moved. I then need to figure out how it was wired before the move, wire it to the tunnel of the Disabled Structure, then wire from the tunnel to the terminal on the property node. I need to do this for each terminal wired, and for each property node. And then I need to wire through the enabled case of the structure.
What I was hoping to find is a way to draw the disabled diagram structure using scripting, but perform the same action as if I drew the structure, and have this also put any nodes I captured with my draw, into the disabled case. Is there a way to do this with scripting? Can someone think of an easier way to disable nodes using the Disabled Diagram structure? Thanks.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
Solved! Go to Solution.
02-11-2016 10:59 AM
Try using the Enclose Selection method. There's a shipping example for it here:
examples\Application Control\VI Scripting\Moving Objects\Enclose Selection And Move.vi
...aaaand I'm just now finding out after opening that example that somebody deprecated that method recently in favor of a new Enclose Selection 2 method. I'll get the example updated.
Anyway, the weird thing about this method is that you have to give the method a reference to an actual structure to define what type of structure you want to wrap the code with. This usually requires dropping a dummy structure, calling Enclose Selection 2, then deleting the dummy structure after the code gets wrapped.
02-11-2016 11:05 AM - edited 02-11-2016 11:07 AM
This might help get you on the right track. I couldn't figure out how to delete the dummy structure afterwards though... I was going off a post by Yair in LAVA:
https://lavag.org/topic/19208-insert-conditional-disable-structure-around-call-library-nodes/
Edit: And after working for 15 mins and posting I see Darren's well explained post above
02-11-2016 06:45 PM - edited 02-11-2016 06:54 PM
@ gregoryj : your file "Enclose in Disable.zip" ... just a small problem (the "main problem")
the other problems are secondary
02-12-2016 07:38 AM - edited 02-12-2016 07:40 AM
What Greg posted for demonstration purposes was perfect. Yeah there is a coercion dot but who cares it is just a more specific class, and yeah he forgot to close some references, and sure he wrapped his disabled structure in a disable structure, but based on my description he knows I wouldn't have been using this on all Nodes, but instead an array of Nodes that matched some search criteria. Thanks everyone for your help, now I just need some time to implement these improvements.
Oh and while we're closing references you forgot to close the new Enclose Selection 2 output which is the new structure made.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
02-12-2016 09:03 AM - edited 02-12-2016 09:09 AM
...and sure he wrapped his disabled structure in a disable structure
yes, after the Invoke Node "Delete", there remains a disable structure on the BD. My comment was just for this, nothing else.
If you put the "New VI Object" to the right place, this problem does not occur.
you forgot to close the new Enclose Selection2 output : indeed, you are right.
02-12-2016 09:15 AM
Thank you Ouadji,
I thought it was not deleting the structure, I didn't realize it had been wrapped in another structure itself!
02-12-2016 09:28 AM