diff --git a/pcbnew/dialogs/dialog_footprint_checker.cpp b/pcbnew/dialogs/dialog_footprint_checker.cpp index 1b10f7511f..967fb02473 100644 --- a/pcbnew/dialogs/dialog_footprint_checker.cpp +++ b/pcbnew/dialogs/dialog_footprint_checker.cpp @@ -177,10 +177,13 @@ void DIALOG_FOOTPRINT_CHECKER::OnSelectItem( wxDataViewEvent& aEvent ) if( node && item ) { - PCB_LAYER_ID principalLayer = item->GetLayerSet().Seq()[0]; + PCB_LAYER_ID principalLayer = UNDEFINED_LAYER; LSET violationLayers; std::shared_ptr rc_item = node->m_RcItem; + if( item->GetLayerSet().count() > 0 ) + principalLayer = item->GetLayerSet().Seq().front(); + if( rc_item->GetErrorCode() == DRCE_MALFORMED_COURTYARD ) { BOARD_ITEM* a = board->GetItem( rc_item->GetMainItemID() ); diff --git a/pcbnew/drc/drc_test_provider_disallow.cpp b/pcbnew/drc/drc_test_provider_disallow.cpp index 25ab38395e..46addefbd9 100644 --- a/pcbnew/drc/drc_test_provider_disallow.cpp +++ b/pcbnew/drc/drc_test_provider_disallow.cpp @@ -201,21 +201,25 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run() auto checkDisallow = [&]( BOARD_ITEM* item ) { - auto constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, item, nullptr, - UNDEFINED_LAYER ); + DRC_CONSTRAINT constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, item, + nullptr, UNDEFINED_LAYER ); if( constraint.m_DisallowFlags && constraint.GetSeverity() != RPT_SEVERITY_IGNORE ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_ALLOWED_ITEMS ); - m_msg.Printf( drcItem->GetErrorText() + wxS( " (%s)" ), - constraint.GetName() ); + m_msg.Printf( drcItem->GetErrorText() + wxS( " (%s)" ), constraint.GetName() ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( item ); drcItem->SetViolatingRule( constraint.GetParentRule() ); - reportViolation( drcItem, item->GetPosition(), item->GetLayerSet().Seq()[0] ); + PCB_LAYER_ID layer = UNDEFINED_LAYER; + + if( item->GetLayerSet().count() ) + layer = item->GetLayerSet().Seq().front(); + + reportViolation( drcItem, item->GetPosition(), layer ); } }; diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 8a8020d950..80038e5a57 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -421,11 +421,13 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) if( IsPcbLayer( aLayer ) && parentFP->GetPrivateLayers().test( aLayer ) ) return false; } - else + else if( item->GetLayerSet().count() == 1 ) { // For single-layer objects, exclude all layers including ancillary layers // such as holes, netnames, etc. - if( parentFP->GetPrivateLayers().test( item->GetLayerSet().Seq()[0] ) ) + PCB_LAYER_ID singleLayer = item->GetLayerSet().Seq()[0]; + + if( parentFP->GetPrivateLayers().test( singleLayer ) ) return false; } } diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index c36c3fb8d7..e8167fd614 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -388,9 +388,11 @@ int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent ) if( copperIntersection.any() && zone && pad && zone->GetNetCode() == pad->GetNetCode() ) { - PCB_LAYER_ID layer = active; + PCB_LAYER_ID layer = UNDEFINED_LAYER; - if( !zone->IsOnLayer( active ) ) + if( zone->IsOnLayer( active ) ) + layer = active; + else if( zone->GetLayerSet().count() > 0 ) layer = zone->GetLayerSet().Seq().front(); r = m_inspectClearanceDialog->AddPage( _( "Zone" ) ); diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 5b6df50928..0e4e4994ed 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -884,7 +884,7 @@ void ZONE::HatchBorder() int hatch_line_len = m_borderHatchPitch; // To have a better look, give a slope depending on the layer - int layer = GetLayerSet().Seq()[0]; + int layer = GetFirstLayer(); int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1 double slope = 0.707106 * slope_flag; // 45 degrees slope int max_a, min_a;