Part connector name rules

What are the real rules for names of connectors when creating parts? The wiki says

it is important to note that within a part, a connector’s name and id attributes must be unique—that is, no two connectors in a given part should have the same id or the same name.

However, there are plenty of existing parts that have multiple connectors with the same name. Like multiple ground connectors all named GND. And they seem to work fine.

AFAIK, id must be unique, name not. FritzingCheckPart.py actually has the capability for checking name uniqueness, but I disabled it by default (there is a switch to re enable it) because so many parts do have identical names without apparent issue. I however haven’t actually traced name through the source to see if there is a case where name must be unique, it doesn’t appear so, but there may be edge cases.

Peter

That has been my understanding and experience as well. But that wiki reference brought up concerns, since that was a possible overlap with the issues I was seeing with bus and shield part building. The bused connectors tend to have duplicate names. Another possible edge case is the obsolete process. The Connectors information in the Part File Format wiki article says that the name value can be used as the target of a “replacedBy” attribute on a connector in the obsoleted part. Which will not work unless it is unique. I had to use that for one case, but just avoided the problem by specifying the id instead.

I have also been looking at hybrid connectors as a method of implementing some of the features I wanted with the shield part. Again, duplicate names are common enough to wonder if what is causing problems. So far I have not found a working example that uses a hybrid connector that is also part of a bus. They exist in core parts, but I find issues with all I have looked at so far. The Hybrid connectors entry on the wiki says it is a connector that is not visible in certain views. I have not gotten that to fully work. Even without a bus. I can get it to be graphically invisible, but hover/click can still bring up information, and ratsnest wires can still land there. So far hybrid is no more help than hiding a connector by placing another one (from the same bus) directly on top. Which is what I am doing in the latest version of the Dragino LoRa shield. That latest version does not have any duplicate names any more either.

Given some of the symptoms, it looks like several of the “optional” features defined for part definitions were implemented in isolation. They do not work in combination. Or have undocumented constraints.

Sorry about the late reply, my internet link is mostly dead until I can arrange an upgrade. I searched the source, and indeed at least parts editor and possibly others are creating an indexable field from this attribute so it should be unique. It is unclear to me that it really needs to be though, it may be a good bet to change things to make it like the description field. If we don’t do that, I’ll re enable the test in FritzingCheckPart and make it an error so the field does need to be unique (the code is there just currently disabled.)

Peter