Jump to content

How to relate the terminals and endpoints of a wire?


Recommended Posts

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.

Link to comment

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.

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.