From 2f4f623a319eeba92c7b151951f3f4d13e63ce9e Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 22 Sep 2018 14:00:22 +0200 Subject: [PATCH] Pcbnew, Excellon drill file generator: Oval holes: add a routing mode G01 command. It can be used instead of the slot (G85) command to create oval holes. Do not yet activate it. Oval holes frequently create issues with board houses. Using a more usual routing (G01) command could solve some issues. --- pcbnew/exporters/gendrill_Excellon_writer.cpp | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index e645b32d3e..7f3482be7c 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 Jean_Pierre Charras + * Copyright (C) 2018 Jean_Pierre Charras * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2018 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 @@ -54,6 +54,11 @@ // tools used for PTH and tools used for NPTH // #define WRITE_PTH_NPTH_COMMENT +// Oblong holes can be drilled by a "canned slot" command (G85) or a routing command +// a linear routing command (G01) is perhaps more usual for drill files +// Comment this next line to use a canned slot hole (old way) +// Uncomment this next line to use a linear routed hole (new way) +//#define USE_ROUTING_MODE_FOR_OBLONG_HOLE EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb ) : GENDRILL_WRITER_BASE( aPcb ) @@ -273,25 +278,35 @@ int EXCELLON_WRITER::createDrillFile( FILE* aFile ) xt = x0 * m_conversionUnits; yt = y0 * m_conversionUnits; +#ifdef USE_ROUTING_MODE_FOR_OBLONG_HOLE + fputs( "G00", m_file ); // Select the routing mode +#endif writeCoordinates( line, xt, yt ); +#ifndef USE_ROUTING_MODE_FOR_OBLONG_HOLE /* remove the '\n' from end of line, because we must add the "G85" * command to the line: */ for( int kk = 0; line[kk] != 0; kk++ ) { - if( line[kk] == '\n' || line[kk] =='\r' ) + if( line[kk] < ' ' ) line[kk] = 0; } fputs( line, m_file ); fputs( "G85", m_file ); // add the "G85" command - +#else + fputs( line, m_file ); + fputs( "M15\nG01", m_file ); // tool down and linear routing from last coordinates +#endif xt = xf * m_conversionUnits; yt = yf * m_conversionUnits; writeCoordinates( line, xt, yt ); fputs( line, m_file ); - fputs( "G05\n", m_file ); +#ifdef USE_ROUTING_MODE_FOR_OBLONG_HOLE + fputs( "M16\n", m_file ); // Tool up (end routing) +#endif + fputs( "G05\n", m_file ); // Select drill mode holes_count++; }