2012-10-05 12:25:12 +00:00
|
|
|
/**
|
|
|
|
* @file gen_drill_report_files.cpp
|
|
|
|
* @brief Functions to create report and map files for EXCELLON drill files.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-11-16 18:42:58 +00:00
|
|
|
* Copyright (C) 1992-2015 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
|
|
|
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
|
2012-10-05 12:25:12 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <plot_common.h>
|
|
|
|
#include <base_struct.h>
|
|
|
|
#include <drawtxt.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <kicad_string.h>
|
2013-05-02 18:06:58 +00:00
|
|
|
#include <macros.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbplot.h>
|
2012-10-05 12:25:12 +00:00
|
|
|
#include <gendrill_Excellon_writer.h>
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
/* Conversion utilities - these will be used often in there... */
|
2012-10-05 12:25:12 +00:00
|
|
|
inline double diameter_in_inches( double ius )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
|
|
|
return ius * 0.001 / IU_PER_MILS;
|
|
|
|
}
|
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
|
|
|
|
inline double diameter_in_mm( double ius )
|
2012-05-03 18:37:56 +00:00
|
|
|
{
|
|
|
|
return ius / IU_PER_MM;
|
|
|
|
}
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
|
|
|
|
PlotFormat aFormat )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2012-10-05 12:25:12 +00:00
|
|
|
double scale = 1.0;
|
|
|
|
wxPoint offset;
|
|
|
|
PLOTTER* plotter = NULL;
|
2015-04-29 15:37:37 +00:00
|
|
|
PAGE_INFO dummy( PAGE_INFO::A4, false );
|
2012-04-05 18:27:56 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
PCB_PLOT_PARAMS plot_opts; // starts plotting with default options
|
2012-04-05 18:27:56 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
LOCALE_IO toggle; // use standard C notation for float numbers
|
2011-02-25 16:23:24 +00:00
|
|
|
|
2015-04-29 15:37:37 +00:00
|
|
|
const PAGE_INFO& page_info = m_pageInfo ? *m_pageInfo : dummy;
|
|
|
|
|
2011-02-25 16:23:24 +00:00
|
|
|
// Calculate dimensions and center of PCB
|
2012-10-05 12:25:12 +00:00
|
|
|
EDA_RECT bbbox = m_pcb->ComputeBoundingBox( true );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Calculate the scale for the format type, scale 1 in HPGL, drawing on
|
|
|
|
// an A4 sheet in PS, + text description of symbols
|
2012-10-05 12:25:12 +00:00
|
|
|
switch( aFormat )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case PLOT_FORMAT_GERBER:
|
2012-10-05 12:25:12 +00:00
|
|
|
offset = GetOffset();
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter = new GERBER_PLOTTER();
|
2016-06-05 11:49:25 +00:00
|
|
|
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
|
2014-07-21 09:42:36 +00:00
|
|
|
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
case PLOT_FORMAT_HPGL: // Scale for HPGL format.
|
2014-03-06 18:38:39 +00:00
|
|
|
{
|
|
|
|
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
|
|
|
|
plotter = hpgl_plotter;
|
|
|
|
hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
|
|
|
|
hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
|
2015-04-29 15:37:37 +00:00
|
|
|
plotter->SetPageSettings( page_info );
|
2016-06-05 11:49:25 +00:00
|
|
|
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
|
2014-03-06 18:38:39 +00:00
|
|
|
}
|
2012-04-05 18:27:56 +00:00
|
|
|
break;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-10-13 18:54:33 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
wxASSERT( false );
|
|
|
|
// fall through
|
|
|
|
case PLOT_FORMAT_PDF:
|
2008-01-18 15:47:15 +00:00
|
|
|
case PLOT_FORMAT_POST:
|
2014-03-06 18:38:39 +00:00
|
|
|
{
|
|
|
|
PAGE_INFO pageA4( wxT( "A4" ) );
|
|
|
|
wxSize pageSizeIU = pageA4.GetSizeIU();
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
// Reserve a margin around the page.
|
|
|
|
int margin = KiROUND( 20 * IU_PER_MM );
|
2012-08-29 12:40:09 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
// Calculate a scaling factor to print the board on the sheet
|
|
|
|
double Xscale = double( pageSizeIU.x - ( 2 * margin ) ) / bbbox.GetWidth();
|
2012-08-29 12:40:09 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
// We should print the list of drill sizes, so reserve room for it
|
|
|
|
// 60% height for board 40% height for list
|
|
|
|
int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
|
|
|
|
double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
scale = std::min( Xscale, Yscale );
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
// Experience shows the scale should not to large, because texts
|
|
|
|
// create problem (can be to big or too small).
|
|
|
|
// So the scale is clipped at 3.0;
|
|
|
|
scale = std::min( scale, 3.0 );
|
2012-08-29 12:40:09 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
offset.x = KiROUND( double( bbbox.Centre().x ) -
|
|
|
|
( pageSizeIU.x / 2.0 ) / scale );
|
|
|
|
offset.y = KiROUND( double( bbbox.Centre().y ) -
|
|
|
|
( ypagesize_for_board / 2.0 ) / scale );
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
if( aFormat == PLOT_FORMAT_PDF )
|
|
|
|
plotter = new PDF_PLOTTER;
|
|
|
|
else
|
|
|
|
plotter = new PS_PLOTTER;
|
2012-10-13 18:54:33 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
plotter->SetPageSettings( pageA4 );
|
2016-06-05 11:49:25 +00:00
|
|
|
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
|
2014-03-06 18:38:39 +00:00
|
|
|
}
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2009-06-30 10:43:20 +00:00
|
|
|
case PLOT_FORMAT_DXF:
|
2014-03-06 18:38:39 +00:00
|
|
|
{
|
|
|
|
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
|
|
|
|
plotter = dxf_plotter;
|
2015-04-29 15:37:37 +00:00
|
|
|
plotter->SetPageSettings( page_info );
|
2016-06-05 11:49:25 +00:00
|
|
|
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
|
2014-03-06 18:38:39 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
2009-06-30 10:43:20 +00:00
|
|
|
|
2012-09-15 12:13:03 +00:00
|
|
|
case PLOT_FORMAT_SVG:
|
2014-03-06 18:38:39 +00:00
|
|
|
{
|
|
|
|
SVG_PLOTTER* svg_plotter = new SVG_PLOTTER;
|
|
|
|
plotter = svg_plotter;
|
2015-04-29 15:37:37 +00:00
|
|
|
plotter->SetPageSettings( page_info );
|
2016-06-05 11:49:25 +00:00
|
|
|
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
|
2014-03-06 18:38:39 +00:00
|
|
|
}
|
2012-09-15 12:13:03 +00:00
|
|
|
break;
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-13 18:54:33 +00:00
|
|
|
plotter->SetCreator( wxT( "PCBNEW" ) );
|
|
|
|
plotter->SetDefaultLineWidth( 5 * IU_PER_MILS );
|
|
|
|
plotter->SetColorMode( false );
|
2012-10-05 12:25:12 +00:00
|
|
|
|
2012-10-13 18:54:33 +00:00
|
|
|
if( ! plotter->OpenFile( aFullFileName ) )
|
2012-10-05 12:25:12 +00:00
|
|
|
{
|
|
|
|
delete plotter;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-13 18:54:33 +00:00
|
|
|
plotter->StartPlot();
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-09-21 08:20:38 +00:00
|
|
|
// Draw items on edge layer (not all, only items useful for drill map
|
2012-10-05 12:25:12 +00:00
|
|
|
BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
|
2014-06-24 16:17:18 +00:00
|
|
|
itemplotter.SetLayerSet( Edge_Cuts );
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
for( EDA_ITEM* PtStruct = m_pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
|
|
|
switch( PtStruct->Type() )
|
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
2012-09-21 08:20:38 +00:00
|
|
|
itemplotter.PlotDrawSegment( (DRAWSEGMENT*) PtStruct );
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2012-09-21 08:20:38 +00:00
|
|
|
itemplotter.PlotTextePcb( (TEXTE_PCB*) PtStruct );
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MARKER_T: // do not draw
|
2008-01-18 15:47:15 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-29 12:40:09 +00:00
|
|
|
int x, y;
|
|
|
|
int plotX, plotY, TextWidth;
|
|
|
|
int intervalle = 0;
|
|
|
|
char line[1024];
|
|
|
|
wxString msg;
|
2013-05-04 11:57:09 +00:00
|
|
|
int textmarginaftersymbol = KiROUND( 2 * IU_PER_MM );
|
2012-08-29 12:40:09 +00:00
|
|
|
|
|
|
|
// Set Drill Symbols width
|
|
|
|
plotter->SetDefaultLineWidth( 0.2 * IU_PER_MM / scale );
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->SetCurrentLineWidth( -1 );
|
2009-08-29 10:20:48 +00:00
|
|
|
|
2009-03-19 10:54:53 +00:00
|
|
|
// Plot board outlines and drill map
|
2017-01-15 15:35:47 +00:00
|
|
|
plotDrillMarks( plotter );
|
2009-03-19 10:54:53 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// Print a list of symbols used.
|
2012-10-05 12:25:12 +00:00
|
|
|
int charSize = 3 * IU_PER_MM; // text size in IUs
|
|
|
|
double charScale = 1.0 / scale; // real scale will be 1/scale,
|
|
|
|
// because the global plot scale is scale
|
2013-05-04 11:57:09 +00:00
|
|
|
TextWidth = KiROUND( (charSize * charScale) / 10.0 ); // Set text width (thickness)
|
|
|
|
intervalle = KiROUND( charSize * charScale ) + TextWidth;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// Trace information.
|
2013-05-04 11:57:09 +00:00
|
|
|
plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
|
2012-10-05 12:25:12 +00:00
|
|
|
plotY = bbbox.GetBottom() + intervalle;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
// Plot title "Info"
|
2009-06-28 16:50:42 +00:00
|
|
|
wxString Text = wxT( "Drill Map:" );
|
2012-09-02 12:06:47 +00:00
|
|
|
plotter->Text( wxPoint( plotX, plotY ), UNSPECIFIED_COLOR, Text, 0,
|
2013-05-04 11:57:09 +00:00
|
|
|
wxSize( KiROUND( charSize * charScale ),
|
|
|
|
KiROUND( charSize * charScale ) ),
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
TextWidth, false, false );
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2015-11-16 18:42:58 +00:00
|
|
|
DRILL_TOOL& tool = m_toolListBuffer[ii];
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
if( tool.m_TotalCount == 0 )
|
2008-01-18 15:47:15 +00:00
|
|
|
continue;
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
plotY += intervalle;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
int plot_diam = KiROUND( tool.m_Diameter );
|
2014-03-06 18:38:39 +00:00
|
|
|
x = KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
|
2013-05-04 11:57:09 +00:00
|
|
|
y = KiROUND( plotY + charSize * charScale );
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->Marker( wxPoint( x, y ), plot_diam, ii );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
// List the diameter of each drill in mm and inches.
|
|
|
|
sprintf( line, "%2.2fmm / %2.3f\" ",
|
2015-11-16 18:42:58 +00:00
|
|
|
diameter_in_mm( tool.m_Diameter ),
|
|
|
|
diameter_in_inches( tool.m_Diameter ) );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-02-28 18:36:19 +00:00
|
|
|
msg = FROM_UTF8( line );
|
2009-08-29 10:20:48 +00:00
|
|
|
|
|
|
|
// Now list how many holes and ovals are associated with each drill.
|
2015-11-16 18:42:58 +00:00
|
|
|
if( ( tool.m_TotalCount == 1 )
|
|
|
|
&& ( tool.m_OvalCount == 0 ) )
|
2009-08-29 10:20:48 +00:00
|
|
|
sprintf( line, "(1 hole)" );
|
2015-11-16 18:42:58 +00:00
|
|
|
else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
|
2009-08-29 10:20:48 +00:00
|
|
|
sprintf( line, "(1 slot)" );
|
2015-11-16 18:42:58 +00:00
|
|
|
else if( tool.m_OvalCount == 0 )
|
|
|
|
sprintf( line, "(%d holes)", tool.m_TotalCount );
|
|
|
|
else if( tool.m_OvalCount == 1 )
|
|
|
|
sprintf( line, "(%d holes + 1 slot)", tool.m_TotalCount - 1 );
|
|
|
|
else // if ( toolm_OvalCount > 1 )
|
2009-08-29 10:20:48 +00:00
|
|
|
sprintf( line, "(%d holes + %d slots)",
|
2015-11-16 18:42:58 +00:00
|
|
|
tool.m_TotalCount - tool.m_OvalCount,
|
|
|
|
tool.m_OvalCount );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-02-28 18:36:19 +00:00
|
|
|
msg += FROM_UTF8( line );
|
2015-11-16 18:42:58 +00:00
|
|
|
|
|
|
|
if( tool.m_Hole_NotPlated )
|
|
|
|
msg += wxT( " (not plated)" );
|
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
plotter->Text( wxPoint( plotX, y ), UNSPECIFIED_COLOR, msg, 0,
|
|
|
|
wxSize( KiROUND( charSize * charScale ),
|
|
|
|
KiROUND( charSize * charScale ) ),
|
2009-08-29 10:20:48 +00:00
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
TextWidth, false, false );
|
|
|
|
|
2015-06-16 12:20:42 +00:00
|
|
|
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2015-06-16 12:20:42 +00:00
|
|
|
if( intervalle < ( plot_diam + ( 1 * IU_PER_MM / scale ) + TextWidth ) )
|
|
|
|
intervalle = plot_diam + ( 1 * IU_PER_MM / scale ) + TextWidth;
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->EndPlot();
|
2009-06-28 16:50:42 +00:00
|
|
|
delete plotter;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
return true;
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2015-10-23 14:30:22 +00:00
|
|
|
FILE_OUTPUTFORMATTER out( aFullFileName );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
static const char separator[] =
|
|
|
|
" =============================================================\n";
|
|
|
|
|
|
|
|
wxASSERT( m_pcb );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2015-02-25 19:43:37 +00:00
|
|
|
unsigned totalHoleCount;
|
2015-10-23 14:30:22 +00:00
|
|
|
wxString brdFilename = m_pcb->GetFileName();
|
|
|
|
|
2017-01-10 19:12:50 +00:00
|
|
|
std::vector<DRILL_LAYER_PAIR> hole_sets = getUniqueLayerPairs();
|
2015-10-23 14:30:22 +00:00
|
|
|
|
|
|
|
out.Print( 0, "Drill report for %s\n", TO_UTF8( brdFilename ) );
|
|
|
|
out.Print( 0, "Created on %s\n\n", TO_UTF8( DateAndTime() ) );
|
|
|
|
|
|
|
|
// Output the cu layer stackup, so layer name references make sense.
|
|
|
|
out.Print( 0, "Copper Layer Stackup:\n" );
|
|
|
|
out.Print( 0, separator );
|
2015-02-25 19:43:37 +00:00
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
LSET cu = m_pcb->GetEnabledLayers() & LSET::AllCuMask();
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
int conventional_layer_num = 1;
|
|
|
|
for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num )
|
|
|
|
{
|
|
|
|
out.Print( 0, " L%-2d: %-25s %s\n",
|
|
|
|
conventional_layer_num,
|
|
|
|
TO_UTF8( m_pcb->GetLayerName( *seq ) ),
|
|
|
|
layerName( *seq ).c_str() // generic layer name
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
out.Print( 0, "\n\n" );
|
|
|
|
|
|
|
|
/* output hole lists:
|
2008-01-25 16:47:36 +00:00
|
|
|
* 1 - through holes
|
2015-10-23 14:30:22 +00:00
|
|
|
* 2 - for partial holes only: by layer starting and ending pair
|
|
|
|
* 3 - Non Plated through holes
|
2008-01-25 16:47:36 +00:00
|
|
|
*/
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
bool buildNPTHlist = false;
|
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
// in this loop are plated only:
|
|
|
|
for( unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2017-01-10 19:12:50 +00:00
|
|
|
DRILL_LAYER_PAIR pair = hole_sets[pair_ndx];
|
2008-01-25 16:47:36 +00:00
|
|
|
|
2017-01-15 15:35:47 +00:00
|
|
|
buildHolesList( pair, buildNPTHlist );
|
2008-01-25 16:47:36 +00:00
|
|
|
|
2017-01-10 19:12:50 +00:00
|
|
|
if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "Drill file '%s' contains\n",
|
2016-08-01 14:29:15 +00:00
|
|
|
TO_UTF8( drillFileName( pair, false, m_merge_PTH_NPTH ) ) );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, " plated through holes:\n" );
|
|
|
|
out.Print( 0, separator );
|
2015-11-16 18:42:58 +00:00
|
|
|
totalHoleCount = printToolSummary( out, false );
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2015-10-23 14:30:22 +00:00
|
|
|
else // blind/buried
|
2008-01-25 16:47:36 +00:00
|
|
|
{
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "Drill file '%s' contains\n",
|
2016-08-01 14:29:15 +00:00
|
|
|
TO_UTF8( drillFileName( pair, false, m_merge_PTH_NPTH ) ) );
|
2015-10-23 14:30:22 +00:00
|
|
|
|
|
|
|
out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n",
|
|
|
|
TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ),
|
|
|
|
TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ),
|
|
|
|
pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried"
|
|
|
|
);
|
|
|
|
|
|
|
|
out.Print( 0, separator );
|
2015-11-16 18:42:58 +00:00
|
|
|
totalHoleCount = printToolSummary( out, false );
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
|
2008-01-25 16:47:36 +00:00
|
|
|
}
|
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "\n\n" );
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
// NPTHoles. Generate the full list (pads+vias) if PTH and NPTH are merged,
|
|
|
|
// or only the NPTH list (which never has vias)
|
|
|
|
if( !m_merge_PTH_NPTH )
|
|
|
|
buildNPTHlist = true;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2017-01-15 15:35:47 +00:00
|
|
|
buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
|
2015-11-16 18:42:58 +00:00
|
|
|
|
|
|
|
// nothing wrong with an empty NPTH file in report.
|
|
|
|
if( m_merge_PTH_NPTH )
|
|
|
|
out.Print( 0, "Not plated through holes are merged with plated holes\n" );
|
|
|
|
else
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "Drill file '%s' contains\n",
|
2017-01-10 19:12:50 +00:00
|
|
|
TO_UTF8( drillFileName( DRILL_LAYER_PAIR( F_Cu, B_Cu ),
|
|
|
|
true, m_merge_PTH_NPTH ) ) );
|
2015-11-16 18:42:58 +00:00
|
|
|
|
|
|
|
out.Print( 0, " unplated through holes:\n" );
|
|
|
|
out.Print( 0, separator );
|
|
|
|
totalHoleCount = printToolSummary( out, true );
|
|
|
|
out.Print( 0, " Total unplated holes count %u\n", totalHoleCount );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
|
2017-01-15 15:35:47 +00:00
|
|
|
bool EXCELLON_WRITER::plotDrillMarks( PLOTTER* aPlotter )
|
2012-10-05 12:25:12 +00:00
|
|
|
{
|
|
|
|
// Plot the drill map:
|
|
|
|
wxPoint pos;
|
2014-03-06 18:38:39 +00:00
|
|
|
|
2012-10-05 12:25:12 +00:00
|
|
|
for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
|
|
|
|
{
|
2015-11-16 18:42:58 +00:00
|
|
|
const HOLE_INFO& hole = m_holeListBuffer[ii];
|
|
|
|
pos = hole.m_Hole_Pos;
|
2012-10-05 12:25:12 +00:00
|
|
|
|
2014-03-06 18:38:39 +00:00
|
|
|
// Always plot the drill symbol (for slots identifies the needed cutter!
|
2015-11-16 18:42:58 +00:00
|
|
|
aPlotter->Marker( pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
|
2012-10-05 12:25:12 +00:00
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
if( hole.m_Hole_Shape != 0 )
|
2012-10-05 12:25:12 +00:00
|
|
|
{
|
2015-11-16 18:42:58 +00:00
|
|
|
wxSize oblong_size = hole.m_Hole_Size;
|
2016-09-19 11:01:36 +00:00
|
|
|
aPlotter->FlashPadOval( pos, oblong_size, hole.m_Hole_Orient, SKETCH, NULL );
|
2012-10-05 12:25:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
2015-10-23 14:30:22 +00:00
|
|
|
|
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
unsigned EXCELLON_WRITER::printToolSummary( OUTPUTFORMATTER& out, bool aSummaryNPTH ) const
|
2015-10-23 14:30:22 +00:00
|
|
|
{
|
|
|
|
unsigned totalHoleCount = 0;
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
|
|
|
|
{
|
2015-11-16 18:42:58 +00:00
|
|
|
const DRILL_TOOL& tool = m_toolListBuffer[ii];
|
|
|
|
|
|
|
|
if( aSummaryNPTH && !tool.m_Hole_NotPlated )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !aSummaryNPTH && tool.m_Hole_NotPlated )
|
|
|
|
continue;
|
|
|
|
|
2015-10-23 14:30:22 +00:00
|
|
|
// List the tool number assigned to each drill,
|
|
|
|
// in mm then in inches.
|
2015-11-16 18:42:58 +00:00
|
|
|
int tool_number = ii+1;
|
|
|
|
out.Print( 0, " T%d %2.2fmm %2.3f\" ", tool_number,
|
|
|
|
diameter_in_mm( tool.m_Diameter ),
|
|
|
|
diameter_in_inches( tool.m_Diameter ) );
|
2015-10-23 14:30:22 +00:00
|
|
|
|
|
|
|
// Now list how many holes and ovals are associated with each drill.
|
2015-11-16 18:42:58 +00:00
|
|
|
if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "(1 hole)\n" );
|
2015-11-16 18:42:58 +00:00
|
|
|
else if( tool.m_TotalCount == 1 )
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "(1 hole) (with 1 slot)\n" );
|
2015-11-16 18:42:58 +00:00
|
|
|
else if( tool.m_OvalCount == 0 )
|
|
|
|
out.Print( 0, "(%d holes)\n", tool.m_TotalCount );
|
|
|
|
else if( tool.m_OvalCount == 1 )
|
|
|
|
out.Print( 0, "(%d holes) (with 1 slot)\n", tool.m_TotalCount );
|
|
|
|
else // tool.m_OvalCount > 1
|
2015-10-23 14:30:22 +00:00
|
|
|
out.Print( 0, "(%d holes) (with %d slots)\n",
|
2015-11-16 18:42:58 +00:00
|
|
|
tool.m_TotalCount, tool.m_OvalCount );
|
2015-10-23 14:30:22 +00:00
|
|
|
|
2015-11-16 18:42:58 +00:00
|
|
|
totalHoleCount += tool.m_TotalCount;
|
2015-10-23 14:30:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
out.Print( 0, "\n" );
|
|
|
|
|
|
|
|
return totalHoleCount;
|
|
|
|
}
|