mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Pcbnew: fix refdes ordering in arrays
The first cell of the array needs to not be reannotated, or it will skips its own number(s) and take what we expect for the second cell. The repeats until the last entry, which didn't reannotate anything, leaving the original numbers. Producing a 'rotation' like 2,3,4,5,1 rather than the expected 1,2,3,4,5. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20935
This commit is contained in:
parent
c1cd4dd157
commit
f31a109ab4
@ -221,6 +221,8 @@ void ARRAY_TOOL::onDialogClosed( wxCloseEvent& aEvent )
|
||||
return;
|
||||
}
|
||||
|
||||
const bool will_reannotate = !m_isFootprintEditor && m_array_opts->ShouldReannotateFootprints();
|
||||
|
||||
// Iterate in reverse so the original items go last, and we can
|
||||
// use them for the positions of the clones.
|
||||
for( int ptN = arraySize - 1; ptN >= 0; --ptN )
|
||||
@ -317,9 +319,6 @@ void ARRAY_TOOL::onDialogClosed( wxCloseEvent& aEvent )
|
||||
}
|
||||
}
|
||||
|
||||
// Add new items to selection (footprints in the selection will be reannotated)
|
||||
items_for_this_block.Add( this_item );
|
||||
|
||||
if( this_item )
|
||||
{
|
||||
// Because aItem is/can be created from a selected item, and inherits from
|
||||
@ -352,6 +351,10 @@ void ARRAY_TOOL::onDialogClosed( wxCloseEvent& aEvent )
|
||||
}
|
||||
}
|
||||
|
||||
// Add new items to selection (footprints in the selection will be reannotated)
|
||||
if( this_item )
|
||||
items_for_this_block.Add( this_item );
|
||||
|
||||
// attempt to renumber items if the array parameters define
|
||||
// a complete numbering scheme to number by (as opposed to
|
||||
// implicit numbering by incrementing the items during creation
|
||||
@ -371,7 +374,9 @@ void ARRAY_TOOL::onDialogClosed( wxCloseEvent& aEvent )
|
||||
}
|
||||
}
|
||||
|
||||
if( !m_isFootprintEditor && m_array_opts->ShouldReannotateFootprints() )
|
||||
// Do not reannotate the first item, or it will skip its own numbering and
|
||||
// the array annotations will shift by one cell.
|
||||
if( will_reannotate && ptN != arraySize - 1 )
|
||||
{
|
||||
m_toolMgr->GetTool<BOARD_REANNOTATE_TOOL>()->ReannotateDuplicates( items_for_this_block,
|
||||
all_added_items );
|
||||
|
Loading…
x
Reference in New Issue
Block a user