diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 80294c6b34..6ed4c218d8 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -597,6 +598,13 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr parentGroup->RemoveItem( aFootprint ); }; + auto resetZones = + []( FOOTPRINT* aFootprint ) + { + for( ZONE* zone : aFootprint->Zones() ) + zone->Move( -aFootprint->GetPosition() ); + }; + if( !aStoreInNewLib ) { // The footprints are saved in an existing .pretty library in the fp lib table @@ -625,6 +633,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr // Reset reference designator and group membership before saving resetReference( fpCopy ); resetGroup( fpCopy ); + resetZones( fpCopy ); tbl->FootprintSave( nickname, fpCopy, true ); @@ -681,6 +690,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr // Reset reference designator and group membership before saving resetReference( fpCopy ); resetGroup( fpCopy ); + resetZones( fpCopy ); pi->FootprintSave( libPath, fpCopy );