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
This commit is contained in:
jean-pierre charras 2020-05-19 10:20:12 +02:00
parent f4d7c323f5
commit 4efed4b729
3 changed files with 10 additions and 7 deletions

View File

@ -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() );

View File

@ -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 );
}
}

View File

@ -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 );