From f4e22cdcdb4eb7f230e0fdea2a39775e93870f66 Mon Sep 17 00:00:00 2001 From: Vincenzo Fortunato Date: Fri, 27 Jan 2023 16:28:38 +0000 Subject: [PATCH] altium: import component image only if part id matches --- eeschema/sch_plugins/altium/altium_parser_sch.cpp | 1 + eeschema/sch_plugins/altium/altium_parser_sch.h | 1 + eeschema/sch_plugins/altium/sch_altium_plugin.cpp | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index abcb15d2ae..b41ebe25ba 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -726,6 +726,7 @@ ASCH_IMAGE::ASCH_IMAGE( const std::map& 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", "" ); diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index d20230732f..1239e1c493 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -704,6 +704,7 @@ struct ASCH_JUNCTION struct ASCH_IMAGE { int indexinsheet; + int ownerindex; int ownerpartid; wxString filename; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index d96be684ac..3596bbc620 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -2724,6 +2724,13 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map& 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 bitmap = std::make_unique( center );