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.
(cherry picked from commit a62a89eac3
)
This commit is contained in:
parent
6f34f95c52
commit
ec6fd23636
|
@ -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();
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue