diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 73ce3eb808..38b7973907 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -262,7 +262,7 @@ ADVANCED_CFG::ADVANCED_CFG() m_CompactSave = false; m_UpdateUIEventInterval = 0; m_ShowRepairSchematic = false; - m_EnablePcbDesignBlocks = false; + m_EnablePcbDesignBlocks = true; m_EnableGenerators = false; m_EnableLibWithText = false; m_EnableLibDir = false; diff --git a/pcbnew/tools/multichannel_tool.cpp b/pcbnew/tools/multichannel_tool.cpp index ff03835205..fc615199e7 100644 --- a/pcbnew/tools/multichannel_tool.cpp +++ b/pcbnew/tools/multichannel_tool.cpp @@ -711,9 +711,14 @@ int MULTICHANNEL_TOOL::findRoutingInRuleArea( RULE_AREA* aRuleArea, std::setm_sourceType == PLACEMENT_SOURCE_T::DESIGN_BLOCK ) { - // Get all board connected items that are from the design bloc + // Get all board connected items that are from the design block, except pads, + // which shouldn't be copied for( EDA_ITEM* item : aRuleArea->m_designBlockItems ) { + // Include any connected items except pads. + if( item->Type() == PCB_PAD_T ) + continue; + if( BOARD_CONNECTED_ITEM* bci = dynamic_cast( item ) ) aOutput.insert( bci ); } @@ -819,10 +824,29 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( RULE_AREA* aRefArea, RULE_AREA* aT auto connectivity = board()->GetConnectivity(); - aCommit->Modify( aTargetArea->m_zone ); + // Only stage changes for a target Rule Area zone if it actually belongs to the board. + // In some workflows (e.g. ApplyDesignBlockLayout), the target area is a temporary zone + // and is not added to the BOARD. + bool targetZoneOnBoard = false; - aCompatData.m_affectedItems.insert( aTargetArea->m_zone ); - aCompatData.m_groupableItems.insert( aTargetArea->m_zone ); + if( aTargetArea->m_zone ) + { + for( ZONE* z : board()->Zones() ) + { + if( z == aTargetArea->m_zone ) + { + targetZoneOnBoard = true; + break; + } + } + } + + if( targetZoneOnBoard ) + { + aCommit->Modify( aTargetArea->m_zone ); + aCompatData.m_affectedItems.insert( aTargetArea->m_zone ); + aCompatData.m_groupableItems.insert( aTargetArea->m_zone ); + } if( aOpts.m_copyRouting ) { @@ -849,6 +873,9 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( RULE_AREA* aRefArea, RULE_AREA* aT for( BOARD_CONNECTED_ITEM* item : targetRouting ) { + // Never remove pads as part of routing copy. + if( item->Type() == PCB_PAD_T ) + continue; if( item->IsLocked() && !aOpts.m_includeLockedItems ) continue; if( aOpts.m_connectedRoutingOnly && !targc.contains( item->GetNetCode() ) ) @@ -866,6 +893,9 @@ bool MULTICHANNEL_TOOL::copyRuleAreaContents( RULE_AREA* aRefArea, RULE_AREA* aT for( BOARD_CONNECTED_ITEM* item : refRouting ) { + // Never copy pads as part of routing copy. + if( item->Type() == PCB_PAD_T ) + continue; if( item->IsLocked() && !aOpts.m_includeLockedItems ) continue; if( aOpts.m_connectedRoutingOnly && !refc.contains( item->GetNetCode() ) ) diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index d72e4ee9f1..7423a45d3f 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -1477,7 +1477,6 @@ int PCB_CONTROL::ApplyDesignBlockLayout( const TOOL_EVENT& aEvent ) dbRA.m_zone->SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE::NO_HATCH ); dbRA.m_zone->AddPolygon( generateBoundingBox( dbRA.m_designBlockItems ) ); dbRA.m_center = dbRA.m_zone->Outline()->COutline( 0 ).Centre(); - tempCommit.Add( dbRA.m_zone ); // Create the destination rule area for the group RULE_AREA destRA; @@ -1520,7 +1519,6 @@ int PCB_CONTROL::ApplyDesignBlockLayout( const TOOL_EVENT& aEvent ) destRA.m_zone->SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE::NO_HATCH ); destRA.m_zone->AddPolygon( generateBoundingBox( group->GetItems() ) ); destRA.m_center = destRA.m_zone->Outline()->COutline( 0 ).Centre(); - tempCommit.Add( dbRA.m_zone ); // Use the multichannel tool to repeat the layout MULTICHANNEL_TOOL* mct = m_toolMgr->GetTool();