From ad93396d353794685d1ce817603d3e20225b6fb3 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Wed, 14 Oct 2020 21:23:36 +0200 Subject: [PATCH] altium: parse no_erc record --- eeschema/sch_plugins/altium/altium_parser_sch.cpp | 14 +++++++++++++- eeschema/sch_plugins/altium/altium_parser_sch.h | 11 +++++++++++ eeschema/sch_plugins/altium/sch_altium_plugin.cpp | 15 +++++++++++++++ eeschema/sch_plugins/altium/sch_altium_plugin.h | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index e3b6fe221e..87aec7ad32 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -229,7 +229,7 @@ ASCH_POLYGON::ASCH_POLYGON( const std::map& aProperties ) ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map& aProperties ) { - wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::RECTANGLE ); + wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::ROUND_RECTANGLE ); ownerindex = ALTIUM_PARSER::PropertiesReadInt( aProperties, "OWNERINDEX", ALTIUM_COMPONENT_NONE ); @@ -314,6 +314,18 @@ ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map& aProperties } +ASCH_NO_ERC::ASCH_NO_ERC( const std::map& aProperties ) +{ + wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NO_ERC ); + + location = wxPoint( PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.X" ), + -PropertiesReadKiCadUnitFrac( aProperties, "LOCATION.Y" ) ); + + isActive = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISACTIVE", true ); + supressAll = ALTIUM_PARSER::PropertiesReadInt( aProperties, "SUPPRESSALL", true ); +} + + ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map& aProperties ) { wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::NET_LABEL ); diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index 67e88cb26c..0d05f182c1 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -321,6 +321,17 @@ struct ASCH_RECTANGLE }; +struct ASCH_NO_ERC +{ + wxPoint location; + + bool isActive; + bool supressAll; + + explicit ASCH_NO_ERC( const std::map& aProperties ); +}; + + struct ASCH_NET_LABEL { wxString text; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index 916d255fdd..6161e707c6 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -345,6 +345,7 @@ void SCH_ALTIUM_PLUGIN::Parse( const CFB::CompoundFileReader& aReader ) case ALTIUM_SCH_RECORD::PORT: break; case ALTIUM_SCH_RECORD::NO_ERC: + ParseNoERC( properties ); break; case ALTIUM_SCH_RECORD::NET_LABEL: ParseNetLabel( properties ); @@ -1051,6 +1052,20 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map& aPro } +void SCH_ALTIUM_PLUGIN::ParseNoERC( const std::map& aProperties ) +{ + ASCH_NO_ERC elem( aProperties ); + + if( elem.isActive ) + { + SCH_NO_CONNECT* noConnect = new SCH_NO_CONNECT( elem.location ); + + noConnect->SetFlags( IS_NEW ); + m_currentSheet->GetScreen()->Append( noConnect ); + } +} + + void SCH_ALTIUM_PLUGIN::ParseNetLabel( const std::map& aProperties ) { ASCH_NET_LABEL elem( aProperties ); diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.h b/eeschema/sch_plugins/altium/sch_altium_plugin.h index 4f5e8dc178..263c00df3a 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.h +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.h @@ -107,6 +107,7 @@ private: void ParseArc( const std::map& aProperties ); void ParseLine( const std::map& aProperties ); void ParseRectangle( const std::map& aProperties ); + void ParseNoERC( const std::map& aProperties ); void ParseNetLabel( const std::map& aProperties ); void ParseBus( const std::map& aProperties ); void ParseWire( const std::map& aProperties );