altium: parse symbol description, remove dependency on legacy plugin

This commit is contained in:
Thomas Pointhuber 2020-10-23 16:22:56 +02:00
parent 1cdb8b5584
commit 0d3d3e0d7c
3 changed files with 17 additions and 5 deletions

View File

@ -73,11 +73,18 @@ ASCH_COMPONENT::ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties
currentpartid = currentpartid =
ALTIUM_PARSER::PropertiesReadInt( aProperties, "CURRENTPARTID", ALTIUM_COMPONENT_NONE ); ALTIUM_PARSER::PropertiesReadInt( aProperties, "CURRENTPARTID", ALTIUM_COMPONENT_NONE );
libreference = ALTIUM_PARSER::PropertiesReadString( aProperties, "LIBREFERENCE", "" ); libreference = ALTIUM_PARSER::PropertiesReadString( aProperties, "LIBREFERENCE", "" );
sourcelibraryname = ALTIUM_PARSER::PropertiesReadString( aProperties, "SOURCELIBRARYNAME", "" );
componentdescription =
ALTIUM_PARSER::PropertiesReadString( aProperties, "COMPONENTDESCRIPTION", "" );
orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 ); orientation = ALTIUM_PARSER::PropertiesReadInt( aProperties, "ORIENTATION", 0 );
isMirrored = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISMIRRORED", false );
location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ),
-PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) );
partcount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PARTCOUNT", 0 );
displaymodecount = ALTIUM_PARSER::PropertiesReadInt( aProperties, "DISPLAYMODECOUNT", 0 );
displaymode = ALTIUM_PARSER::PropertiesReadInt( aProperties, "DISPLAYMODE", 0 );
} }

View File

@ -98,10 +98,17 @@ struct ASCH_COMPONENT
{ {
int currentpartid; int currentpartid;
wxString libreference; wxString libreference;
wxString sourcelibraryname;
wxString componentdescription;
int orientation; int orientation;
bool isMirrored;
wxPoint location; wxPoint location;
int partcount;
int displaymodecount;
int displaymode;
explicit ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties ); explicit ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties );
}; };

View File

@ -27,7 +27,6 @@
#include <plugins/altium/altium_parser.h> #include <plugins/altium/altium_parser.h>
#include <plugins/altium/altium_parser_utils.h> #include <plugins/altium/altium_parser_utils.h>
#include <sch_plugins/altium/sch_altium_plugin.h> #include <sch_plugins/altium/sch_altium_plugin.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <schematic.h> #include <schematic.h>
@ -175,8 +174,6 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
wxCHECK_MSG( libTable, NULL, "Could not load symbol lib table." ); wxCHECK_MSG( libTable, NULL, "Could not load symbol lib table." );
m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) ); m_pi.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
m_properties = std::make_unique<PROPERTIES>();
( *m_properties )[SCH_LEGACY_PLUGIN::PropBuffering] = "";
/// @note No check is being done here to see if the existing symbol library exists so this /// @note No check is being done here to see if the existing symbol library exists so this
/// will overwrite the existing one. /// will overwrite the existing one.
@ -200,7 +197,7 @@ SCH_SHEET* SCH_ALTIUM_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchem
libTable->Format( &formatter, 0 ); libTable->Format( &formatter, 0 );
} }
// Relaod the symbol library table. // Reload the symbol library table.
m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL ); m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
m_schematic->Prj().SchSymbolLibTable(); m_schematic->Prj().SchSymbolLibTable();
} }
@ -454,6 +451,7 @@ void SCH_ALTIUM_PLUGIN::ParseComponent( int index, const std::map<wxString, wxSt
LIB_PART* kpart = new LIB_PART( wxEmptyString ); LIB_PART* kpart = new LIB_PART( wxEmptyString );
kpart->SetName( elem.libreference ); kpart->SetName( elem.libreference );
kpart->SetDescription( elem.componentdescription );
kpart->SetLibId( libId ); kpart->SetLibId( libId );
m_symbols.insert( { index, kpart } ); m_symbols.insert( { index, kpart } );