altium: import component image only if part id matches

This commit is contained in:
Vincenzo Fortunato 2023-01-27 16:28:38 +00:00 committed by Wayne Stambaugh
parent b72cc23a00
commit f4e22cdcdb
3 changed files with 9 additions and 0 deletions

View File

@ -726,6 +726,7 @@ ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProps )
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::IMAGE );
indexinsheet = ALTIUM_PARSER::ReadInt( aProps, "INDEXINSHEET", 0 );
ownerindex = ReadOwnerIndex( aProps );
ownerpartid = ReadOwnerPartId( aProps );
filename = ALTIUM_PARSER::ReadString( aProps, "FILENAME", "" );

View File

@ -704,6 +704,7 @@ struct ASCH_JUNCTION
struct ASCH_IMAGE
{
int indexinsheet;
int ownerindex;
int ownerpartid;
wxString filename;

View File

@ -2724,6 +2724,13 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map<wxString, wxString>& aPropert
{
ASCH_IMAGE elem( aProperties );
const auto& component = m_altiumComponents.find( elem.ownerindex );
//Hide the image if it is owned by a component but the part id do not match
if( component != m_altiumComponents.end()
&& component->second.currentpartid != elem.ownerpartid )
return;
VECTOR2I center = ( elem.location + elem.corner ) / 2 + m_sheetOffset;
std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>( center );