diff --git a/common/lib_id.cpp b/common/lib_id.cpp index ae8dcf121b..b276997c32 100644 --- a/common/lib_id.cpp +++ b/common/lib_id.cpp @@ -258,7 +258,7 @@ UTF8 LIB_ID::Format() const UTF8 LIB_ID::GetLibItemNameAndRev() const { - UTF8 ret; + UTF8 ret = item_name; if( revision.size() ) { diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index cb93181842..e1d72be034 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -927,8 +927,12 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const } } - m_out->Print( aNestLevel, "(module %s", - m_out->Quotes( aModule->GetFPID().Format() ).c_str() ); + if( m_ctl & CTL_OMIT_LIBNAME ) + m_out->Print( aNestLevel, "(module %s", + m_out->Quotes( aModule->GetFPID().GetLibItemNameAndRev() ).c_str() ); + else + m_out->Print( aNestLevel, "(module %s", + m_out->Quotes( aModule->GetFPID().Format() ).c_str() ); if( aModule->IsLocked() ) m_out->Print( 0, " locked" ); diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index ed85bc0942..5de7ded02c 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -81,7 +81,8 @@ class TEXTE_PCB; //#define SEXPR_BOARD_FILE_VERSION 20200818 // Remove Status flag bitmap and setup counts //#define SEXPR_BOARD_FILE_VERSION 20200819 // Add board-level properties //#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information -#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes +//#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes +#define SEXPR_BOARD_FILE_VERSION 20200829 // Remove library name from exported footprints #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag @@ -93,6 +94,7 @@ class TEXTE_PCB; #define CTL_OMIT_AT (1 << 5) ///< Omit position and rotation // (always saved with potion 0,0 and rotation = 0 in library) //#define CTL_OMIT_HIDE (1 << 6) // found and defined in eda_text.h +#define CTL_OMIT_LIBNAME (1 << 7) ///< Omit lib alias when saving (used for board/not library) // common combinations of the above: @@ -101,7 +103,7 @@ class TEXTE_PCB; #define CTL_FOR_CLIPBOARD (CTL_STD_LAYER_NAMES|CTL_OMIT_NETS) /// Format output for a footprint library instead of clipboard or BOARD -#define CTL_FOR_LIBRARY (CTL_STD_LAYER_NAMES|CTL_OMIT_NETS|CTL_OMIT_TSTAMPS|CTL_OMIT_PATH|CTL_OMIT_AT) +#define CTL_FOR_LIBRARY (CTL_STD_LAYER_NAMES|CTL_OMIT_NETS|CTL_OMIT_TSTAMPS|CTL_OMIT_PATH|CTL_OMIT_AT|CTL_OMIT_LIBNAME) /// The zero arg constructor when PCB_IO is used for PLUGIN::Load() and PLUGIN::Save()ing /// a BOARD file underneath IO_MGR.