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.
This commit is contained in:
jean-pierre charras 2018-09-22 14:00:22 +02:00
parent 4136aca221
commit 2f4f623a31
1 changed files with 20 additions and 5 deletions

View File

@ -1,9 +1,9 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Jean_Pierre Charras <jp.charras at wanadoo.fr> * Copyright (C) 2018 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -54,6 +54,11 @@
// tools used for PTH and tools used for NPTH // tools used for PTH and tools used for NPTH
// #define WRITE_PTH_NPTH_COMMENT // #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 ) EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb )
: GENDRILL_WRITER_BASE( aPcb ) : GENDRILL_WRITER_BASE( aPcb )
@ -273,25 +278,35 @@ int EXCELLON_WRITER::createDrillFile( FILE* aFile )
xt = x0 * m_conversionUnits; xt = x0 * m_conversionUnits;
yt = y0 * 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 ); writeCoordinates( line, xt, yt );
#ifndef USE_ROUTING_MODE_FOR_OBLONG_HOLE
/* remove the '\n' from end of line, because we must add the "G85" /* remove the '\n' from end of line, because we must add the "G85"
* command to the line: */ * command to the line: */
for( int kk = 0; line[kk] != 0; kk++ ) for( int kk = 0; line[kk] != 0; kk++ )
{ {
if( line[kk] == '\n' || line[kk] =='\r' ) if( line[kk] < ' ' )
line[kk] = 0; line[kk] = 0;
} }
fputs( line, m_file ); fputs( line, m_file );
fputs( "G85", m_file ); // add the "G85" command 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; xt = xf * m_conversionUnits;
yt = yf * m_conversionUnits; yt = yf * m_conversionUnits;
writeCoordinates( line, xt, yt ); writeCoordinates( line, xt, yt );
fputs( line, m_file ); 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++; holes_count++;
} }