CharlesB Posted October 6, 2005 Report Share Posted October 6, 2005 Hi, I'm willing to make numerous Call library function nodes reentrant. Of course I thougth "scripting!" and started to code a VI that can find a CLFN, and make it reentrant. But when I tried I realized that since they are everywhere in my VIs, I need a fucntion that can get all objects in a BD, by recursing in the structures, cases, sequences... Has anyone done that, or is there an easy way to do this? :question: Thanks Quote Link to comment
WMassey Posted October 6, 2005 Report Share Posted October 6, 2005 Hi, I'm willing to make numerous Call library function nodes reentrant. Of course I thougth "scripting!" and started to code a VI that can find a CLFN, and make it reentrant. But when I tried I realized that since they are everywhere in my VIs, I need a fucntion that can get all objects in a BD, by recursing in the structures, cases, sequences... Has anyone done that, or is there an easy way to do this? :question: Thanks Easy enough to find them: I'm not too sure how easy it'll be to make them reentrant (have not looked at it, even for a moment). Quote Link to comment
Jim Kring Posted October 6, 2005 Report Share Posted October 6, 2005 Easy enough to find them: This routine will only work for CBR nodes that are directly on the block diagram. If they are located inside of other structures (like Case or Loop Structures), then they will not show up in the AllObjs[] list. You will need to recursively traverse the hierarchy of objects on the diagram, in order to make sure that you have looked in every location for the CBR functions. I don't have time to create an example; but I'll try to later, unless someone beats me to the punch. Quote Link to comment
CharlesB Posted October 6, 2005 Author Report Share Posted October 6, 2005 You will need to recursively traverse the hierarchy of objects on the diagram, in order to make sure that you have looked in every location for the CBR functions. I don't have time to create an example; but I'll try to later, unless someone beats me to the punch. That's what I'm currently doing, I will post this when I'm done. Thanks to both of you Charles Quote Link to comment
Jeffrey Habets Posted October 6, 2005 Report Share Posted October 6, 2005 That's what I'm currently doing, I will post this when I'm done.Thanks to both of you Charles Here's a nice example of how to recursively traverse the entire diagram. It can be easily modified for what you want I think. http://forums.lavausergroup.org/index.php?showtopic=308 Quote Link to comment
WMassey Posted October 6, 2005 Report Share Posted October 6, 2005 This routine will only work for CBR nodes that are directly on the block diagram. If they are located inside of other structures (like Case or Loop Structures), then they will not show up in the AllObjs[] list. You will need to recursively traverse the hierarchy of objects on the diagram, in order to make sure that you have looked in every location for the CBR functions. I don't have time to create an example; but I'll try to later, unless someone beats me to the punch. Woops! I missed the obvious. Attached is a VI that may come close to what you need however. Download File:post-2800-1128613768.zip Quote Link to comment
CharlesB Posted October 6, 2005 Author Report Share Posted October 6, 2005 Woops! I missed the obvious. Attached is a VI that may come close to what you need however. Thank you! :thumbup: Unfortunately I couldn't get it to work for my code (it doesn't find anything). I coded and attached something that works for me, any comments/corrections are welcome Download File:post-1401-1128614973.zip Quote Link to comment
WMassey Posted October 6, 2005 Report Share Posted October 6, 2005 Thank you! :thumbup: Unfortunately I couldn't get it to work for my code (it doesn't find anything). I coded and attached something that works for me, any comments/corrections are welcome What you posted and what I posted are slightly different in that yours returns all objects found and mine just returns one reference to each of the Call Library Function Nodes found which is what I thought you said you wanted in your original post. Hi, I'm willing to make numerous Call library function nodes reentrant. Of course I thougth "scripting!" and started to code a VI that can find a CLFN, and make it reentrant. But when I tried I realized that since they are everywhere in my VIs, I need a fucntion that can get all objects in a BD, by recursing in the structures, cases, sequences... Has anyone done that, or is there an easy way to do this? I guess I took it too far. Before I posted it I did run mine against a VI that had several Call Library function nodes in it and it did indeed pick them all out. Quote Link to comment
CharlesB Posted October 6, 2005 Author Report Share Posted October 6, 2005 What you posted and what I posted are slightly different in that yours returns all objects found and mine just returns one reference to each of the Call Library Function Nodes found which is what I thought you said you wanted in your original post. I guess I took it too far. Before I posted it I did run mine against a VI that had several Call Library function nodes in it and it did indeed pick them all out. I investigated a bit more, there are strange things in your VI; if the vi I'm gving in parameter is not opened, it finds nothing. If it is opened, it finds 2 Call Library Function Nodes over 6. I think it is because the recursion is not remembering every objects found in structures. Quote Link to comment
WMassey Posted October 6, 2005 Report Share Posted October 6, 2005 I investigated a bit more, there are strange things in your VI; if the vi I'm gving in parameter is not opened, it finds nothing. If it is opened, it finds 2 Call Library Function Nodes over 6. I think it is because the recursion is not remembering every objects found in structures. Well, it is setup to remove duplicate references. (You only need to modify the 1st instance of a Call Library function node that you find.) After all, you cannot have one instance of a node setup to be reentrant and another setup to non-reentrant. Again I think I took it too far for you. Quote Link to comment
djolivet Posted October 6, 2005 Report Share Posted October 6, 2005 I downloaded WMassey VI and started playing with it to see if it worked properly. However I went off track and instead modified to recursively search subVIs for call library functions. Note that the Call Library function refereces are not valid after the VI has been closed, so in this design you can only work with those nodes within the case structure. Denis Download File:post-1881-1128627159.vi Quote Link to comment
Mike Ashe Posted October 11, 2005 Report Share Posted October 11, 2005 I was just cobbling this up for some reporting, when you guys saved me the trouble. Thanks! I'll see if I can't add some stuff and return the favor soon. Quote Link to comment
Jim Kring Posted October 11, 2005 Report Share Posted October 11, 2005 Here is a programming challenge: Make the traversal routine generic, such that it accepts a callback (plug-in) VI reference, which is passed each object reference during the traversal. Let the plug-in VI decide what to do with the object reference -- in this case, it will determine if the object is a CBR node, and add it to a list. Quote Link to comment
Mike Ashe Posted October 13, 2005 Report Share Posted October 13, 2005 Here is a programming challenge: Make the traversal routine generic, such that it accepts a callback (plug-in) VI reference, which is passed each object reference during the traversal. Let the plug-in VI decide what to do with the object reference -- in this case, it will determine if the object is a CBR node, and add it to a list. Excellent suggestion. I'll see what I can do. Quote Link to comment
djolivet Posted October 17, 2005 Report Share Posted October 17, 2005 Here is a programming challenge: Make the traversal routine generic, such that it accepts a callback (plug-in) VI reference, which is passed each object reference during the traversal. Let the plug-in VI decide what to do with the object reference -- in this case, it will determine if the object is a CBR node, and add it to a list. Here is something I have been working on. The reason I started this was to try and create a better spell checker, but I haven't done much towards that end. The concept here is much like Jim suggested, except that a different VI is called for each type of object reference. This dynamic calling is only being done to populate a table right now, but what I had envisioned was to call a dedicated VI for a specific object type to pull out any text that needs to be spell checked. If explanations are required, let me know and I will post some Quote Link to comment
Mike Ashe Posted December 4, 2005 Report Share Posted December 4, 2005 Another nifty tool. Now if we could combine this with a file save/restore, we might have something for bookmarks too. (another thread on LAVA). Another nice mod would be to look in libraries or directories, ie maybe add a tree control to the left side. 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.