2009-11-14 22:15:22 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* Functions to create drill data used to create files and report files */
|
|
|
|
/************************************************************************/
|
2008-01-18 15:47:15 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "base_struct.h"
|
|
|
|
#include "colors.h"
|
|
|
|
#include "drawtxt.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "kicad_string.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "macros.h"
|
|
|
|
|
|
|
|
#include "class_board.h"
|
|
|
|
|
2008-01-18 15:47:15 +00:00
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "gendrill.h"
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
|
2009-08-29 10:20:48 +00:00
|
|
|
Ki_PageDescr* aSheet,
|
2008-01-18 15:47:15 +00:00
|
|
|
std::vector<HOLE_INFO> aHoleListBuffer,
|
|
|
|
std::vector<DRILL_TOOL> aToolListBuffer,
|
2009-06-28 16:50:42 +00:00
|
|
|
bool aUnit_Drill_is_Inch, int format,
|
2009-08-29 10:20:48 +00:00
|
|
|
const wxPoint& auxoffset )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2010-12-08 20:12:46 +00:00
|
|
|
int x, y;
|
|
|
|
int plotX, plotY, TextWidth;
|
|
|
|
double scale = 1.0;
|
|
|
|
int intervalle = 0, CharSize = 0;
|
|
|
|
EDA_ITEM* PtStruct;
|
|
|
|
char line[1024];
|
|
|
|
int dX, dY;
|
|
|
|
wxPoint BoardCentre;
|
|
|
|
wxPoint offset;
|
|
|
|
wxString msg;
|
|
|
|
PLOTTER* plotter = NULL;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
SetLocaleTo_C_standard(); // Use the standard notation for float numbers
|
2011-02-25 16:23:24 +00:00
|
|
|
|
|
|
|
// Calculate dimensions and center of PCB
|
|
|
|
aPcb->ComputeBoundingBox();
|
2008-01-18 15:47:15 +00:00
|
|
|
|
|
|
|
dX = aPcb->m_BoundaryBox.GetWidth();
|
|
|
|
dY = aPcb->m_BoundaryBox.GetHeight();
|
|
|
|
BoardCentre = aPcb->m_BoundaryBox.Centre();
|
|
|
|
|
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
|
2008-01-18 15:47:15 +00:00
|
|
|
switch( format )
|
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
case PLOT_FORMAT_GERBER:
|
2009-08-29 10:20:48 +00:00
|
|
|
scale = 1;
|
|
|
|
offset = auxoffset;
|
|
|
|
plotter = new GERBER_PLOTTER();
|
|
|
|
plotter->set_viewport( offset, scale, 0 );
|
|
|
|
break;
|
2009-06-28 16:50:42 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
case PLOT_FORMAT_HPGL: /* Scale for HPGL format. */
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
|
|
|
offset.x = 0;
|
|
|
|
offset.y = 0;
|
2009-08-29 10:20:48 +00:00
|
|
|
scale = 1;
|
|
|
|
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
|
|
|
|
plotter = hpgl_plotter;
|
2010-12-11 18:40:39 +00:00
|
|
|
hpgl_plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
|
|
|
|
hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
|
2009-08-29 10:20:48 +00:00
|
|
|
hpgl_plotter->set_pen_overlap( 0 );
|
|
|
|
plotter->set_paper_size( aSheet );
|
|
|
|
plotter->set_viewport( offset, scale, 0 );
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2009-08-29 10:20:48 +00:00
|
|
|
break;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
|
|
|
case PLOT_FORMAT_POST:
|
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
Ki_PageDescr* SheetPS = &g_Sheet_A4;
|
|
|
|
wxSize SheetSize;
|
2008-01-18 15:47:15 +00:00
|
|
|
SheetSize.x = SheetPS->m_Size.x * U_PCB;
|
|
|
|
SheetSize.y = SheetPS->m_Size.y * U_PCB;
|
2009-08-29 10:20:48 +00:00
|
|
|
/* Keep size for drill legend */
|
2009-06-28 16:50:42 +00:00
|
|
|
double Xscale = (double) ( SheetSize.x * 0.8 ) / dX;
|
|
|
|
double Yscale = (double) ( SheetSize.y * 0.6 ) / dY;
|
|
|
|
|
|
|
|
scale = MIN( Xscale, Yscale );
|
|
|
|
|
2010-01-13 21:15:54 +00:00
|
|
|
offset.x = (int) ( (double) BoardCentre.x - ( (double) SheetSize.x / 2.0 ) / scale );
|
|
|
|
offset.y = (int) ( (double) BoardCentre.y - ( (double) SheetSize.y / 2.0 ) / scale );
|
2009-11-14 22:15:22 +00:00
|
|
|
offset.y += SheetSize.y / 8; /* offset to legend */
|
2009-08-29 10:20:48 +00:00
|
|
|
PS_PLOTTER* ps_plotter = new PS_PLOTTER;
|
|
|
|
plotter = ps_plotter;
|
|
|
|
ps_plotter->set_paper_size( SheetPS );
|
|
|
|
plotter->set_viewport( offset, scale, 0 );
|
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:
|
|
|
|
{
|
|
|
|
offset.x = 0;
|
|
|
|
offset.y = 0;
|
2009-08-29 10:20:48 +00:00
|
|
|
scale = 1;
|
|
|
|
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
|
|
|
|
plotter = dxf_plotter;
|
|
|
|
plotter->set_paper_size( aSheet );
|
|
|
|
plotter->set_viewport( offset, scale, 0 );
|
|
|
|
break;
|
2009-06-30 10:43:20 +00:00
|
|
|
}
|
|
|
|
|
2008-01-18 15:47:15 +00:00
|
|
|
default:
|
2009-08-29 10:20:48 +00:00
|
|
|
wxASSERT( false );
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->set_creator( wxT( "PCBNEW" ) );
|
|
|
|
plotter->set_filename( aFullFileName );
|
|
|
|
plotter->set_default_line_width( 10 );
|
|
|
|
plotter->start_plot( aFile );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
|
|
|
/* Draw items on edge layer */
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
for( PtStruct = aPcb->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:
|
2011-09-07 19:41:04 +00:00
|
|
|
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_TEXT_T:
|
2009-08-29 10:20:48 +00:00
|
|
|
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_DIMENSION_T:
|
2010-04-23 09:54:40 +00:00
|
|
|
PlotDimension( plotter, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
|
|
|
PlotPcbTarget( plotter, (PCB_TARGET*) PtStruct, EDGE_LAYER, FILLED );
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MARKER_T: // do not draw
|
2008-01-18 15:47:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DisplayError( NULL, wxT( "WinEDA_DrillFrame::GenDrillMap() : Unexpected Draw Type" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-19 10:54:53 +00:00
|
|
|
// Set Drill Symbols width in 1/10000 mils
|
2009-08-29 10:20:48 +00:00
|
|
|
plotter->set_default_line_width( 10 );
|
|
|
|
plotter->set_current_line_width( -1 );
|
|
|
|
|
2009-03-19 10:54:53 +00:00
|
|
|
// Plot board outlines and drill map
|
2009-08-29 10:20:48 +00:00
|
|
|
Gen_Drill_PcbMap( aPcb, plotter, aHoleListBuffer, aToolListBuffer );
|
2009-03-19 10:54:53 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Print a list of symbols used. */
|
|
|
|
CharSize = 800; /* text size in 1/10000 mils */
|
|
|
|
double CharScale = 1.0 / scale; /* real scale will be CharScale
|
|
|
|
* scale_x, because the global
|
|
|
|
* plot scale is scale_x */
|
|
|
|
TextWidth = (int) ( (CharSize * CharScale) / 10 ); // Set text width (thickness)
|
2009-08-29 10:20:48 +00:00
|
|
|
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Trace information. */
|
2010-01-13 21:15:54 +00:00
|
|
|
plotX = (int) ( (double) aPcb->m_BoundaryBox.GetX() + 200.0 * CharScale );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotY = aPcb->m_BoundaryBox.GetBottom() + intervalle;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
/* Plot title "Info" */
|
|
|
|
wxString Text = wxT( "Drill Map:" );
|
2009-11-14 22:15:22 +00:00
|
|
|
plotter->text( wxPoint( plotX, plotY ), BLACK, Text, 0,
|
|
|
|
wxSize( (int) ( CharSize * CharScale ),
|
|
|
|
(int) ( 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
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
for( unsigned ii = 0; ii < aToolListBuffer.size(); ii++ )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
|
|
|
int plot_diam;
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2008-01-18 15:47:15 +00:00
|
|
|
if( aToolListBuffer[ii].m_TotalCount == 0 )
|
|
|
|
continue;
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
plotY += intervalle;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
plot_diam = (int) ( aToolListBuffer[ii].m_Diameter );
|
2010-01-13 21:15:54 +00:00
|
|
|
x = (int) ( (double) plotX - 200.0 * CharScale - (double)plot_diam / 2.0 );
|
|
|
|
y = (int) ( (double) plotY + (double) CharSize * CharScale );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->marker( wxPoint( x, y ), plot_diam, ii );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Trace the legends. */
|
2009-08-29 10:20:48 +00:00
|
|
|
|
|
|
|
// List the diameter of each drill in the selected Drill Unit,
|
|
|
|
// and then its diameter in the other Drill Unit.
|
|
|
|
if( aUnit_Drill_is_Inch )
|
|
|
|
sprintf( line, "%2.3f\" / %2.2fmm ",
|
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.0001,
|
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.00254 );
|
|
|
|
else
|
|
|
|
sprintf( line, "%2.2fmm / %2.3f\" ",
|
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
|
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.
|
|
|
|
if( ( aToolListBuffer[ii].m_TotalCount == 1 )
|
|
|
|
&& ( aToolListBuffer[ii].m_OvalCount == 0 ) )
|
|
|
|
sprintf( line, "(1 hole)" );
|
|
|
|
else if( aToolListBuffer[ii].m_TotalCount == 1 ) // && ( aToolListBuffer[ii]m_OvalCount == 1 )
|
|
|
|
sprintf( line, "(1 slot)" );
|
|
|
|
else if( aToolListBuffer[ii].m_OvalCount == 0 )
|
2011-09-07 19:41:04 +00:00
|
|
|
sprintf( line, "(%d holes)", aToolListBuffer[ii].m_TotalCount );
|
2009-08-29 10:20:48 +00:00
|
|
|
else if( aToolListBuffer[ii].m_OvalCount == 1 )
|
2011-09-07 19:41:04 +00:00
|
|
|
sprintf( line, "(%d holes + 1 slot)", aToolListBuffer[ii].m_TotalCount - 1 );
|
2009-08-29 10:20:48 +00:00
|
|
|
else // if ( aToolListBuffer[ii]m_OvalCount > 1 )
|
|
|
|
sprintf( line, "(%d holes + %d slots)",
|
|
|
|
aToolListBuffer[ii].m_TotalCount -
|
|
|
|
aToolListBuffer[ii].m_OvalCount,
|
|
|
|
aToolListBuffer[ii].m_OvalCount );
|
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
|
|
|
plotter->text( wxPoint( plotX, y ), BLACK,
|
|
|
|
msg,
|
|
|
|
0, wxSize( (int) ( CharSize * CharScale ), (int) ( CharSize * CharScale ) ),
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
|
|
|
TextWidth, false, false );
|
|
|
|
|
|
|
|
intervalle = (int) ( CharSize * CharScale ) + TextWidth;
|
|
|
|
intervalle = (int) ( intervalle * 1.2 );
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( intervalle < (plot_diam + 200 + TextWidth) )
|
|
|
|
intervalle = plot_diam + 200 + TextWidth;
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->end_plot();
|
|
|
|
delete plotter;
|
2009-08-29 10:20:48 +00:00
|
|
|
SetLocaleTo_Default(); // Revert to local notation for float numbers
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Creates the drill map aFile in HPGL or POSTSCRIPT format
|
2010-12-28 11:24:42 +00:00
|
|
|
* @param aPcb = the BOARD
|
|
|
|
* @param aPlotter = a PLOTTER instance (HPGL or POSTSCRIPT plotter).
|
2008-01-18 15:47:15 +00:00
|
|
|
* @param aHoleListBuffer = std::vector<HOLE_INFO> list of holes descriptors
|
|
|
|
* @param aToolListBuffer = std::vector<DRILL_TOOL> drill list buffer
|
|
|
|
*/
|
2010-12-28 11:24:42 +00:00
|
|
|
void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter,
|
2009-11-14 22:15:22 +00:00
|
|
|
std::vector<HOLE_INFO>& aHoleListBuffer,
|
|
|
|
std::vector<DRILL_TOOL>& aToolListBuffer )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
|
|
|
wxPoint pos;
|
|
|
|
|
|
|
|
/* create the drill list */
|
|
|
|
if( aToolListBuffer.size() > 13 )
|
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( NULL,
|
2011-09-07 19:41:04 +00:00
|
|
|
_( " Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\nPlot uses circle shape for some drill values" ),
|
2009-08-29 10:20:48 +00:00
|
|
|
10 );
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Plot the drill map:
|
|
|
|
for( unsigned ii = 0; ii < aHoleListBuffer.size(); ii++ )
|
|
|
|
{
|
2011-08-19 13:08:24 +00:00
|
|
|
pos = aHoleListBuffer[ii].m_Hole_Pos;
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
/* Always plot the drill symbol (for slots identifies the needed
|
|
|
|
* cutter!) */
|
2010-12-28 11:24:42 +00:00
|
|
|
aPlotter->marker( pos, aHoleListBuffer[ii].m_Hole_Diameter,
|
2011-09-07 19:41:04 +00:00
|
|
|
aHoleListBuffer[ii].m_Tool_Reference - 1 );
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
if( aHoleListBuffer[ii].m_Hole_Shape != 0 )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
|
|
|
wxSize oblong_size;
|
2011-08-19 13:08:24 +00:00
|
|
|
oblong_size = aHoleListBuffer[ii].m_Hole_Size;
|
2010-12-28 11:24:42 +00:00
|
|
|
aPlotter->flash_pad_oval( pos, oblong_size,
|
2011-09-07 19:41:04 +00:00
|
|
|
aHoleListBuffer[ii].m_Hole_Orient, FILAIRE );
|
2009-08-29 10:20:48 +00:00
|
|
|
}
|
2008-01-18 15:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create a list of drill values and drill count
|
|
|
|
*/
|
2009-11-14 22:15:22 +00:00
|
|
|
void GenDrillReportFile( FILE* aFile, BOARD* aPcb,
|
|
|
|
const wxString& aBoardFilename,
|
|
|
|
bool aUnit_Drill_is_Inch,
|
|
|
|
std::vector<HOLE_INFO>& aHoleListBuffer,
|
|
|
|
std::vector<DRILL_TOOL>& aToolListBuffer )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
|
|
|
unsigned TotalHoleCount;
|
|
|
|
char line[1024];
|
2009-12-07 03:46:13 +00:00
|
|
|
int layer1 = LAYER_N_BACK;
|
|
|
|
int layer2 = LAYER_N_FRONT;
|
2008-01-25 16:47:36 +00:00
|
|
|
bool gen_through_holes = true;
|
2011-08-19 13:08:24 +00:00
|
|
|
bool gen_NPTH_holes = false;
|
2008-01-25 16:47:36 +00:00
|
|
|
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2011-02-28 18:36:19 +00:00
|
|
|
fprintf( aFile, "Drill report for %s\n", TO_UTF8( aBoardFilename ) );
|
2008-01-18 15:47:15 +00:00
|
|
|
fprintf( aFile, "Created on %s\n", DateAndTime( line ) );
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// List which Drill Unit option had been selected for the associated
|
|
|
|
// drill aFile.
|
2008-01-18 15:47:15 +00:00
|
|
|
if( aUnit_Drill_is_Inch )
|
|
|
|
fputs( "Selected Drill Unit: Imperial (\")\n\n", aFile );
|
|
|
|
else
|
|
|
|
fputs( "Selected Drill Unit: Metric (mm)\n\n", aFile );
|
|
|
|
|
2008-01-25 16:47:36 +00:00
|
|
|
/* build hole lists:
|
|
|
|
* 1 - through holes
|
|
|
|
* 2 - for partial holes only: by layer pair
|
2011-08-19 13:08:24 +00:00
|
|
|
* 3 - Not Plated through holes
|
2008-01-25 16:47:36 +00:00
|
|
|
*/
|
2008-01-18 15:47:15 +00:00
|
|
|
|
2008-01-25 16:47:36 +00:00
|
|
|
for( ; ; )
|
2008-01-18 15:47:15 +00:00
|
|
|
{
|
2008-01-25 16:47:36 +00:00
|
|
|
Build_Holes_List( aPcb,
|
|
|
|
aHoleListBuffer,
|
|
|
|
aToolListBuffer,
|
|
|
|
layer1,
|
|
|
|
layer2,
|
2011-08-19 13:08:24 +00:00
|
|
|
gen_through_holes ? false : true, gen_NPTH_holes );
|
2008-01-25 16:47:36 +00:00
|
|
|
|
|
|
|
TotalHoleCount = 0;
|
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
if( gen_NPTH_holes )
|
|
|
|
{
|
|
|
|
sprintf( line, "Drill report for Not Plated through holes :\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
else if( gen_through_holes )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2008-01-25 16:47:36 +00:00
|
|
|
sprintf( line, "Drill report for through holes :\n" );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2008-01-18 15:47:15 +00:00
|
|
|
else
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2009-12-07 03:46:13 +00:00
|
|
|
if( layer1 == LAYER_N_BACK ) // First partial hole list
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
2009-08-29 10:20:48 +00:00
|
|
|
sprintf( line, "Drill report for buried and blind vias :\n\n" );
|
2008-03-22 05:55:06 +00:00
|
|
|
fputs( line, aFile );
|
|
|
|
}
|
|
|
|
|
2008-01-25 16:47:36 +00:00
|
|
|
sprintf( line, "Drill report for holes from layer %s to layer %s\n",
|
2011-09-07 19:41:04 +00:00
|
|
|
TO_UTF8( aPcb->GetLayerName( layer1 ) ),
|
|
|
|
TO_UTF8( aPcb->GetLayerName( layer2 ) ) );
|
2008-03-22 05:55:06 +00:00
|
|
|
}
|
2008-01-25 16:47:36 +00:00
|
|
|
|
2008-01-18 15:47:15 +00:00
|
|
|
fputs( line, aFile );
|
|
|
|
|
2008-01-25 16:47:36 +00:00
|
|
|
for( unsigned ii = 0; ii < aToolListBuffer.size(); ii++ )
|
|
|
|
{
|
|
|
|
// List the tool number assigned to each drill,
|
|
|
|
// then its diameter in the selected Drill Unit,
|
|
|
|
// and then its diameter in the other Drill Unit.
|
|
|
|
if( aUnit_Drill_is_Inch )
|
|
|
|
sprintf( line, "T%d %2.3f\" %2.2fmm ",
|
|
|
|
ii + 1,
|
2009-06-28 16:50:42 +00:00
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.0001,
|
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.00254 );
|
2008-01-25 16:47:36 +00:00
|
|
|
else
|
|
|
|
sprintf( line, "T%d %2.2fmm %2.3f\" ",
|
|
|
|
ii + 1,
|
2009-06-28 16:50:42 +00:00
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.00254,
|
|
|
|
double (aToolListBuffer[ii].m_Diameter) * 0.0001 );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2008-01-25 16:47:36 +00:00
|
|
|
fputs( line, aFile );
|
|
|
|
|
|
|
|
// Now list how many holes and ovals are associated with each drill.
|
|
|
|
if( ( aToolListBuffer[ii].m_TotalCount == 1 )
|
|
|
|
&& ( aToolListBuffer[ii].m_OvalCount == 0 ) )
|
|
|
|
sprintf( line, "(1 hole)\n" );
|
|
|
|
else if( aToolListBuffer[ii].m_TotalCount == 1 )
|
|
|
|
sprintf( line, "(1 hole) (with 1 oblong)\n" );
|
|
|
|
else if( aToolListBuffer[ii].m_OvalCount == 0 )
|
2011-09-07 19:41:04 +00:00
|
|
|
sprintf( line, "(%d holes)\n", aToolListBuffer[ii].m_TotalCount );
|
2008-01-25 16:47:36 +00:00
|
|
|
else if( aToolListBuffer[ii].m_OvalCount == 1 )
|
2011-09-07 19:41:04 +00:00
|
|
|
sprintf( line, "(%d holes) (with 1 oblong)\n", aToolListBuffer[ii].m_TotalCount );
|
2008-01-25 16:47:36 +00:00
|
|
|
else // if ( buffer[ii]m_OvalCount > 1 )
|
|
|
|
sprintf( line, "(%d holes) (with %d oblongs)\n",
|
|
|
|
aToolListBuffer[ii].m_TotalCount,
|
|
|
|
aToolListBuffer[ii].m_OvalCount );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2008-01-25 16:47:36 +00:00
|
|
|
fputs( line, aFile );
|
|
|
|
|
|
|
|
TotalHoleCount += aToolListBuffer[ii].m_TotalCount;
|
|
|
|
}
|
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
if( gen_NPTH_holes )
|
|
|
|
sprintf( line, "\ntotal Not Plated holes count %d\n\n\n", TotalHoleCount );
|
|
|
|
else
|
|
|
|
sprintf( line, "\ntotal plated holes count %d\n\n\n", TotalHoleCount );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2008-01-18 15:47:15 +00:00
|
|
|
fputs( line, aFile );
|
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
if( gen_NPTH_holes )
|
|
|
|
{
|
2008-01-25 16:47:36 +00:00
|
|
|
break;
|
2011-08-19 13:08:24 +00:00
|
|
|
}
|
2008-01-25 16:47:36 +00:00
|
|
|
else
|
|
|
|
{
|
2011-08-19 13:08:24 +00:00
|
|
|
if( aPcb->GetCopperLayerCount() <= 2 )
|
|
|
|
{
|
|
|
|
gen_NPTH_holes = true;
|
|
|
|
continue;
|
|
|
|
}
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
if( gen_through_holes )
|
2011-09-07 19:41:04 +00:00
|
|
|
{
|
2011-08-19 13:08:24 +00:00
|
|
|
layer2 = layer1 + 1;
|
2011-09-07 19:41:04 +00:00
|
|
|
}
|
2011-08-19 13:08:24 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if( layer2 >= LAYER_N_FRONT ) // no more layer pair to consider
|
|
|
|
{
|
|
|
|
gen_NPTH_holes = true;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
layer1++; layer2++; // use next layer pair
|
|
|
|
|
|
|
|
if( layer2 == aPcb->GetCopperLayerCount() - 1 )
|
|
|
|
layer2 = LAYER_N_FRONT; // the last layer is always the
|
|
|
|
// component layer
|
|
|
|
}
|
|
|
|
gen_through_holes = false;
|
2008-01-25 16:47:36 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-18 15:47:15 +00:00
|
|
|
|
|
|
|
fclose( aFile );
|
|
|
|
}
|