LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

What is up with the DeleteJoint method?

Solved!
Go to solution

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?

0 Kudos
Message 1 of 4
(4,321 Views)
Solution
Accepted by topic author Darin.K

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.

0 Kudos
Message 2 of 4
(2,820 Views)

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".

0 Kudos
Message 3 of 4
(2,820 Views)

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):

  1. How do you know which diagram to drop your bundle nodes on?  I generate a "diagram stack" for my wiring path.  The diagram stack is a list of diagram references in the order the wire must go through them.  I also keep the inflection point index, that point at which the diagram depth from the main diagram stops getting smaller and starts getting bigger.  I find the diagram for each bundle by searching from the source diagram to the inflection point, then from the sink diagram to the inflection point.  I look at the bounds of each diagram and stop at the first one that contains the bundle coordinates.  You can speed this up by caching things and remembering you do not have to search all diagrams, just from the last point you found something.
  2. How do you generate the path?  You can let LabVIEW do it for you by setting the autoroute boolean on the method to TRUE.  The works fairly well, but on complex diagrams, it tends to time out. When this happens, you are left with a simple line or L shape.  This almost always happens when you cross diagram boundaries.  Or you can roll your own wire routing algorithm.  I have written a depth-first Dijkstra algorithm, but it took awhile (and unfortunately is currently proprietary, so I can't share it).  You can find the priority queue I used on the standard LabVIEW forums.  You will need to take into account all other objects on the block diagram.  Use scripting to find their locations and extents.  Don't forget wires.  Don't forget that for multi-level structures, you only need to take into account one level.  Yes, this is truly an infinite time sink...

About now, diagram cleanup should be looking very good.  Let me know if I can clarify anything.  This was once over very lightly.

Message 4 of 4
(2,820 Views)