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 (C) 1992-2023 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 {
99 case PLOT_FORMAT::GERBER:
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:
110 case PLOT_FORMAT::POST:
111 case PLOT_FORMAT::SVG:
112 {
113 PAGE_INFO pageA4( wxT( "A4" ) );
114 VECTOR2I 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
270 TEXT_ATTRIBUTES attrs;
271 attrs.m_StrokeWidth = TextWidth;
273 attrs.m_Size = VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) );
276 attrs.m_Multiline = false;
277
278 plotter->PlotText( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, attrs, nullptr /* stroke font */ );
279
280 // For some formats (PS, PDF SVG) we plot the drill size list on more than one column
281 // because the list must be contained inside the printed page
282 // (others formats do not have a defined page size)
283 int max_line_len = 0; // The max line len in iu of the currently plotted column
284
285 for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
286 {
287 DRILL_TOOL& tool = m_toolListBuffer[ii];
288
289 if( tool.m_TotalCount == 0 )
290 continue;
291
292 plotY += intervalle;
293
294 // Ensure there are room to plot the line
295 if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
296 {
297 plotY = bbbox.GetBottom() + intervalle;
298 plotX += max_line_len + pcbIUScale.mmToIU( 10 );//column_width;
299 max_line_len = 0;
300 }
301
302 int plot_diam = KiROUND( tool.m_Diameter );
303
304 // For markers plotted with the comment, keep marker size <= text height
305 plot_diam = std::min( plot_diam, KiROUND( charSize * charScale ) );
306 int x = KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
307 int y = KiROUND( plotY + charSize * charScale );
308
309 plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
310 plotter->Marker( VECTOR2I( x, y ), plot_diam, ii );
311 plotter->SetCurrentLineWidth( -1 );
312
313 // List the diameter of each drill in mm and inches.
314 snprintf( line, sizeof(line), "%3.3fmm / %2.4f\" ", diameter_in_mm( tool.m_Diameter ),
316
317 msg = FROM_UTF8( line );
318
319 // Now list how many holes and ovals are associated with each drill.
320 if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
321 snprintf( line, sizeof(line), "(1 hole)" );
322 else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
323 snprintf( line, sizeof(line), "(1 slot)" );
324 else if( tool.m_OvalCount == 0 )
325 snprintf( line, sizeof(line), "(%d holes)", tool.m_TotalCount );
326 else if( tool.m_OvalCount == 1 )
327 snprintf( line, sizeof(line), "(%d holes + 1 slot)", tool.m_TotalCount - 1 );
328 else // if ( toolm_OvalCount > 1 )
329 snprintf( line, sizeof(line), "(%d holes + %d slots)", tool.m_TotalCount - tool.m_OvalCount,
330 tool.m_OvalCount );
331
332 msg += FROM_UTF8( line );
333
334 if( tool.m_Hole_NotPlated )
335 msg += wxT( " (not plated)" );
336
337 plotter->PlotText( VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, attrs, nullptr /* stroke font */ );
338
339 intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
340
341 if( intervalle < ( plot_diam + ( 1 * pcbIUScale.IU_PER_MM / scale ) + TextWidth ) )
342 intervalle = plot_diam + ( 1 * pcbIUScale.IU_PER_MM / scale ) + TextWidth;
343
344 // Evaluate the text horizontal size, to know the maximal column size
345 // This is a rough value, but ok to create a new column to plot next texts
346 int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
347 max_line_len = std::max( max_line_len, text_len + plot_diam );
348 }
349
350 plotter->EndPlot();
351 delete plotter;
352
353 return true;
354}
355
356
357bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
358{
359 FILE_OUTPUTFORMATTER out( aFullFileName );
360
361 static const char separator[] =
362 " =============================================================\n";
363
364 wxASSERT( m_pcb );
365
366 unsigned totalHoleCount;
367 wxFileName brdFilename( m_pcb->GetFileName() );
368
369 std::vector<DRILL_LAYER_PAIR> hole_sets = getUniqueLayerPairs();
370
371 out.Print( 0, "Drill report for %s\n", TO_UTF8( brdFilename.GetFullName() ) );
372 out.Print( 0, "Created on %s\n\n", TO_UTF8( DateAndTime() ) );
373
374 // Output the cu layer stackup, so layer name references make sense.
375 out.Print( 0, "Copper Layer Stackup:\n" );
376 out.Print( 0, separator );
377
379
380 int conventional_layer_num = 1;
381
382 for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num )
383 {
384 out.Print( 0, " L%-2d: %-25s %s\n",
385 conventional_layer_num,
386 TO_UTF8( m_pcb->GetLayerName( *seq ) ),
387 layerName( *seq ).c_str() ); // generic layer name
388 }
389
390 out.Print( 0, "\n\n" );
391
392 /* output hole lists:
393 * 1 - through holes
394 * 2 - for partial holes only: by layer starting and ending pair
395 * 3 - Non Plated through holes
396 */
397
398 bool buildNPTHlist = false; // First pass: build PTH list only
399
400 // in this loop are plated only:
401 for( unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
402 {
403 DRILL_LAYER_PAIR pair = hole_sets[pair_ndx];
404
405 buildHolesList( pair, buildNPTHlist );
406
407 if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
408 {
409 out.Print( 0, "Drill file '%s' contains\n",
410 TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
411
412 out.Print( 0, " plated through holes:\n" );
413 out.Print( 0, separator );
414 totalHoleCount = printToolSummary( out, false );
415 out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
416 }
417 else // blind/buried
418 {
419 out.Print( 0, "Drill file '%s' contains\n",
420 TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
421
422 out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n",
423 TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ),
424 TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ),
425 pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" );
426
427 out.Print( 0, separator );
428 totalHoleCount = printToolSummary( out, false );
429 out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
430 }
431
432 out.Print( 0, "\n\n" );
433 }
434
435 // NPTHoles. Generate the full list (pads+vias) if PTH and NPTH are merged,
436 // or only the NPTH list (which never has vias)
437 if( !m_merge_PTH_NPTH )
438 buildNPTHlist = true;
439
440 buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
441
442 // nothing wrong with an empty NPTH file in report.
443 if( m_merge_PTH_NPTH )
444 out.Print( 0, "Not plated through holes are merged with plated holes\n" );
445 else
446 out.Print( 0, "Drill file '%s' contains\n",
448 true, m_merge_PTH_NPTH ) ) );
449
450 out.Print( 0, " unplated through holes:\n" );
451 out.Print( 0, separator );
452 totalHoleCount = printToolSummary( out, true );
453 out.Print( 0, " Total unplated holes count %u\n", totalHoleCount );
454
455 return true;
456}
457
458
460{
461 // Plot the drill map:
462 VECTOR2I pos;
463
464 for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
465 {
466 const HOLE_INFO& hole = m_holeListBuffer[ii];
467 pos = hole.m_Hole_Pos;
468
469 // Gives a good line thickness to have a good marker shape:
471
472 // Always plot the drill symbol (for slots identifies the needed cutter!
473 aPlotter->Marker( pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
474
475 if( hole.m_Hole_Shape != 0 )
476 aPlotter->FlashPadOval( pos, hole.m_Hole_Size, hole.m_Hole_Orient, SKETCH, nullptr );
477 }
478
479 aPlotter->SetCurrentLineWidth( -1 );
480
481 return true;
482}
483
484
485unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSummaryNPTH ) const
486{
487 unsigned totalHoleCount = 0;
488
489 for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
490 {
491 const DRILL_TOOL& tool = m_toolListBuffer[ii];
492
493 if( aSummaryNPTH && !tool.m_Hole_NotPlated )
494 continue;
495
496 if( !aSummaryNPTH && tool.m_Hole_NotPlated )
497 continue;
498
499 // List the tool number assigned to each drill in mm then in inches.
500 int tool_number = ii+1;
501 out.Print( 0, " T%d %2.3fmm %2.4f\" ", tool_number,
504
505 // Now list how many holes and ovals are associated with each drill.
506 if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
507 out.Print( 0, "(1 hole)\n" );
508 else if( tool.m_TotalCount == 1 )
509 out.Print( 0, "(1 hole) (with 1 slot)\n" );
510 else if( tool.m_OvalCount == 0 )
511 out.Print( 0, "(%d holes)\n", tool.m_TotalCount );
512 else if( tool.m_OvalCount == 1 )
513 out.Print( 0, "(%d holes) (with 1 slot)\n", tool.m_TotalCount );
514 else // tool.m_OvalCount > 1
515 out.Print( 0, "(%d holes) (with %d slots)\n", tool.m_TotalCount, tool.m_OvalCount );
516
517 totalHoleCount += tool.m_TotalCount;
518 }
519
520 out.Print( 0, "\n" );
521
522 return totalHoleCount;
523}
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:71
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:230
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:611
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:625
const BOX2I GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:858
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:643
const wxString & GetFileName() const
Definition: board.h:307
DRAWINGS & Drawings()
Definition: board.h:315
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:498
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:469
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:70
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:497
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:536
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:322
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:475
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 VECTOR2I 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:520
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 PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, void *aData=nullptr)
Definition: plotter.cpp:758
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
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:425
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:588