From 4efed4b7293808ad0146aa59df86ade9cf155127 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 19 May 2020 10:20:12 +0200 Subject: [PATCH] Pcbnew, exchange footprint and export DSN: fix incorrect rotation if the edit option Flip was set to flip around Y axis. Fixes #4487 https://gitlab.com/kicad/code/kicad/issues/4487 Fixes #4478 https://gitlab.com/kicad/code/kicad/issues/4478 --- pcbnew/dialogs/dialog_exchange_footprints.cpp | 2 +- pcbnew/specctra_import_export/specctra_export.cpp | 9 +++++++-- pcbnew/specctra_import_export/specctra_import.cpp | 6 ++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index c79e8dbd99..5d7ea5f249 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -472,7 +472,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aDest->Flip( aDest->GetPosition(), m_Settings->m_FlipLeftRight ); if( aDest->GetOrientation() != aSrc->GetOrientation() ) - aDest->Rotate( aDest->GetPosition(), aSrc->GetOrientation() ); + aDest->SetOrientation( aSrc->GetOrientation() ); aDest->SetLocked( aSrc->IsLocked() ); diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 040db4eeed..f69dc17c17 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -1729,12 +1729,16 @@ void SPECCTRA_DB::exportNETCLASS( const NETCLASSPTR& aNetClass, BOARD* aBoard ) void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard ) { + // DSN Images (=KiCad MODULES and pads) must be presented from the + // top view. + // Note: to export footprints, the footprints must be flipped around the X axis, + // otherwise the rotation angle is not good for( auto module : aBoard->Modules() ) { module->SetFlag( 0 ); if( module->GetLayer() == B_Cu ) { - module->Flip( module->GetPosition(), aBoard->GeneralSettings().m_FlipLeftRight ); + module->Flip( module->GetPosition(), false ); module->SetFlag( 1 ); } } @@ -1750,11 +1754,12 @@ void SPECCTRA_DB::RevertMODULEs( BOARD* aBoard ) // DSN Images (=KiCad MODULES and pads) must be presented from the // top view. Restore those that were flipped. + // Note: to export footprints, the footprints were flipped around the X axis, for( auto module : aBoard->Modules() ) { if( module->GetFlag() ) { - module->Flip( module->GetPosition(), aBoard->GeneralSettings().m_FlipLeftRight ); + module->Flip( module->GetPosition(), false ); module->SetFlag( 0 ); } } diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index 83487bb086..39916834aa 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -377,8 +377,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) if( module->GetLayer() != F_Cu ) { // module is on copper layer (back) - module->Flip( module->GetPosition(), - aBoard->GeneralSettings().m_FlipLeftRight ); + module->Flip( module->GetPosition(), false ); } module->SetOrientation( orientation ); @@ -390,8 +389,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) if( module->GetLayer() != B_Cu ) { // module is on component layer (front) - module->Flip( module->GetPosition(), - aBoard->GeneralSettings().m_FlipLeftRight ); + module->Flip( module->GetPosition(), false ); } module->SetOrientation( orientation );