PCB_GENERATOR_Ts are PCB_GROUP_Ts too.

Also, an item must already be in a commit to add it to a group.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17595

(cherry picked from commit 9fb07d886e)
This commit is contained in:
Jeff Young 2024-06-05 10:47:50 +01:00
parent ddd0ccbefd
commit 78cbb8e994
2 changed files with 3 additions and 22 deletions

View File

@ -291,7 +291,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
}
}
if( boardItem->Type() == PCB_GROUP_T )
if( boardItem->Type() == PCB_GROUP_T || boardItem->Type() == PCB_GENERATOR_T )
addedGroup = static_cast<PCB_GROUP*>( boardItem );
if( autofillZones && boardItem->Type() != PCB_MARKER_T )
@ -351,24 +351,6 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
case PCB_MARKER_T: // a marker used to show something
case PCB_ZONE_T:
case PCB_FOOTPRINT_T:
if( view )
view->Remove( boardItem );
if( !( changeFlags & CHT_DONE ) )
{
if( parentFP )
{
parentFP->Remove( boardItem );
}
else
{
board->Remove( boardItem, REMOVE_MODE::BULK );
bulkRemovedItems.push_back( boardItem );
}
}
break;
case PCB_GROUP_T:
if( view )
view->Remove( boardItem );

View File

@ -1454,17 +1454,16 @@ void PCB_TUNING_PATTERN::EditPush( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_C
for( BOARD_ITEM* item : routerAddedItems )
{
aCommit->Add( item );
if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
{
if( bounds.PointInside( track->GetStart(), epsilon )
&& bounds.PointInside( track->GetEnd(), epsilon ) )
{
AddItem( item );
aCommit->Stage( item, CHT_GROUP );
}
}
aCommit->Add( item );
}
}