KiCad PCB EDA Suite
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 (C) 1992-2022 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 <confirm.h>
30#include <string_utils.h>
31#include <locale_io.h>
32#include <macros.h>
33#include <math/util.h> // for KiROUND
34
35#include <board.h>
36
37#include <pcbnew.h>
38#include <pcbplot.h>
40#include <pcb_painter.h>
41#include <pcb_shape.h>
42
43
44/* Conversion utilities - these will be used often in there... */
45inline double diameter_in_inches( double ius )
46{
47 return ius * 0.001 / pcbIUScale.IU_PER_MILS;
48}
49
50
51inline double diameter_in_mm( double ius )
52{
53 return ius / pcbIUScale.IU_PER_MM;
54}
55
56
57// return a pen size to plot markers and having a readable shape
58inline int getMarkerBestPenSize( int aMarkerDiameter )
59{
60 return aMarkerDiameter / 10;
61}
62
63
64bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat )
65{
66 // Remark:
67 // Hole list must be created before calling this function, by buildHolesList(),
68 // for the right holes set (PTH, NPTH, buried/blind vias ...)
69
70 double scale = 1.0;
71 VECTOR2I offset = GetOffset();
72 PLOTTER* plotter = nullptr;
74 int bottom_limit = 0; // Y coord limit of page. 0 mean do not use
75
76 PCB_PLOT_PARAMS plot_opts; // starts plotting with default options
77
78 LOCALE_IO toggle; // use standard C notation for float numbers
79
80 const PAGE_INFO& page_info = m_pageInfo ? *m_pageInfo : dummy;
81
82 // Calculate dimensions and center of PCB. The Edge_Cuts layer must be visible
83 // to calculate the board edges bounding box
84 LSET visibleLayers = m_pcb->GetVisibleLayers();
85 m_pcb->SetVisibleLayers( visibleLayers | LSET( Edge_Cuts ) );
87 m_pcb->SetVisibleLayers( visibleLayers );
88
89 // Some formats cannot be used to generate a document like the map files
90 // Currently HPGL (old format not very used)
91
92 if( aFormat == PLOT_FORMAT::HPGL )
93 aFormat = PLOT_FORMAT::PDF;
94
95 // Calculate the scale for the format type, scale 1 in HPGL, drawing on
96 // an A4 sheet in PS, + text description of symbols
97 switch( aFormat )
98 {
100 plotter = new GERBER_PLOTTER();
101 plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
102 plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
103 break;
104
105 default:
106 wxASSERT( false );
108
109 case PLOT_FORMAT::PDF:
111 case PLOT_FORMAT::SVG:
112 {
113 PAGE_INFO pageA4( wxT( "A4" ) );
114 wxSize pageSizeIU = pageA4.GetSizeIU( pcbIUScale.IU_PER_MILS );
115
116 // Reserve a 10 mm margin around the page.
117 int margin = pcbIUScale.mmToIU( 10 );
118
119 // Calculate a scaling factor to print the board on the sheet
120 double Xscale = double( pageSizeIU.x - ( 2 * margin ) ) / bbbox.GetWidth();
121
122 // We should print the list of drill sizes, so reserve room for it
123 // 60% height for board 40% height for list
124 int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
125 double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
126
127 scale = std::min( Xscale, Yscale );
128
129 // Experience shows the scale should not to large, because texts
130 // create problem (can be to big or too small).
131 // So the scale is clipped at 3.0;
132 scale = std::min( scale, 3.0 );
133
134 offset.x = KiROUND( double( bbbox.Centre().x ) - ( pageSizeIU.x / 2.0 ) / scale );
135 offset.y = KiROUND( double( bbbox.Centre().y ) - ( ypagesize_for_board / 2.0 ) / scale );
136
137 // bottom_limit is used to plot the legend (drill diameters)
138 // texts are scaled differently for scale > 1.0 and <= 1.0
139 // so the limit is scaled differently.
140 bottom_limit = ( pageSizeIU.y - margin ) / std::min( scale, 1.0 );
141
142 if( aFormat == PLOT_FORMAT::SVG )
143 plotter = new SVG_PLOTTER;
144 else if( aFormat == PLOT_FORMAT::PDF )
145 plotter = new PDF_PLOTTER;
146 else
147 plotter = new PS_PLOTTER;
148
149 plotter->SetPageSettings( pageA4 );
150 plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
151 break;
152 }
153
154 case PLOT_FORMAT::DXF:
155 {
156 DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
157
158 if( m_unitsMetric )
159 dxf_plotter->SetUnits( DXF_UNITS::MILLIMETERS );
160 else
161 dxf_plotter->SetUnits( DXF_UNITS::INCHES );
162
163 plotter = dxf_plotter;
164 plotter->SetPageSettings( page_info );
165 plotter->SetViewport( offset, pcbIUScale.IU_PER_MILS / 10, scale, false );
166 break;
167 }
168 }
169
170 plotter->SetCreator( wxT( "PCBNEW" ) );
171 plotter->SetColorMode( false );
172
173 KIGFX::PCB_RENDER_SETTINGS renderSettings;
174 renderSettings.SetDefaultPenWidth( pcbIUScale.mmToIU( 0.2 ) );
175
176 plotter->SetRenderSettings( &renderSettings );
177
178 if( !plotter->OpenFile( aFullFileName ) )
179 {
180 delete plotter;
181 return false;
182 }
183
184 plotter->ClearHeaderLinesList();
185
186 // For the Gerber X2 format we need to set the "FileFunction" to Drillmap
187 // and set a few other options.
188 if( plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
189 {
190 GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
191 gbrplotter->DisableApertMacros( false );
192 gbrplotter->UseX2format( true ); // Mandatory
193 gbrplotter->UseX2NetAttributes( false ); // net attributes have no meaning here
194
195 // Attributes are added using X2 format
196 AddGerberX2Header( gbrplotter, m_pcb, false );
197
198 wxString text;
199
200 // Add the TF.FileFunction
201 text = "%TF.FileFunction,Drillmap*%";
202 gbrplotter->AddLineToHeader( text );
203
204 // Add the TF.FilePolarity
205 text = wxT( "%TF.FilePolarity,Positive*%" );
206 gbrplotter->AddLineToHeader( text );
207 }
208
209 plotter->StartPlot( wxT( "1" ) );
210
211 // Draw items on edge layer.
212 // Not all, only items useful for drill map, i.e. board outlines.
213 BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
214
215 // Use attributes of a drawing layer (we are not really draw the Edge.Cuts layer)
216 itemplotter.SetLayerSet( Dwgs_User );
217
218 for( BOARD_ITEM* item : m_pcb->Drawings() )
219 {
220 if( item->GetLayer() != Edge_Cuts )
221 continue;
222
223 switch( item->Type() )
224 {
225 case PCB_SHAPE_T:
226 {
227 PCB_SHAPE dummy_shape( *static_cast<PCB_SHAPE*>( item ) );
228 dummy_shape.SetLayer( Dwgs_User );
229 itemplotter.PlotPcbShape( &dummy_shape );
230 }
231 break;
232
233 default:
234 break;
235 }
236 }
237
238 int plotX, plotY, TextWidth;
239 int intervalle = 0;
240 char line[1024];
241 wxString msg;
242 int textmarginaftersymbol = pcbIUScale.mmToIU( 2 );
243
244 // Set Drill Symbols width
245 plotter->SetCurrentLineWidth( -1 );
246
247 // Plot board outlines and drill map
248 plotDrillMarks( plotter );
249
250 // Print a list of symbols used.
251 int charSize = pcbIUScale.mmToIU( 2 ); // text size in IUs
252
253 // real char scale will be 1/scale, because the global plot scale is scale
254 // for scale < 1.0 ( plot bigger actual size)
255 // Therefore charScale = 1.0 / scale keep the initial charSize
256 // (for scale < 1 we use the global scaling factor: the board must be plotted
257 // smaller than the actual size)
258 double charScale = std::min( 1.0, 1.0 / scale );
259
260 TextWidth = KiROUND( ( charSize * charScale ) / 10.0 ); // Set text width (thickness)
261 intervalle = KiROUND( charSize * charScale ) + TextWidth;
262
263 // Trace information.
264 plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
265 plotY = bbbox.GetBottom() + intervalle;
266
267 // Plot title "Info"
268 wxString Text = wxT( "Drill Map:" );
269 plotter->Text( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, ANGLE_HORIZONTAL,
270 wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
271 GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false,
272 false, nullptr /* stroke font */ );
273
274 // For some formats (PS, PDF SVG) we plot the drill size list on more than one column
275 // because the list must be contained inside the printed page
276 // (others formats do not have a defined page size)
277 int max_line_len = 0; // The max line len in iu of the currently plotted column
278
279 for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
280 {
281 DRILL_TOOL& tool = m_toolListBuffer[ii];
282
283 if( tool.m_TotalCount == 0 )
284 continue;
285
286 plotY += intervalle;
287
288 // Ensure there are room to plot the line
289 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
290 {
291 plotY = bbbox.GetBottom() + intervalle;
292 plotX += max_line_len + pcbIUScale.mmToIU( 10 );//column_width;
293 max_line_len = 0;
294 }
295
296 int plot_diam = KiROUND( tool.m_Diameter );
297
298 // For markers plotted with the comment, keep marker size <= text height
299 plot_diam = std::min( plot_diam, KiROUND( charSize * charScale ) );
300 int x = KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
301 int y = KiROUND( plotY + charSize * charScale );
302
303 plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
304 plotter->Marker( VECTOR2I( x, y ), plot_diam, ii );
305 plotter->SetCurrentLineWidth( -1 );
306
307 // List the diameter of each drill in mm and inches.
308 sprintf( line, "%3.3fmm / %2.4f\" ", diameter_in_mm( tool.m_Diameter ),
310
311 msg = FROM_UTF8( line );
312
313 // Now list how many holes and ovals are associated with each drill.
314 if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
315 sprintf( line, "(1 hole)" );
316 else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
317 sprintf( line, "(1 slot)" );
318 else if( tool.m_OvalCount == 0 )
319 sprintf( line, "(%d holes)", tool.m_TotalCount );
320 else if( tool.m_OvalCount == 1 )
321 sprintf( line, "(%d holes + 1 slot)", tool.m_TotalCount - 1 );
322 else // if ( toolm_OvalCount > 1 )
323 sprintf( line, "(%d holes + %d slots)", tool.m_TotalCount - tool.m_OvalCount,
324 tool.m_OvalCount );
325
326 msg += FROM_UTF8( line );
327
328 if( tool.m_Hole_NotPlated )
329 msg += wxT( " (not plated)" );
330
331 plotter->Text( VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, ANGLE_HORIZONTAL,
332 VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
333 GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false,
334 false, nullptr /* stroke font */ );
335
336 intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
337
338 if( intervalle < ( plot_diam + ( 1 * pcbIUScale.IU_PER_MM / scale ) + TextWidth ) )
339 intervalle = plot_diam + ( 1 * pcbIUScale.IU_PER_MM / scale ) + TextWidth;
340
341 // Evaluate the text horizontal size, to know the maximal column size
342 // This is a rough value, but ok to create a new column to plot next texts
343 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
344 max_line_len = std::max( max_line_len, text_len + plot_diam );
345 }
346
347 plotter->EndPlot();
348 delete plotter;
349
350 return true;
351}
352
353
354bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
355{
356 FILE_OUTPUTFORMATTER out( aFullFileName );
357
358 static const char separator[] =
359 " =============================================================\n";
360
361 wxASSERT( m_pcb );
362
363 unsigned totalHoleCount;
364 wxFileName brdFilename( m_pcb->GetFileName() );
365
366 std::vector<DRILL_LAYER_PAIR> hole_sets = getUniqueLayerPairs();
367
368 out.Print( 0, "Drill report for %s\n", TO_UTF8( brdFilename.GetFullName() ) );
369 out.Print( 0, "Created on %s\n\n", TO_UTF8( DateAndTime() ) );
370
371 // Output the cu layer stackup, so layer name references make sense.
372 out.Print( 0, "Copper Layer Stackup:\n" );
373 out.Print( 0, separator );
374
376
377 int conventional_layer_num = 1;
378
379 for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num )
380 {
381 out.Print( 0, " L%-2d: %-25s %s\n",
382 conventional_layer_num,
383 TO_UTF8( m_pcb->GetLayerName( *seq ) ),
384 layerName( *seq ).c_str() ); // generic layer name
385 }
386
387 out.Print( 0, "\n\n" );
388
389 /* output hole lists:
390 * 1 - through holes
391 * 2 - for partial holes only: by layer starting and ending pair
392 * 3 - Non Plated through holes
393 */
394
395 bool buildNPTHlist = false; // First pass: build PTH list only
396
397 // in this loop are plated only:
398 for( unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
399 {
400 DRILL_LAYER_PAIR pair = hole_sets[pair_ndx];
401
402 buildHolesList( pair, buildNPTHlist );
403
404 if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
405 {
406 out.Print( 0, "Drill file '%s' contains\n",
407 TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
408
409 out.Print( 0, " plated through holes:\n" );
410 out.Print( 0, separator );
411 totalHoleCount = printToolSummary( out, false );
412 out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
413 }
414 else // blind/buried
415 {
416 out.Print( 0, "Drill file '%s' contains\n",
417 TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
418
419 out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n",
420 TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ),
421 TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ),
422 pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" );
423
424 out.Print( 0, separator );
425 totalHoleCount = printToolSummary( out, false );
426 out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
427 }
428
429 out.Print( 0, "\n\n" );
430 }
431
432 // NPTHoles. Generate the full list (pads+vias) if PTH and NPTH are merged,
433 // or only the NPTH list (which never has vias)
434 if( !m_merge_PTH_NPTH )
435 buildNPTHlist = true;
436
437 buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
438
439 // nothing wrong with an empty NPTH file in report.
440 if( m_merge_PTH_NPTH )
441 out.Print( 0, "Not plated through holes are merged with plated holes\n" );
442 else
443 out.Print( 0, "Drill file '%s' contains\n",
445 true, m_merge_PTH_NPTH ) ) );
446
447 out.Print( 0, " unplated through holes:\n" );
448 out.Print( 0, separator );
449 totalHoleCount = printToolSummary( out, true );
450 out.Print( 0, " Total unplated holes count %u\n", totalHoleCount );
451
452 return true;
453}
454
455
457{
458 // Plot the drill map:
459 VECTOR2I pos;
460
461 for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
462 {
463 const HOLE_INFO& hole = m_holeListBuffer[ii];
464 pos = hole.m_Hole_Pos;
465
466 // Gives a good line thickness to have a good marker shape:
468
469 // Always plot the drill symbol (for slots identifies the needed cutter!
470 aPlotter->Marker( pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
471
472 if( hole.m_Hole_Shape != 0 )
473 aPlotter->FlashPadOval( pos, hole.m_Hole_Size, hole.m_Hole_Orient, SKETCH, nullptr );
474 }
475
476 aPlotter->SetCurrentLineWidth( -1 );
477
478 return true;
479}
480
481
482unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSummaryNPTH ) const
483{
484 unsigned totalHoleCount = 0;
485
486 for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
487 {
488 const DRILL_TOOL& tool = m_toolListBuffer[ii];
489
490 if( aSummaryNPTH && !tool.m_Hole_NotPlated )
491 continue;
492
493 if( !aSummaryNPTH && tool.m_Hole_NotPlated )
494 continue;
495
496 // List the tool number assigned to each drill in mm then in inches.
497 int tool_number = ii+1;
498 out.Print( 0, " T%d %2.3fmm %2.4f\" ", tool_number,
501
502 // Now list how many holes and ovals are associated with each drill.
503 if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
504 out.Print( 0, "(1 hole)\n" );
505 else if( tool.m_TotalCount == 1 )
506 out.Print( 0, "(1 hole) (with 1 slot)\n" );
507 else if( tool.m_OvalCount == 0 )
508 out.Print( 0, "(%d holes)\n", tool.m_TotalCount );
509 else if( tool.m_OvalCount == 1 )
510 out.Print( 0, "(%d holes) (with 1 slot)\n", tool.m_TotalCount );
511 else // tool.m_OvalCount > 1
512 out.Print( 0, "(%d holes) (with %d slots)\n", tool.m_TotalCount, tool.m_OvalCount );
513
514 totalHoleCount += tool.m_TotalCount;
515 }
516
517 out.Print( 0, "\n" );
518
519 return totalHoleCount;
520}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:214
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:526
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:540
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:823
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:558
const wxString & GetFileName() const
Definition: board.h:302
DRAWINGS & Drawings()
Definition: board.h:310
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:413
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
coord_type GetX() const
Definition: box2.h:180
Vec Centre() const
Definition: box2.h:70
coord_type GetBottom() const
Definition: box2.h:190
void PlotPcbShape(const PCB_SHAPE *aShape)
void SetLayerSet(LSET aLayerMask)
Definition: pcbplot.h:80
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
Used for text file output.
Definition: richio.h:457
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 HPGL, 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).
PCB specific render settings.
Definition: pcb_painter.h:72
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
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:491
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:310
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:431
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
static const wxChar A4[]
Definition: page_info.h:63
const wxSize GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:162
Parameters and options when plotting/printing a board.
Base plotter engine class.
Definition: plotter.h:110
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:74
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:143
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:140
virtual bool EndPlot()=0
virtual bool StartPlot(const wxString &aPageNumber)=0
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
Definition: plotter.h:500
virtual void Text(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const EDA_ANGLE &aOrient, const VECTOR2I &aSize, enum GR_TEXT_H_ALIGN_T aH_justify, enum GR_TEXT_V_ALIGN_T aV_justify, int aPenWidth, bool aItalic, bool aBold, bool aMultilineAllowed, KIFONT::FONT *aFont, void *aData=nullptr)
Draw text with the plotter.
Definition: plotter.cpp:714
virtual PLOT_FORMAT GetPlotterType() const =0
Returns 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:359
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:159
void ClearHeaderLinesList()
Remove all lines from the list of free lines to print at the beginning of the file.
Definition: plotter.h:176
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:168
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:137
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
This file is part of the common library.
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
Definition: eda_angle.h:408
double diameter_in_mm(double ius)
double diameter_in_inches(double ius)
int getMarkerBestPenSize(int aMarkerDiameter)
helper classes to handle hole info for drill files generators.
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
@ Edge_Cuts
Definition: layer_ids.h:113
@ Dwgs_User
Definition: layer_ids.h:109
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:932
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
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
@ SKETCH
Definition: outline_mode.h:26
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:276
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:70
Plotting engine (DXF)
Plotting engine (Gerber)
Plotting engines similar to ps (PostScript, Gerber, svg)
const int scale
std::vector< FAB_LAYER_COLOR > dummy
wxString DateAndTime()
const double IU_PER_MM
Definition: base_units.h:77
const double IU_PER_MILS
Definition: base_units.h:78
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
@ 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
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618