SDietrich Posted October 24, 2014 Report Share Posted October 24, 2014 Hi all, a quick drop plugin I am currently working on needs to traverse along wires. Using Wire.Joints[] one gets a good representation of where the wire runs. And of course at every Endpoint there is a terminal, one that is returned by Wire.Terms[]. But how can I say which terminal is at which endpoint? The order is different for the endpoints and for the terminals. I could use the position and bounds to find out which terminal overlaps which endpoint, but this feels like some voodoo that will go wrong sooner or later. Any ideas or suggestions? FYI: I already have SuperSecretPrivateSpecialStuff=True. Quote Link to comment
hooovahh Posted October 24, 2014 Report Share Posted October 24, 2014 On each terminal you can use the "Is Source" property node and it will tell you if it is the source, or sink of a wire. By the way I believe index 0 is always a source and the last element is always a sink. Quote Link to comment
SDietrich Posted October 24, 2014 Author Report Share Posted October 24, 2014 Thanks hooovahh, but I think have to elaborate a little more. At the moment, I don't care for source and sinks. The idea is more to go along a wire and sum up the lengths in pixels or the number of junctions, bends and so on. So I end up having an endpoint and I need to know, what terminal it is connected to so I can find the object and work on from there, e.g. highlighting it or getting the name of the object or so. So if the first endpoint always is the source (and a non-broken wire has only one source) that is a good start. But I also need to get the terminals for the sinks. Quote Link to comment
Darin Posted October 24, 2014 Report Share Posted October 24, 2014 I have not found much that goes wrong by relating the position to the endpoint. The only tricky thing to remember is that one endpoint can have more than one terminal. Of course I have tried for years to convince people that no purpose is served by allowing terminals, tunnels and the like to be overlapping but I am basically alone on that one. Basically I have stopped sharing scripting code because I get tired of having to check for these kind of special cases that complicate and obfuscate my code. I prefer to keep it for personal use only and then I know that most of these corner cases are ruled out. 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.