From d2fbe12cfd432e0f0d89d4a6c81d79d668d13a39 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Mon, 23 Nov 2020 20:54:34 +0000 Subject: [PATCH] CADSTAR Schematic Archive Importer: Parse SCALE token in Symbol and warn user this is not supported Fixes https://gitlab.com/kicad/code/kicad/-/issues/6463 --- .../cadstar/cadstar_sch_archive_loader.cpp | 14 ++++++++++++++ .../cadstar/cadstar_sch_archive_parser.cpp | 5 +++++ .../cadstar/cadstar_sch_archive_parser.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 9707523055..972da01389 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -449,6 +449,20 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances() "net power / symbol. The symbol was not loaded." ), sym.ID ) ); } + + if( sym.ScaleRatioDenominator != 1 || sym.ScaleRatioNumerator != 1 ) + { + wxString symbolName = sym.ComponentRef.Designator; + + if( symbolName.empty() ) + symbolName = wxString::Format( "ID: %s", sym.ID); + + wxLogError( wxString::Format( + _( "Symbol '%s' is scaled in the original CADSTAR schematic but this is not" + "supported in KiCad. The symbol was loaded with 1:1 scale and may require " + "manual fixing." ), + symbolName, sym.PartRef.RefID ) ); + } } } diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp index 7702a51f2b..a9d843fdad 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.cpp @@ -677,6 +677,11 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode ) { Fixed = true; } + else if( cNodeName == wxT( "SCALE" ) ) + { + ScaleRatioNumerator = GetXmlAttributeIDLong( cNode, 0 ); + ScaleRatioDenominator = GetXmlAttributeIDLong( cNode, 1 ); + } else if( cNodeName == wxT( "READABILITY" ) ) { Readability = ParseReadability( cNode ); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h index cea5cff2d1..ebf202cab4 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_parser.h @@ -260,6 +260,8 @@ public: long OrientAngle = 0; bool Mirror = false; bool Fixed = false; + long ScaleRatioNumerator = 1; ///< Symbols can be arbitrarily scaled in CADSTAR + long ScaleRatioDenominator = 1; READABILITY Readability = READABILITY::BOTTOM_TO_TOP; bool IsComponent = false;