Reset zone offsets when exporting footprints.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17794
(cherry picked from commit af5ed5a118
)
This commit is contained in:
parent
561b2d490d
commit
d8f2a455e0
|
@ -38,6 +38,7 @@
|
|||
#include <tools/board_editor_control.h>
|
||||
#include <tools/pad_tool.h>
|
||||
#include <footprint.h>
|
||||
#include <zone.h>
|
||||
#include <pcb_group.h>
|
||||
#include <board_commit.h>
|
||||
#include <footprint_edit_frame.h>
|
||||
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue