07-16-2010 09:40 AM
Many times when I am shuffling wires the DeleteJoint method appears to be what the Dr. ordered, however I have no idea what it is supposed to do since it always gives me a 'Method Not Found' error at runtime. On a related note, my current methods of deleting wire branches are a bit klunky, any advice?
Solved! Go to Solution.
07-19-2010 07:36 AM
A “Method Not Found” error means you have found a method that was not implemented. This generally means the method was put in the header file, but never actually written. Thank you for finding this one. I have filed CAR 240790 on the problem.
I feel your pain on wire routing issues. The current scripting interface does not have a good method of routing wires, especially if you are going into and out of structures. Unless you have a very complex VI, I would recommend using the diagram cleanup as your final scripting call. This cleans up everything and saves you the pages of code used to place things nicely. This can easily end up being an infinite time sink. However, if you want some tips on doing things the hard way, let me know.
07-19-2010 12:01 PM
Thanks. I guess that means the header will go change, not that the method will be implemented. Of course you sensed the final source of my frustration, wiring into and out of structures.
My usual hard way is to generate a list of terminals of a wire connected to a terminal, and remove that terminal from the list along with the ones I want to remove. Then I delete the wire and then connect the terminals back. My pain usually stems from some collateral damage done by deleting the wire. Most times it is very helpful that LV will automatically delete some bad wires, but orphan terminals on a structure are often removed as well (for example). Then I get an error trying to reconnect.
Diagram Cleanup is one of my best friends and I do defend its honor whenever possible for this very reason. (I don't go near my own code with it). Before I learned how to properly undo it, I was ready to abandon scripting. Scripting without BDCT would be a nightmare. Along the way I tend to clean wires a lot as well, LV has done some funny things to me.
I would enjoy a little insight into your "hard way".
07-19-2010 02:34 PM
There are two methods you can use to connect wires from one terminal to another - Connect Wire and Create Described Wire. The former will connect two terminals on the same or different diagrams using a simple line or L shaped wire. The latter will connect two terminals on the same diagram using control points to describe the shape of the wire (note that the control points are in y,x order, not the usual x,y). So, there is no native support for creating a directed wire from on diagram to another. My standard workaround is to create a bundle node at every point I want a wire kink, wire to one of the bundle terminals (the same terminal every time), then delete the bundle nodes when done. The wire stays behind in the proper location. You can see this in action if you use the DAQ Wizard for anything complex or watch code generation of SignalExpress. Bundle nodes are used because they can accept any data type. You will run into two issues (both of which could be infinite time sinks):
About now, diagram cleanup should be looking very good. Let me know if I can clarify anything. This was once over very lightly.