Loops specification can't use pin labels?
I have a wire that should connect two pins on the same connector, and I discovered the "loops" feature. However, when I attempted to use it, I got this error:
exception: Unknown loop pin "6" for connector "P4601"!
From some experimentation, it appears that the loops lists only understands pin numbers, not pin labels? Is this intentional? It seems to go against the pattern used everywhere else where you can use numbers and labels interchangeably.
(This feature also seems a bit half-baked, honestly. I would need to specify the color and gauge of the wire used, so I'd need to make up a cable section for it anyway so these can be specified.)
I agree the current loops feature has limitations. Possible improvements are discussed in several issues, e.g. #48, https://github.com/wireviz/WireViz/issues/224#issuecomment-2163805131, #286, #350, and #439.
It seems the generic part of the pin mapping code in Harness.connect() needs to be moved into a new Connector.pin_index() method to be available from both Harness.connect() and from Connector.__post_init__() (the latter is where loop pins are processed).
Using the same pin mapping for both connections and loops should resolve both this issue and #465.
To enhance code readability, we should also clearly state where we use pin indexes (always zero based?) and where we use pin names (from pins attribute) and any other valid pin identifier (e.g. pinlabels). We can use different type hints for this, but I hope we also can use variable names that also helps the reader to understand.