EAGLE: Prevent numeric-only component references

KiCad does not allow references to be numeric only.  This prefixes such
references with "UNK" to note that the reference designator type is
unknown.
This commit is contained in:
Seth Hillbrand 2019-05-20 19:47:32 -07:00
parent 490c805319
commit a62a89eac3
2 changed files with 18 additions and 3 deletions

View File

@ -1125,6 +1125,12 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
// with a hash character to mute netlist updater complaints
wxString reference = package.IsEmpty() ? '#' + einstance.part : einstance.part;
// EAGLE allows references to be single digits. This breaks KiCad netlisting, which requires
// parts to have non-digit + digit annotation. If the reference begins with a number,
// we prepend 'UNK' (unknown) for the symbol designator
if( reference.find_first_not_of( "0123456789" ) == wxString::npos )
reference.Prepend( "UNK" );
SCH_SHEET_PATH sheetpath;
m_rootSheet->LocatePathOfScreen( screen, &sheetpath );
wxString current_sheetpath = sheetpath.Path();

View File

@ -990,12 +990,21 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
switch( *a.display )
{
case EATTR::VALUE :
nameAttr->name = e.name;
m->SetReference( e.name );
{
wxString reference = e.name;
// EAGLE allows references to be single digits. This breaks KiCad netlisting, which requires
// parts to have non-digit + digit annotation. If the reference begins with a number,
// we prepend 'UNK' (unknown) for the symbol designator
if( reference.find_first_not_of( "0123456789" ) == wxString::npos )
reference.Prepend( "UNK" );
nameAttr->name = reference;
m->SetReference( reference );
if( refanceNamePresetInPackageLayout )
m->Reference().SetVisible( true );
break;
}
case EATTR::NAME :
if( refanceNamePresetInPackageLayout )
{