DSN exporter: fix handling of multilayer copper zones, and broken zone layer id.

This commit is contained in:
jean-pierre charras 2023-03-07 13:59:36 +01:00
parent 33e7c78533
commit 2c77888b49
1 changed files with 89 additions and 75 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1226,7 +1226,20 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
continue;
// Currently, we export only copper layers
if( ! IsCopperLayer( zone->GetLayer() ) )
if( ! IsCopperLayer( zone->IsOnCopperLayer() ) )
continue;
// Now, build zone polygon on each copper layer where the zone
// is living (zones can live on many copper layers)
const int copperCount = aBoard->GetCopperLayerCount();
for( int layer = 0; layer < copperCount; layer++ )
{
if( layer == copperCount-1 )
layer = B_Cu;
if( !zone->IsOnLayer( PCB_LAYER_ID( layer ) ) )
continue;
COPPER_PLANE* plane = new COPPER_PLANE( m_pcb->structure );
@ -1256,7 +1269,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
plane->name = no_net->net_id;
}
mainPolygon->layer_id = m_layerIds[ m_kicadLayer2pcb[ zone->GetLayer() ] ];
mainPolygon->layer_id = m_layerIds[ m_kicadLayer2pcb[ layer ] ];
// Handle the main outlines
SHAPE_POLY_SET::ITERATOR iterator;
@ -1324,6 +1337,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
if( iterator.IsEndContour() )
cutout->AppendPoint( mapPt( startpoint ) );
}
} // end build zones by layer
}
}
@ -1409,7 +1423,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
cutout = new PATH( window, T_polygon );
window->SetShape( cutout );
cutout->layer_id = m_layerIds[ m_kicadLayer2pcb[ zone->GetLayer() ] ];
cutout->layer_id = m_layerIds[ m_kicadLayer2pcb[ zone->GetFirstLayer() ] ];
}
isStartContour = iterator.IsEndContour();