CADSTAR PCB Archive Importer: Transfer Project to allow importing of Text Variables

This commit is contained in:
Roberto Fernandez Bautista 2020-12-13 17:28:47 +00:00 committed by Wayne Stambaugh
parent 6af4e57853
commit cde433c82e
4 changed files with 11 additions and 9 deletions

View File

@ -663,7 +663,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
unsigned startTime = GetRunningMicroSecs();
#endif
loadedBoard = pi->Load( fullFileName, NULL, &props );
loadedBoard = pi->Load( fullFileName, NULL, &props, &Prj() );
#if USE_INSTRUMENTATION
unsigned stopTime = GetRunningMicroSecs();

View File

@ -41,9 +41,11 @@
#include <limits> // std::numeric_limits
void CADSTAR_PCB_ARCHIVE_LOADER::Load( ::BOARD* aBoard )
void CADSTAR_PCB_ARCHIVE_LOADER::Load( ::BOARD* aBoard, ::PROJECT* aProject )
{
mBoard = aBoard;
mProject = aProject;
Parse();
LONGPOINT designLimit = Assignments.Technology.DesignLimit;
@ -1672,11 +1674,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTextVariables()
return true;
};
PROJECT* pj = mBoard->GetProject();
if( pj )
if( mProject )
{
std::map<wxString, wxString>& txtVars = pj->GetTextVars();
std::map<wxString, wxString>& txtVars = mProject->GetTextVars();
// Most of the design text fields can be derived from other elements
if( Layout.VariantHierarchy.Variants.size() > 0 )
@ -1707,7 +1707,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadTextVariables()
}
else
{
wxLogError( _( "Text Variables could not be set as there is no project attached." ) );
wxLogError( _( "Text Variables could not be set as there is no project loaded." ) );
}
}

View File

@ -43,6 +43,7 @@ public:
mLayerMappingHandler = aLayerMappingHandler;
mLogLayerWarnings = aLogLayerWarnings;
mBoard = nullptr;
mProject = nullptr;
mDesignCenter.x = 0;
mDesignCenter.y = 0;
mDoneCopperWarning = false;
@ -67,13 +68,14 @@ public:
* @brief Loads a CADSTAR PCB Archive file into the KiCad BOARD object given
* @param aBoard
*/
void Load( ::BOARD* aBoard );
void Load( ::BOARD* aBoard, ::PROJECT* aProject );
private:
LAYER_MAPPING_HANDLER mLayerMappingHandler; ///< Callback to get layer mapping
bool mLogLayerWarnings; ///< Used in loadBoardStackup()
::BOARD* mBoard;
::PROJECT* mProject;
std::map<LAYER_ID, PCB_LAYER_ID> mLayermap; ///< Map between Cadstar and KiCad Layers.
///< Populated by loadBoardStackup().
std::map<SYMDEF_ID, FOOTPRINT*> mLibraryMap; ///< Map between Cadstar and KiCad

View File

@ -88,7 +88,7 @@ BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppe
CADSTAR_PCB_ARCHIVE_LOADER tempPCB(
aFileName, m_layer_mapping_handler, m_show_layer_mapping_warnings );
tempPCB.Load( m_board );
tempPCB.Load( m_board, aProject );
//center the board:
if( aProperties )