From 7a50654f3b7c5f1d7a697ebbb7aac0cab3626327 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 15 Apr 2023 22:30:21 +0100 Subject: [PATCH] Export rectangular aperture GBR_SEGMENTS as polygons. Fixes https://gitlab.com/kicad/code/kicad/issues/14136 --- gerbview/export_to_pcbnew.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 6eb146bb50..757c55a38b 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -297,6 +297,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, export_flashed_copper_item( aGbrItem, aLayer ); break; + case GBR_CIRCLE: case GBR_ARC: export_segarc_copper_item( aGbrItem, aLayer ); break; @@ -314,8 +315,26 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, #endif break; + case GBR_SEGMENT: + { + D_CODE* code = aGbrItem->GetDcodeDescr(); + + if( code && code->m_ApertType == APT_RECT ) + { + if( aGbrItem->m_ShapeAsPolygon.OutlineCount() == 0 ) + const_cast( aGbrItem )->ConvertSegmentToPolygon(); + + writePcbPolygon( aGbrItem->m_ShapeAsPolygon, aLayer ); + } + else + { + export_segline_copper_item( aGbrItem, aLayer ); + } + + break; + } + default: - export_segline_copper_item( aGbrItem, aLayer ); break; } }