KiCad PCB EDA Suite
Loading...
Searching...
No Matches
gen_drill_report_files.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 1992-2017 Jean_Pierre Charras <jp.charras at wanadoo.fr>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
28#include <eda_item.h>
29#include <font/font.h>
30#include <confirm.h>
31#include <richio.h>
32#include <string_utils.h>
33#include <locale_io.h>
34#include <macros.h>
35#include <math/util.h> // for KiROUND
36
37#include <board.h>
38#include <footprint.h>
39
40#include <pcbplot.h>
42#include <pcb_painter.h>
43#include <pcb_shape.h>
44
45
46/* Conversion utilities - these will be used often in there... */
47inline double diameter_in_inches( double ius )
48{
49 return ius * 0.001 / pcbIUScale.IU_PER_MILS;
50}
51
52
53inline double diameter_in_mm( double ius )
54{
55 return ius / pcbIUScale.IU_PER_MM;
56}
57
58
59// return a pen size to plot markers and having a readable shape
60// clamped to be >= MIN_SIZE_MM to avoid too small line width
61static int getMarkerBestPenSize( int aMarkerDiameter )
62{
63 int bestsize = aMarkerDiameter / 10;
64
65 const double MIN_SIZE_MM = 0.1;
66 bestsize = std::max( bestsize, pcbIUScale.mmToIU( MIN_SIZE_MM ) );
67
68 return bestsize;
69}
70
71
72// return a pen size to plot outlines for oval holes
74{
75 const double SKETCH_LINE_WIDTH_MM = 0.1;
76 return pcbIUScale.mmToIU( SKETCH_LINE_WIDTH_MM );
77}
78
79
80// return a default pen size to plot items with no specific line thickness
82{
83 const double DEFAULT_LINE_WIDTH_MM = 0.2;
84 return pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH_MM );
85}
86
87
88bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat )
89{
90 // Remark:
91 // Hole list must be created before calling this function, by buildHolesList(),
92 // for the right holes set (PTH, NPTH, buried/blind vias ...)
93
94 double scale = 1.0;
95 VECTOR2I offset = GetOffset();
96 PLOTTER* plotter = nullptr;
98 int bottom_limit = 0; // Y coord limit of page. 0 mean do not use
99
100 PCB_PLOT_PARAMS plot_opts; // starts plotting with default options
101
102 LOCALE_IO toggle; // use standard C notation for float numbers
103
104 const PAGE_INFO& page_info = m_pageInfo ? *m_pageInfo : dummy;
105
106 // Calculate dimensions and center of PCB. The Edge_Cuts layer must be visible
107 // to calculate the board edges bounding box
108 LSET visibleLayers = m_pcb->GetVisibleLayers();
109 m_pcb->SetVisibleLayers( visibleLayers | LSET( { Edge_Cuts } ) );
111 m_pcb->SetVisibleLayers( visibleLayers );
112
113 // Some formats cannot be used to generate a document like the map files
114 // Currently HPGL (old format not very used)
115
116 if( aFormat == PLOT_FORMAT::HPGL )
117 aFormat = PLOT_FORMAT::PDF;
118
119 // Calculate the scale for the format type, scale 1 in HPGL, drawing on
120 // an A4 sheet in PS, + text description of symbols
121 switch( aFormat )
122 {
123 case PLOT_FORMAT::GERBER:
124 plotter = new GERBER_PLOTTER();
125 plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
126 plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
127 break;
128
129 default:
130 wxASSERT( false );
132
133 case PLOT_FORMAT::PDF:
134 case PLOT_FORMAT::POST:
135 case PLOT_FORMAT::SVG:
136 {
137 VECTOR2I pageSizeIU = page_info.GetSizeIU( pcbIUScale.IU_PER_MILS );
138
139 // Reserve a 10 mm margin around the page.
140 int margin = pcbIUScale.mmToIU( 10 );
141
142 // Calculate a scaling factor to print the board on the sheet
143 double Xscale = double( pageSizeIU.x - ( 2 * margin ) ) / bbbox.GetWidth();
144
145 // We should print the list of drill sizes, so reserve room for it
146 // 60% height for board 40% height for list
147 int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
148 double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
149
150 scale = std::min( Xscale, Yscale );
151
152 // Experience shows the scale should not to large, because texts
153 // create problem (can be to big or too small).
154 // So the scale is clipped at 3.0;
155 scale = std::min( scale, 3.0 );
156
157 offset.x = KiROUND( double( bbbox.Centre().x ) - ( pageSizeIU.x / 2.0 ) / scale );
158 offset.y = KiROUND( double( bbbox.Centre().y ) - ( ypagesize_for_board / 2.0 ) / scale );
159
160 // bottom_limit is used to plot the legend (drill diameters)
161 // texts are scaled differently for scale > 1.0 and <= 1.0
162 // so the limit is scaled differently.
163 bottom_limit = ( pageSizeIU.y - margin ) / std::min( scale, 1.0 );
164
165 if( aFormat == PLOT_FORMAT::SVG )
166 plotter = new SVG_PLOTTER;
167 else if( aFormat == PLOT_FORMAT::PDF )
168 plotter = new PDF_PLOTTER;
169 else
170 plotter = new PS_PLOTTER;
171
172 plotter->SetPageSettings( page_info );
173 plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
174 break;
175 }
176
177 case PLOT_FORMAT::DXF:
178 {
179 DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
180
181 dxf_plotter->SetUnits( m_unitsMetric ? DXF_UNITS::MM : DXF_UNITS::INCH );
182
183 plotter = dxf_plotter;
184 plotter->SetPageSettings( page_info );
185 plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
186 break;
187 }
188 }
189
190 plotter->SetCreator( wxT( "PCBNEW" ) );
191 plotter->SetColorMode( false );
192
193 KIGFX::PCB_RENDER_SETTINGS renderSettings;
194 renderSettings.SetDefaultPenWidth( getDefaultPenSize() );
195
196 plotter->SetRenderSettings( &renderSettings );
197
198 if( !plotter->OpenFile( aFullFileName ) )
199 {
200 delete plotter;
201 return false;
202 }
203
204 plotter->ClearHeaderLinesList();
205
206 // For the Gerber X2 format we need to set the "FileFunction" to Drillmap
207 // and set a few other options.
208 if( plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
209 {
210 GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
211 gbrplotter->DisableApertMacros( false );
212 gbrplotter->UseX2format( true ); // Mandatory
213 gbrplotter->UseX2NetAttributes( false ); // net attributes have no meaning here
214
215 // Attributes are added using X2 format
216 AddGerberX2Header( gbrplotter, m_pcb, false );
217
218 wxString text;
219
220 // Add the TF.FileFunction
221 text = "%TF.FileFunction,Drillmap*%";
222 gbrplotter->AddLineToHeader( text );
223
224 // Add the TF.FilePolarity
225 text = wxT( "%TF.FilePolarity,Positive*%" );
226 gbrplotter->AddLineToHeader( text );
227 }
228
229 plotter->StartPlot( wxT( "1" ) );
230
231 // Draw items on edge layer.
232 // Not all, only items useful for drill map, i.e. board outlines.
233 BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
234
235 // Use attributes of a drawing layer (we are not really draw the Edge.Cuts layer)
236 itemplotter.SetLayerSet( { Dwgs_User } );
237
238 for( BOARD_ITEM* item : m_pcb->Drawings() )
239 {
240 if( item->GetLayer() != Edge_Cuts )
241 continue;
242
243 switch( item->Type() )
244 {
245 case PCB_SHAPE_T:
246 {
247 PCB_SHAPE dummy_shape( *static_cast<PCB_SHAPE*>( item ) );
248 dummy_shape.SetLayer( Dwgs_User );
249 dummy_shape.SetParentGroup( nullptr ); // Remove group association, not needed for plotting
250 itemplotter.PlotShape( &dummy_shape );
251 }
252 break;
253
254 default:
255 break;
256 }
257 }
258
259 // Plot edge cuts in footprints
260 for( const FOOTPRINT* footprint : m_pcb->Footprints() )
261 {
262 for( BOARD_ITEM* item : footprint->GraphicalItems() )
263 {
264 if( item-> GetLayer() != Edge_Cuts )
265 continue;
266
267 switch( item->Type() )
268 {
269 case PCB_SHAPE_T:
270 {
271 PCB_SHAPE dummy_shape( *static_cast<PCB_SHAPE*>( item ) );
272 dummy_shape.SetLayer( Dwgs_User );
273 dummy_shape.SetParentGroup( nullptr ); // Remove group association, not needed for plotting
274 itemplotter.PlotShape( &dummy_shape );
275 }
276 break;
277
278 default:
279 break;
280 }
281 }
282 }
283
284 int plotX, plotY, TextWidth;
285 int intervalle = 0;
286 char line[1024];
287 wxString msg;
288 int textmarginaftersymbol = pcbIUScale.mmToIU( 2 );
289
290 // Set Drill Symbols width
291 plotter->SetCurrentLineWidth( -1 );
292
293 // Plot board outlines and drill map
294 plotDrillMarks( plotter );
295
296 // Print a list of symbols used.
297 int charSize = pcbIUScale.mmToIU( 2 ); // text size in IUs
298
299 // real char scale will be 1/scale, because the global plot scale is scale
300 // for scale < 1.0 ( plot bigger actual size)
301 // Therefore charScale = 1.0 / scale keep the initial charSize
302 // (for scale < 1 we use the global scaling factor: the board must be plotted
303 // smaller than the actual size)
304 double charScale = std::min( 1.0, 1.0 / scale );
305
306 TextWidth = KiROUND( ( charSize * charScale ) / 10.0 ); // Set text width (thickness)
307 intervalle = KiROUND( charSize * charScale ) + TextWidth;
308
309 // Trace information.
310 plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
311 plotY = bbbox.GetBottom() + intervalle;
312
313 // Plot title "Info"
314 wxString Text = wxT( "Drill Map:" );
315
316 TEXT_ATTRIBUTES attrs;
317 attrs.m_StrokeWidth = TextWidth;
319 attrs.m_Size = VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) );
322 attrs.m_Multiline = false;
323
324 plotter->PlotText( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs,
325 nullptr /* stroke font */, KIFONT::METRICS::Default() );
326
327 // For some formats (PS, PDF SVG) we plot the drill size list on more than one column
328 // because the list must be contained inside the printed page
329 // (others formats do not have a defined page size)
330 int max_line_len = 0; // The max line len in iu of the currently plotted column
331
332 for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
333 {
334 DRILL_TOOL& tool = m_toolListBuffer[ii];
335
336 if( tool.m_TotalCount == 0 )
337 continue;
338
339 plotY += intervalle;
340
341 // Ensure there are room to plot the line
342 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
343 {
344 plotY = bbbox.GetBottom() + intervalle;
345 plotX += max_line_len + pcbIUScale.mmToIU( 10 );//column_width;
346 max_line_len = 0;
347 }
348
349 int plot_diam = KiROUND( tool.m_Diameter );
350
351 // For markers plotted with the comment, keep marker size <= text height
352 plot_diam = std::min( plot_diam, KiROUND( charSize * charScale ) );
353 int x = KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
354 int y = KiROUND( plotY + charSize * charScale );
355
356 plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
357 plotter->Marker( VECTOR2I( x, y ), plot_diam, ii );
358 plotter->SetCurrentLineWidth( -1 );
359
360 // List the diameter of each drill in mm and inches.
361 snprintf( line, sizeof(line), "%3.3fmm / %2.4f\" ", diameter_in_mm( tool.m_Diameter ),
363
364 msg = From_UTF8( line );
365 const char* extra_info;
366
367 // Add more info for holes with specific constraints (castelleted, pressfit)
368 // note: only PTH pads have this option
369 if( tool.m_HoleAttribute == HOLE_ATTRIBUTE::HOLE_PAD_CASTELLATED )
370 extra_info = ", castellated";
371 else if( tool.m_HoleAttribute == HOLE_ATTRIBUTE::HOLE_PAD_PRESSFIT )
372 extra_info = ", press-fit";
373 else
374 extra_info = "";
375
376 // Now list how many holes and ovals are associated with each drill.
377 if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
378 snprintf( line, sizeof(line), "(1 hole%s)", extra_info );
379 else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
380 snprintf( line, sizeof(line), "(1 slot%s)", extra_info );
381 else if( tool.m_OvalCount == 0 )
382 snprintf( line, sizeof(line), "(%d holes%s)", tool.m_TotalCount, extra_info );
383 else if( tool.m_OvalCount == 1 )
384 snprintf( line, sizeof(line), "(%d holes + 1 slot%s)", tool.m_TotalCount - 1, extra_info );
385 else // if ( toolm_OvalCount > 1 )
386 snprintf( line, sizeof(line), "(%d holes + %d slots%s)", tool.m_TotalCount - tool.m_OvalCount,
387 tool.m_OvalCount, extra_info );
388
389 msg += From_UTF8( line );
390
391 if( tool.m_Hole_NotPlated )
392 msg += wxT( " (not plated)" );
393
394 plotter->PlotText( VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, attrs,
395 nullptr /* stroke font */, KIFONT::METRICS::Default() );
396
397 intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
398
399 if( intervalle < ( plot_diam + ( 1 * pcbIUScale.IU_PER_MM / scale ) + TextWidth ) )
400 intervalle = plot_diam + ( 1 * pcbIUScale.IU_PER_MM / scale ) + TextWidth;
401
402 // Evaluate the text horizontal size, to know the maximal column size
403 // This is a rough value, but ok to create a new column to plot next texts
404 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
405 max_line_len = std::max( max_line_len, text_len + plot_diam );
406 }
407
408 plotter->EndPlot();
409 delete plotter;
410
411 return true;
412}
413
414
415bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
416{
417 FILE_OUTPUTFORMATTER out( aFullFileName );
418
419 static const char separator[] =
420 " =============================================================\n";
421
422 wxASSERT( m_pcb );
423
424 unsigned totalHoleCount;
425 wxFileName brdFilename( m_pcb->GetFileName() );
426
427 std::vector<DRILL_LAYER_PAIR> hole_sets = getUniqueLayerPairs();
428
429 out.Print( 0, "Drill report for %s\n", TO_UTF8( brdFilename.GetFullName() ) );
430 out.Print( 0, "Created on %s\n\n", TO_UTF8( GetISO8601CurrentDateTime() ) );
431
432 // Output the cu layer stackup, so layer name references make sense.
433 out.Print( 0, "Copper Layer Stackup:\n" );
434 out.Print( 0, separator );
435
436 int conventional_layer_num = 1;
437
439 {
440 out.Print( 0, " L%-2d: %-25s %s\n",
441 conventional_layer_num++,
442 TO_UTF8( m_pcb->GetLayerName( layer ) ),
443 layerName( layer ).c_str() ); // generic layer name
444 }
445
446 out.Print( 0, "\n\n" );
447
448 /* output hole lists:
449 * 1 - through holes
450 * 2 - for partial holes only: by layer starting and ending pair
451 * 3 - Non Plated through holes
452 */
453
454 bool buildNPTHlist = false; // First pass: build PTH list only
455
456 // in this loop are plated only:
457 for( unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
458 {
459 DRILL_LAYER_PAIR pair = hole_sets[pair_ndx];
460
461 buildHolesList( pair, buildNPTHlist );
462
463 if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
464 {
465 out.Print( 0, "Drill file '%s' contains\n",
466 TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
467
468 out.Print( 0, " plated through holes:\n" );
469 out.Print( 0, separator );
470 totalHoleCount = printToolSummary( out, false );
471 out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
472 }
473 else // blind/buried
474 {
475 out.Print( 0, "Drill file '%s' contains\n",
476 TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
477
478 out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n",
479 TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ),
480 TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ),
481 pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" );
482
483 out.Print( 0, separator );
484 totalHoleCount = printToolSummary( out, false );
485 out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
486 }
487
488 out.Print( 0, "\n\n" );
489 }
490
491 // NPTHoles. Generate the full list (pads+vias) if PTH and NPTH are merged,
492 // or only the NPTH list (which never has vias)
493 if( !m_merge_PTH_NPTH )
494 buildNPTHlist = true;
495
496 buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
497
498 // nothing wrong with an empty NPTH file in report.
499 if( m_merge_PTH_NPTH )
500 out.Print( 0, "Not plated through holes are merged with plated holes\n" );
501 else
502 out.Print( 0, "Drill file '%s' contains\n",
504 true, m_merge_PTH_NPTH ) ) );
505
506 out.Print( 0, " unplated through holes:\n" );
507 out.Print( 0, separator );
508 totalHoleCount = printToolSummary( out, true );
509 out.Print( 0, " Total unplated holes count %u\n", totalHoleCount );
510
511 return true;
512}
513
514
516{
517 // Plot the drill map:
518 for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
519 {
520 const HOLE_INFO& hole = m_holeListBuffer[ii];
521
522 // Gives a good line thickness to have a good marker shape:
524
525 // Always plot the drill symbol (for slots identifies the needed cutter!
526 aPlotter->Marker( hole.m_Hole_Pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
527
528 if( hole.m_Hole_Shape != 0 )
529 {
530 aPlotter->ThickOval( hole.m_Hole_Pos, hole.m_Hole_Size, hole.m_Hole_Orient,
531 getSketchOvalBestPenSize(), nullptr );
532 }
533 }
534
536
537 return true;
538}
539
540
541unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSummaryNPTH ) const
542{
543 unsigned totalHoleCount = 0;
544
545 for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
546 {
547 const DRILL_TOOL& tool = m_toolListBuffer[ii];
548
549 if( aSummaryNPTH && !tool.m_Hole_NotPlated )
550 continue;
551
552 if( !aSummaryNPTH && tool.m_Hole_NotPlated )
553 continue;
554
555 // List the tool number assigned to each drill in mm then in inches.
556 int tool_number = ii+1;
557 out.Print( 0, " T%d %2.3fmm %2.4f\" ", tool_number,
560
561 // Now list how many holes and ovals are associated with each drill.
562 if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
563 out.Print( 0, "(1 hole" );
564 else if( tool.m_TotalCount == 1 )
565 out.Print( 0, "(1 hole) (with 1 slot" );
566 else if( tool.m_OvalCount == 0 )
567 out.Print( 0, "(%d holes)", tool.m_TotalCount );
568 else if( tool.m_OvalCount == 1 )
569 out.Print( 0, "(%d holes) (with 1 slot", tool.m_TotalCount );
570 else // tool.m_OvalCount > 1
571 out.Print( 0, "(%d holes) (with %d slots", tool.m_TotalCount, tool.m_OvalCount );
572
573 if( tool.m_HoleAttribute == HOLE_ATTRIBUTE::HOLE_PAD_CASTELLATED )
574 out.Print( 0, ", castellated" );
575
576 if( tool.m_HoleAttribute == HOLE_ATTRIBUTE::HOLE_PAD_PRESSFIT )
577 out.Print( 0, ", press-fit" );
578
579 out.Print( 0, ")\n");
580
581 totalHoleCount += tool.m_TotalCount;
582 }
583
584 out.Print( 0, "\n" );
585
586 return totalHoleCount;
587}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:112
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition: box2.h:990
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
void SetVisibleLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:939
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:1002
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:921
int GetCopperLayerCount() const
Definition: board.cpp:859
const FOOTPRINTS & Footprints() const
Definition: board.h:358
const wxString & GetFileName() const
Definition: board.h:354
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:680
const DRAWINGS & Drawings() const
Definition: board.h:360
constexpr size_type GetWidth() const
Definition: box2.h:214
constexpr Vec Centre() const
Definition: box2.h:97
constexpr coord_type GetX() const
Definition: box2.h:207
constexpr size_type GetHeight() const
Definition: box2.h:215
constexpr coord_type GetBottom() const
Definition: box2.h:222
void SetLayerSet(const LSET &aLayerMask)
Definition: pcbplot.h:86
void PlotShape(const PCB_SHAPE *aShape)
HOLE_ATTRIBUTE m_HoleAttribute
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
virtual void SetParentGroup(EDA_GROUP *aGroup)
Definition: eda_item.h:115
Used for text file output.
Definition: richio.h:491
std::vector< DRILL_LAYER_PAIR > getUniqueLayerPairs() const
Get unique layer pairs by examining the micro and blind_buried vias.
virtual const wxString getDrillFileName(DRILL_LAYER_PAIR aPair, bool aNPTH, bool aMerge_PTH_NPTH) const
void buildHolesList(DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list)
Create the list of holes and tools for a given board.
unsigned printToolSummary(OUTPUTFORMATTER &aOut, bool aSummaryNPTH) const
Print m_toolListBuffer[] tools to aOut and returns total hole count.
std::vector< HOLE_INFO > m_holeListBuffer
bool genDrillMapFile(const wxString &aFullFileName, PLOT_FORMAT aFormat)
Plot a map of drill marks for holes.
VECTOR2I GetOffset()
Return the plot offset (usually the position of the drill/place origin).
std::vector< DRILL_TOOL > m_toolListBuffer
bool GenDrillReportFile(const wxString &aFullFileName)
Create a plain text report file giving a list of drill values and drill count for through holes,...
const std::string layerName(PCB_LAYER_ID aLayer) const
bool plotDrillMarks(PLOTTER *aPlotter)
Write the drill marks in PDF, POSTSCRIPT or other supported formats/.
void UseX2format(bool aEnable)
void UseX2NetAttributes(bool aEnable)
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers.
Handle hole which must be drilled (diameter, position and layers).
static const METRICS & Default()
Definition: font.cpp:52
PCB specific render settings.
Definition: pcb_painter.h:80
void SetDefaultPenWidth(int aWidth)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition: lset.cpp:733
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition: lset.cpp:591
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:322
int PRINTF_FUNC_N Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:463
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:59
static const wxChar A4[]
Definition: page_info.h:68
const VECTOR2D GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:171
Parameters and options when plotting/printing a board.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:176
Base plotter engine class.
Definition: plotter.h:121
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:75
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:154
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:151
static const int USE_DEFAULT_LINE_WIDTH
Definition: plotter.h:125
virtual bool EndPlot()=0
virtual void ThickOval(const VECTOR2I &aPos, const VECTOR2I &aSize, const EDA_ANGLE &aOrient, int aWidth, void *aData)
Definition: plotter.cpp:485
virtual bool StartPlot(const wxString &aPageNumber)=0
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
Definition: plotter.h:526
virtual PLOT_FORMAT GetPlotterType() const =0
Return the effective plot engine in use.
void Marker(const VECTOR2I &position, int diametre, unsigned aShapeId)
Draw a pattern shape number aShapeId, to coord position.
Definition: plotter.cpp:363
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:173
void ClearHeaderLinesList()
Remove all lines from the list of free lines to print at the beginning of the file.
Definition: plotter.h:191
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
Definition: plotter.h:183
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:148
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont=nullptr, const KIFONT::METRICS &aFontMetrics=KIFONT::METRICS::Default(), void *aData=nullptr)
Definition: plotter.cpp:687
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
This file is part of the common library.
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition: eda_angle.h:407
double diameter_in_mm(double ius)
double diameter_in_inches(double ius)
int getDefaultPenSize()
static int getMarkerBestPenSize(int aMarkerDiameter)
int getSketchOvalBestPenSize()
helper classes to handle hole info for drill files generators.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ Edge_Cuts
Definition: layer_ids.h:112
@ Dwgs_User
Definition: layer_ids.h:107
@ B_Cu
Definition: layer_ids.h:65
@ F_Cu
Definition: layer_ids.h:64
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:744
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
void AddGerberX2Header(PLOTTER *aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode)
Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and ad...
Definition: pcbplot.cpp:294
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:64
Plotting engines similar to ps (PostScript, Gerber, svg)
const int scale
std::vector< FAB_LAYER_COLOR > dummy
wxString From_UTF8(const char *cstring)
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:429
const double IU_PER_MM
Definition: base_units.h:76
const double IU_PER_MILS
Definition: base_units.h:77
constexpr int mmToIU(double mm) const
Definition: base_units.h:92
@ GR_TEXT_H_ALIGN_LEFT
@ GR_TEXT_V_ALIGN_CENTER
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695