From 90abc8ba8bce81e5f332c8cd373ec7834f89a55c Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@wanadoo.fr>
Date: Wed, 31 Mar 2021 14:00:25 +0200
Subject: [PATCH] Excellon drill files: slightly change comments inside files

---
 pcbnew/exporters/gendrill_Excellon_writer.cpp  | 12 ++++++++----
 pcbnew/exporters/gendrill_file_writer_base.cpp |  7 ++++++-
 pcbnew/exporters/gendrill_file_writer_base.h   |  3 ++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp
index d3687df60e..65a19307ce 100644
--- a/pcbnew/exporters/gendrill_Excellon_writer.cpp
+++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp
@@ -158,16 +158,20 @@ void EXCELLON_WRITER::writeHoleAttribute( HOLE_ATTRIBUTE aAttribute )
     {
         switch( aAttribute )
         {
-        case HOLE_ATTRIBUTE::HOLE_VIA:
-            fprintf( m_file, "; #@! TA.AperFunction,ViaDrill\n" );
+        case HOLE_ATTRIBUTE::HOLE_VIA_THROUGH:
+            fprintf( m_file, "; #@! TA.AperFunction,Plated,PTH,ViaDrill\n" );
+            break;
+
+        case HOLE_ATTRIBUTE::HOLE_VIA_BURIED:
+            fprintf( m_file, "; #@! TA.AperFunction,Plated,Buried,ViaDrill\n" );
             break;
 
         case HOLE_ATTRIBUTE::HOLE_PAD:
-            fprintf( m_file, "; #@! TA.AperFunction,ComponentDrill,Plated,PTH\n" );
+            fprintf( m_file, "; #@! TA.AperFunction,Plated,PTH,ComponentDrill\n" );
             break;
 
         case HOLE_ATTRIBUTE::HOLE_MECHANICAL:
-            fprintf( m_file, "; #@! TA.AperFunction,ComponentDrill,NonPlated,NPTH\n" );
+            fprintf( m_file, "; #@! TA.AperFunction,NonPlated,NPTH,ComponentDrill\n" );
             break;
 
         case HOLE_ATTRIBUTE::HOLE_UNKNOWN:
diff --git a/pcbnew/exporters/gendrill_file_writer_base.cpp b/pcbnew/exporters/gendrill_file_writer_base.cpp
index ff218456ca..63c608c730 100644
--- a/pcbnew/exporters/gendrill_file_writer_base.cpp
+++ b/pcbnew/exporters/gendrill_file_writer_base.cpp
@@ -87,7 +87,12 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair,
                 continue;
 
             new_hole.m_ItemParent = via;
-            new_hole.m_HoleAttribute = HOLE_ATTRIBUTE::HOLE_VIA;
+
+            if( aLayerPair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
+                new_hole.m_HoleAttribute = HOLE_ATTRIBUTE::HOLE_VIA_THROUGH;
+            else
+                new_hole.m_HoleAttribute = HOLE_ATTRIBUTE::HOLE_VIA_BURIED;
+
             new_hole.m_Tool_Reference = -1;         // Flag value for Not initialized
             new_hole.m_Hole_Orient    = 0;
             new_hole.m_Hole_Diameter  = hole_sz;
diff --git a/pcbnew/exporters/gendrill_file_writer_base.h b/pcbnew/exporters/gendrill_file_writer_base.h
index 9c1203766a..9ed11f50dd 100644
--- a/pcbnew/exporters/gendrill_file_writer_base.h
+++ b/pcbnew/exporters/gendrill_file_writer_base.h
@@ -44,7 +44,8 @@ class BOARD_ITEM;
 enum class HOLE_ATTRIBUTE
 {
     HOLE_UNKNOWN,       // uninitialized type
-    HOLE_VIA,           // a via hole (always plated)
+    HOLE_VIA_THROUGH,   // a via hole (always plated) from top to bottom
+    HOLE_VIA_BURIED,    // a via hole (always plated) not through hole
     HOLE_PAD,           // a plated or not plated pad hole
     HOLE_MECHANICAL     // a mechanical pad (provided, not used)
 };