KiCad PCB EDA Suite
gen_drill_report_files.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 1992-2017 Jean_Pierre Charras <jp.charras at wanadoo.fr>
10  * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 #include <plotter.h>
31 #include <plotters_specific.h>
32 #include <eda_item.h>
33 #include <gr_text.h>
34 #include <confirm.h>
35 #include <kicad_string.h>
36 #include <locale_io.h>
37 #include <macros.h>
38 #include <math/util.h> // for KiROUND
39 
40 #include <board.h>
41 
42 #include <pcbnew.h>
43 #include <pcbplot.h>
45 #include <pcb_painter.h>
46 
47 
48 /* Conversion utilities - these will be used often in there... */
49 inline double diameter_in_inches( double ius )
50 {
51  return ius * 0.001 / IU_PER_MILS;
52 }
53 
54 
55 inline double diameter_in_mm( double ius )
56 {
57  return ius / IU_PER_MM;
58 }
59 
60 
61 // return a pen size to plot markers and having a readable shape
62 inline int getMarkerBestPenSize( int aMarkerDiameter )
63 {
64  return aMarkerDiameter / 10;
65 }
66 
67 
68 bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_FORMAT aFormat )
69 {
70  // Remark:
71  // Hole list must be created before calling this function, by buildHolesList(),
72  // for the right holes set (PTH, NPTH, buried/blind vias ...)
73 
74  double scale = 1.0;
75  wxPoint offset = GetOffset();
76  PLOTTER* plotter = nullptr;
77  PAGE_INFO dummy( PAGE_INFO::A4, false );
78  int bottom_limit = 0; // Y coord limit of page. 0 mean do not use
79 
80  PCB_PLOT_PARAMS plot_opts; // starts plotting with default options
81 
82  LOCALE_IO toggle; // use standard C notation for float numbers
83 
84  const PAGE_INFO& page_info = m_pageInfo ? *m_pageInfo : dummy;
85 
86  // Calculate dimensions and center of PCB. The Edge_Cuts layer must be visible
87  // to calculate the board edges bounding box
88  LSET visibleLayers = m_pcb->GetVisibleLayers();
89  m_pcb->SetVisibleLayers( visibleLayers | LSET( Edge_Cuts ) );
91  m_pcb->SetVisibleLayers( visibleLayers );
92 
93  // Calculate the scale for the format type, scale 1 in HPGL, drawing on
94  // an A4 sheet in PS, + text description of symbols
95  switch( aFormat )
96  {
98  plotter = new GERBER_PLOTTER();
99  plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
100  plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
101  break;
102 
103  case PLOT_FORMAT::HPGL: // Scale for HPGL format.
104  {
105  HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
106  plotter = hpgl_plotter;
107  hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
108  hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
109  plotter->SetPageSettings( page_info );
110  plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
111  }
112  break;
113 
114 
115  default:
116  wxASSERT( false );
118 
119  case PLOT_FORMAT::PDF:
120  case PLOT_FORMAT::POST:
121  case PLOT_FORMAT::SVG:
122  {
123  PAGE_INFO pageA4( wxT( "A4" ) );
124  wxSize pageSizeIU = pageA4.GetSizeIU();
125 
126  // Reserve a 10 mm margin around the page.
127  int margin = Millimeter2iu( 10 );
128 
129  // Calculate a scaling factor to print the board on the sheet
130  double Xscale = double( pageSizeIU.x - ( 2 * margin ) ) / bbbox.GetWidth();
131 
132  // We should print the list of drill sizes, so reserve room for it
133  // 60% height for board 40% height for list
134  int ypagesize_for_board = KiROUND( pageSizeIU.y * 0.6 );
135  double Yscale = double( ypagesize_for_board - margin ) / bbbox.GetHeight();
136 
137  scale = std::min( Xscale, Yscale );
138 
139  // Experience shows the scale should not to large, because texts
140  // create problem (can be to big or too small).
141  // So the scale is clipped at 3.0;
142  scale = std::min( scale, 3.0 );
143 
144  offset.x = KiROUND( double( bbbox.Centre().x ) - ( pageSizeIU.x / 2.0 ) / scale );
145  offset.y = KiROUND( double( bbbox.Centre().y ) - ( ypagesize_for_board / 2.0 ) / scale );
146 
147  // bottom_limit is used to plot the legend (drill diameters)
148  // texts are scaled differently for scale > 1.0 and <= 1.0
149  // so the limit is scaled differently.
150  bottom_limit = ( pageSizeIU.y - margin ) / std::min( scale, 1.0 );
151 
152  if( aFormat == PLOT_FORMAT::SVG )
153  plotter = new SVG_PLOTTER;
154  else if( aFormat == PLOT_FORMAT::PDF )
155  plotter = new PDF_PLOTTER;
156  else
157  plotter = new PS_PLOTTER;
158 
159  plotter->SetPageSettings( pageA4 );
160  plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
161  break;
162  }
163 
164  case PLOT_FORMAT::DXF:
165  {
166  DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
167 
168  if( m_unitsMetric )
169  dxf_plotter->SetUnits( DXF_UNITS::MILLIMETERS );
170  else
171  dxf_plotter->SetUnits( DXF_UNITS::INCHES );
172 
173  plotter = dxf_plotter;
174  plotter->SetPageSettings( page_info );
175  plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
176  break;
177  }
178  }
179 
180  plotter->SetCreator( wxT( "PCBNEW" ) );
181  plotter->SetColorMode( false );
182 
183  KIGFX::PCB_RENDER_SETTINGS renderSettings;
184  renderSettings.SetDefaultPenWidth( Millimeter2iu( 0.2 ) );
185 
186  plotter->SetRenderSettings( &renderSettings );
187 
188  if( !plotter->OpenFile( aFullFileName ) )
189  {
190  delete plotter;
191  return false;
192  }
193 
194  plotter->StartPlot();
195 
196  // Draw items on edge layer (not all, only items useful for drill map
197  BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
198  itemplotter.SetLayerSet( Edge_Cuts );
199 
200  for( auto PtStruct : m_pcb->Drawings() )
201  {
202  switch( PtStruct->Type() )
203  {
204  case PCB_SHAPE_T:
205  itemplotter.PlotPcbShape( (PCB_SHAPE*) PtStruct );
206  break;
207 
208  case PCB_TEXT_T:
209  itemplotter.PlotPcbText( (PCB_TEXT*) PtStruct );
210  break;
211 
212  case PCB_DIM_ALIGNED_T:
213  case PCB_DIM_CENTER_T:
215  case PCB_DIM_LEADER_T:
216  case PCB_TARGET_T:
217  case PCB_MARKER_T: // do not draw
218  default:
219  break;
220  }
221  }
222 
223  int plotX, plotY, TextWidth;
224  int intervalle = 0;
225  char line[1024];
226  wxString msg;
227  int textmarginaftersymbol = Millimeter2iu( 2 );
228 
229  // Set Drill Symbols width
230  plotter->SetCurrentLineWidth( -1 );
231 
232  // Plot board outlines and drill map
233  plotDrillMarks( plotter );
234 
235  // Print a list of symbols used.
236  int charSize = Millimeter2iu( 2 ); // text size in IUs
237 
238  // real char scale will be 1/scale, because the global plot scale is scale
239  // for scale < 1.0 ( plot bigger actual size)
240  // Therefore charScale = 1.0 / scale keep the initial charSize
241  // (for scale < 1 we use the global scaling factor: the board must be plotted
242  // smaller than the actual size)
243  double charScale = std::min( 1.0, 1.0 / scale );
244 
245  TextWidth = KiROUND( ( charSize * charScale ) / 10.0 ); // Set text width (thickness)
246  intervalle = KiROUND( charSize * charScale ) + TextWidth;
247 
248  // Trace information.
249  plotX = KiROUND( bbbox.GetX() + textmarginaftersymbol * charScale );
250  plotY = bbbox.GetBottom() + intervalle;
251 
252  // Plot title "Info"
253  wxString Text = wxT( "Drill Map:" );
254  plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0,
255  wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
256  GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
257 
258  // For some formats (PS, PDF SVG) we plot the drill size list on more than one column
259  // because the list must be contained inside the printed page
260  // (others formats do not have a defined page size)
261  int max_line_len = 0; // The max line len in iu of the currently plotted column
262 
263  for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
264  {
265  DRILL_TOOL& tool = m_toolListBuffer[ii];
266 
267  if( tool.m_TotalCount == 0 )
268  continue;
269 
270  plotY += intervalle;
271 
272  // Ensure there are room to plot the line
273  if( bottom_limit && ( plotY+intervalle > bottom_limit ) )
274  {
275  plotY = bbbox.GetBottom() + intervalle;
276  plotX += max_line_len + Millimeter2iu( 10 );//column_width;
277  max_line_len = 0;
278  }
279 
280  int plot_diam = KiROUND( tool.m_Diameter );
281 
282  // For markers plotted with the comment, keep marker size <= text height
283  plot_diam = std::min( plot_diam, KiROUND( charSize * charScale ) );
284  int x = KiROUND( plotX - textmarginaftersymbol * charScale - plot_diam / 2.0 );
285  int y = KiROUND( plotY + charSize * charScale );
286 
287  plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
288  plotter->Marker( wxPoint( x, y ), plot_diam, ii );
289  plotter->SetCurrentLineWidth( -1 );
290 
291  // List the diameter of each drill in mm and inches.
292  sprintf( line, "%3.3fmm / %2.4f\" ", diameter_in_mm( tool.m_Diameter ),
293  diameter_in_inches( tool.m_Diameter ) );
294 
295  msg = FROM_UTF8( line );
296 
297  // Now list how many holes and ovals are associated with each drill.
298  if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
299  sprintf( line, "(1 hole)" );
300  else if( tool.m_TotalCount == 1 ) // && ( toolm_OvalCount == 1 )
301  sprintf( line, "(1 slot)" );
302  else if( tool.m_OvalCount == 0 )
303  sprintf( line, "(%d holes)", tool.m_TotalCount );
304  else if( tool.m_OvalCount == 1 )
305  sprintf( line, "(%d holes + 1 slot)", tool.m_TotalCount - 1 );
306  else // if ( toolm_OvalCount > 1 )
307  sprintf( line, "(%d holes + %d slots)", tool.m_TotalCount - tool.m_OvalCount,
308  tool.m_OvalCount );
309 
310  msg += FROM_UTF8( line );
311 
312  if( tool.m_Hole_NotPlated )
313  msg += wxT( " (not plated)" );
314 
315  plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0,
316  wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
317  GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, TextWidth, false, false );
318 
319  intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );
320 
321  if( intervalle < ( plot_diam + ( 1 * IU_PER_MM / scale ) + TextWidth ) )
322  intervalle = plot_diam + ( 1 * IU_PER_MM / scale ) + TextWidth;
323 
324  // Evaluate the text horizontal size, to know the maximal column size
325  // This is a rough value, but ok to create a new column to plot next texts
326  int text_len = msg.Len() * ( ( charSize * charScale ) + TextWidth );
327  max_line_len = std::max( max_line_len, text_len + plot_diam );
328  }
329 
330  plotter->EndPlot();
331  delete plotter;
332 
333  return true;
334 }
335 
336 
337 bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
338 {
339  FILE_OUTPUTFORMATTER out( aFullFileName );
340 
341  static const char separator[] =
342  " =============================================================\n";
343 
344  wxASSERT( m_pcb );
345 
346  unsigned totalHoleCount;
347  wxFileName brdFilename( m_pcb->GetFileName() );
348 
349  std::vector<DRILL_LAYER_PAIR> hole_sets = getUniqueLayerPairs();
350 
351  out.Print( 0, "Drill report for %s\n", TO_UTF8( brdFilename.GetFullName() ) );
352  out.Print( 0, "Created on %s\n\n", TO_UTF8( DateAndTime() ) );
353 
354  // Output the cu layer stackup, so layer name references make sense.
355  out.Print( 0, "Copper Layer Stackup:\n" );
356  out.Print( 0, separator );
357 
359 
360  int conventional_layer_num = 1;
361 
362  for( LSEQ seq = cu.Seq(); seq; ++seq, ++conventional_layer_num )
363  {
364  out.Print( 0, " L%-2d: %-25s %s\n",
365  conventional_layer_num,
366  TO_UTF8( m_pcb->GetLayerName( *seq ) ),
367  layerName( *seq ).c_str() ); // generic layer name
368  }
369 
370  out.Print( 0, "\n\n" );
371 
372  /* output hole lists:
373  * 1 - through holes
374  * 2 - for partial holes only: by layer starting and ending pair
375  * 3 - Non Plated through holes
376  */
377 
378  bool buildNPTHlist = false; // First pass: build PTH list only
379 
380  // in this loop are plated only:
381  for( unsigned pair_ndx = 0; pair_ndx < hole_sets.size(); ++pair_ndx )
382  {
383  DRILL_LAYER_PAIR pair = hole_sets[pair_ndx];
384 
385  buildHolesList( pair, buildNPTHlist );
386 
387  if( pair == DRILL_LAYER_PAIR( F_Cu, B_Cu ) )
388  {
389  out.Print( 0, "Drill file '%s' contains\n",
390  TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
391 
392  out.Print( 0, " plated through holes:\n" );
393  out.Print( 0, separator );
394  totalHoleCount = printToolSummary( out, false );
395  out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
396  }
397  else // blind/buried
398  {
399  out.Print( 0, "Drill file '%s' contains\n",
400  TO_UTF8( getDrillFileName( pair, false, m_merge_PTH_NPTH ) ) );
401 
402  out.Print( 0, " holes connecting layer pair: '%s and %s' (%s vias):\n",
403  TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.first ) ) ),
404  TO_UTF8( m_pcb->GetLayerName( ToLAYER_ID( pair.second ) ) ),
405  pair.first == F_Cu || pair.second == B_Cu ? "blind" : "buried" );
406 
407  out.Print( 0, separator );
408  totalHoleCount = printToolSummary( out, false );
409  out.Print( 0, " Total plated holes count %u\n", totalHoleCount );
410  }
411 
412  out.Print( 0, "\n\n" );
413  }
414 
415  // NPTHoles. Generate the full list (pads+vias) if PTH and NPTH are merged,
416  // or only the NPTH list (which never has vias)
417  if( !m_merge_PTH_NPTH )
418  buildNPTHlist = true;
419 
420  buildHolesList( DRILL_LAYER_PAIR( F_Cu, B_Cu ), buildNPTHlist );
421 
422  // nothing wrong with an empty NPTH file in report.
423  if( m_merge_PTH_NPTH )
424  out.Print( 0, "Not plated through holes are merged with plated holes\n" );
425  else
426  out.Print( 0, "Drill file '%s' contains\n",
428  true, m_merge_PTH_NPTH ) ) );
429 
430  out.Print( 0, " unplated through holes:\n" );
431  out.Print( 0, separator );
432  totalHoleCount = printToolSummary( out, true );
433  out.Print( 0, " Total unplated holes count %u\n", totalHoleCount );
434 
435  return true;
436 }
437 
438 
440 {
441  // Plot the drill map:
442  wxPoint pos;
443 
444  for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
445  {
446  const HOLE_INFO& hole = m_holeListBuffer[ii];
447  pos = hole.m_Hole_Pos;
448 
449  // Gives a good line thickness to have a good marker shape:
451 
452  // Always plot the drill symbol (for slots identifies the needed cutter!
453  aPlotter->Marker( pos, hole.m_Hole_Diameter, hole.m_Tool_Reference - 1 );
454 
455  if( hole.m_Hole_Shape != 0 )
456  {
457  wxSize oblong_size = hole.m_Hole_Size;
458  aPlotter->FlashPadOval( pos, oblong_size, hole.m_Hole_Orient, SKETCH, nullptr );
459  }
460  }
461 
462  aPlotter->SetCurrentLineWidth( -1 );
463 
464  return true;
465 }
466 
467 
468 unsigned GENDRILL_WRITER_BASE::printToolSummary( OUTPUTFORMATTER& out, bool aSummaryNPTH ) const
469 {
470  unsigned totalHoleCount = 0;
471 
472  for( unsigned ii = 0; ii < m_toolListBuffer.size(); ii++ )
473  {
474  const DRILL_TOOL& tool = m_toolListBuffer[ii];
475 
476  if( aSummaryNPTH && !tool.m_Hole_NotPlated )
477  continue;
478 
479  if( !aSummaryNPTH && tool.m_Hole_NotPlated )
480  continue;
481 
482  // List the tool number assigned to each drill,
483  // in mm then in inches.
484  int tool_number = ii+1;
485  out.Print( 0, " T%d %2.3fmm %2.4f\" ", tool_number,
486  diameter_in_mm( tool.m_Diameter ),
487  diameter_in_inches( tool.m_Diameter ) );
488 
489  // Now list how many holes and ovals are associated with each drill.
490  if( ( tool.m_TotalCount == 1 ) && ( tool.m_OvalCount == 0 ) )
491  out.Print( 0, "(1 hole)\n" );
492  else if( tool.m_TotalCount == 1 )
493  out.Print( 0, "(1 hole) (with 1 slot)\n" );
494  else if( tool.m_OvalCount == 0 )
495  out.Print( 0, "(%d holes)\n", tool.m_TotalCount );
496  else if( tool.m_OvalCount == 1 )
497  out.Print( 0, "(%d holes) (with 1 slot)\n", tool.m_TotalCount );
498  else // tool.m_OvalCount > 1
499  out.Print( 0, "(%d holes) (with %d slots)\n", tool.m_TotalCount, tool.m_OvalCount );
500 
501  totalHoleCount += tool.m_TotalCount;
502  }
503 
504  out.Print( 0, "\n" );
505 
506  return totalHoleCount;
507 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
double diameter_in_inches(double ius)
unsigned printToolSummary(OUTPUTFORMATTER &aOut, bool aSummaryNPTH) const
Print m_toolListBuffer[] tools to aOut and returns total hole count.
virtual const wxString getDrillFileName(DRILL_LAYER_PAIR aPair, bool aNPTH, bool aMerge_PTH_NPTH) const
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
double diameter_in_mm(double ius)
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:100
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:174
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:360
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
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
virtual bool StartPlot()=0
This file is part of the common library.
Plotting engines (PostScript, Gerber, HPGL and DXF)
int GetX() const
Definition: eda_rect.h:98
static constexpr double IU_PER_MM
Mock up a conversion function.
const EDA_RECT GetBoardEdgesBoundingBox() const
Return the board bounding box calculated using exclusively the board edges (graphics on Edge....
Definition: board.h:742
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:76
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:102
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:152
int getMarkerBestPenSize(int aMarkerDiameter)
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:155
int GetWidth() const
Definition: eda_rect.h:109
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:479
void PlotPcbText(const PCB_TEXT *aText)
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:309
int GetHPGLPenSpeed() const
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:465
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
std::vector< DRILL_LAYER_PAIR > getUniqueLayerPairs() const
Get unique layer pairs by examining the micro and blind_buried vias.
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
const wxString & GetFileName() const
Definition: board.h:228
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
Definition: plotter.h:470
This file contains miscellaneous commonly used macros and functions.
int GetBottom() const
Definition: eda_rect.h:114
Board plot function definition file.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:71
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
PCB specific render settings.
Definition: pcb_painter.h:64
std::vector< DRILL_TOOL > m_toolListBuffer
virtual bool EndPlot()=0
LSET is a set of PCB_LAYER_IDs.
bool GenDrillReportFile(const wxString &aFullFileName)
Create a plain text report file giving a list of drill values and drill count for through holes,...
void SetLayerSet(LSET aLayerMask)
Definition: pcbplot.h:84
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:497
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:67
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
virtual void SetPenSpeed(int speed)
Definition: plotter_hpgl.h:86
helper classes to handle hole info for drill files generators.
static const wxChar A4[]
Definition: page_info.h:63
Handle hole which must be drilled (diameter, position and layers).
wxPoint GetOffset()
Return the plot offset (usually the position of the drill/place origin).
std::pair< PCB_LAYER_ID, PCB_LAYER_ID > DRILL_LAYER_PAIR
Parameters and options when plotting/printing a board.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
int GetHeight() const
Definition: eda_rect.h:110
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:104
void buildHolesList(DRILL_LAYER_PAIR aLayerPair, bool aGenerateNPTH_list)
Create the list of holes and tools for a given board.
void Marker(const wxPoint &position, int diametre, unsigned aShapeId)
Draw a pattern shape number aShapeId, to coord position.
Definition: plotter.cpp:338
int GetHPGLPenNum() const
Base plotter engine class.
Definition: plotter.h:121
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:98
const int scale
const std::string layerName(PCB_LAYER_ID aLayer) const
void PlotPcbShape(const PCB_SHAPE *aShape)
virtual void SetPenNumber(int number)
Definition: plotter_hpgl.h:91
Handle the component boundary box.
Definition: eda_rect.h:42
bool genDrillMapFile(const wxString &aFullFileName, PLOT_FORMAT aFormat)
Plot a map of drill marks for holes.
#define IU_PER_MILS
Definition: plotter.cpp:137
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:73
wxPoint Centre() const
Definition: eda_rect.h:55
Used for text file output.
Definition: richio.h:456
bool plotDrillMarks(PLOTTER *aPlotter)
Write the drill marks in HPGL, POSTSCRIPT or other supported formats/.
virtual void Text(const wxPoint &aPos, const COLOR4D &aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=nullptr)
Draw text with the plotter.
Definition: gr_text.cpp:217
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:103
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
void SetDefaultPenWidth(int aWidth)
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
static constexpr int Millimeter2iu(double mm)
std::vector< HOLE_INFO > m_holeListBuffer
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
DRAWINGS & Drawings()
Definition: board.h:236
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
wxString DateAndTime()
Definition: string.cpp:509
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:158