From 8ee263b341b2add3727b8be159e0bcf8bcacfc91 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 6 Mar 2025 08:48:31 -0800 Subject: [PATCH] Ensure that layers are set prior to assigning nets Zones will have their net code cleared if they are non-copper items, so we need to ensure that the zone exists on a copper layer Fixes https://gitlab.com/kicad/code/kicad/-/issues/20219 --- pcbnew/pcb_io/altium/altium_pcb.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pcbnew/pcb_io/altium/altium_pcb.cpp b/pcbnew/pcb_io/altium/altium_pcb.cpp index 5db001b981..11625c48e6 100644 --- a/pcbnew/pcb_io/altium/altium_pcb.cpp +++ b/pcbnew/pcb_io/altium/altium_pcb.cpp @@ -2066,7 +2066,7 @@ void ALTIUM_PCB::ParseNets6Data( const ALTIUM_PCB_COMPOUND_FILE& aAltiumPcbF checkpoint(); ANET6 elem( reader ); - NETINFO_ITEM* netInfo = new NETINFO_ITEM( m_board, elem.name, 0 ); + NETINFO_ITEM* netInfo = new NETINFO_ITEM( m_board, elem.name, -1 ); m_board->Add( netInfo, ADD_MODE::APPEND ); // needs to be called after m_board->Add() as assign us the NetCode @@ -2130,16 +2130,16 @@ void ALTIUM_PCB::ParsePolygons6Data( const ALTIUM_PCB_COMPOUND_FILE& aAltium continue; std::unique_ptr zone = std::make_unique(m_board); - m_polygons.emplace_back(zone.get()); + // Be sure to set the zone layer before setting the net code + // so that we know that this is a copper zone and so needs a valid net code. + HelperSetZoneLayers( *zone, elem.layer ); zone->SetNetCode( GetNetCode( elem.net ) ); zone->SetPosition( elem.vertices.at( 0 ).position ); zone->SetLocked( elem.locked ); zone->SetAssignedPriority( elem.pourindex > 0 ? elem.pourindex : 0 ); zone->Outline()->AddOutline( outline.Outline( 0 ) ); - HelperSetZoneLayers( *zone, elem.layer ); - if( elem.pourindex > m_highest_pour_index ) m_highest_pour_index = elem.pourindex; @@ -2237,6 +2237,7 @@ void ALTIUM_PCB::ParsePolygons6Data( const ALTIUM_PCB_COMPOUND_FILE& aAltium zone->SetBorderDisplayStyle( ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE, ZONE::GetDefaultHatchPitch(), true ); + m_polygons.emplace_back( zone.get() ); m_board->Add( zone.release(), ADD_MODE::APPEND ); }