KiCad PCB EDA Suite
gerber_jobfile_writer.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) 2018 Jean_Pierre Charras <jp.charras at wanadoo.fr>
5  * Copyright (C) 1992-2018 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 
30 #include <fctsys.h>
31 
32 #include <vector>
33 
34 #include <plotter.h>
35 #include <pcb_edit_frame.h>
36 #include <build_version.h>
37 
38 #include <class_board.h>
39 #include <class_zone.h>
40 #include <class_module.h>
41 
42 #include <pcbplot.h>
43 #include <pcbnew.h>
44 #include <gerber_jobfile_writer.h>
46 #include <reporter.h>
47 #include <gbr_metadata.h>
48 
49 
51 {
52  m_pcb = aPcb;
53  m_reporter = aReporter;
54  m_conversionUnits = 1.0 / IU_PER_MM; // Gerber units = mm
55  m_indent = 0;
56 }
57 
59 {
60  int flag = SIDE_NONE;
61 
62  for( unsigned ii = 0; ii < m_params.m_LayerId.size(); ii++ )
63  {
64  if( m_params.m_LayerId[ii] == B_SilkS )
65  flag |= SIDE_BOTTOM;
66 
67  if( m_params.m_LayerId[ii] == F_SilkS )
68  flag |= SIDE_TOP;
69  }
70 
71  return (enum ONSIDE)flag;
72 }
73 
74 
76 {
77  int flag = SIDE_NONE;
78 
79  for( unsigned ii = 0; ii < m_params.m_LayerId.size(); ii++ )
80  {
81  if( m_params.m_LayerId[ii] == B_Mask )
82  flag |= SIDE_BOTTOM;
83 
84  if( m_params.m_LayerId[ii] == F_Mask )
85  flag |= SIDE_TOP;
86  }
87 
88  return (enum ONSIDE)flag;
89 }
90 
91 const char* GERBER_JOBFILE_WRITER::sideKeyValue( enum ONSIDE aValue )
92 {
93  // return the key associated to sides used for some layers
94  // "No, TopOnly, BotOnly or Both"
95  const char* value = nullptr;
96 
97  switch( aValue )
98  {
99  case SIDE_NONE:
100  value = "No"; break;
101 
102  case SIDE_TOP:
103  value = "TopOnly"; break;
104 
105  case SIDE_BOTTOM:
106  value = "BotOnly"; break;
107 
108  case SIDE_BOTH:
109  value = "Both"; break;
110 
111  }
112 
113  return value;
114 }
115 
116 
117 bool GERBER_JOBFILE_WRITER::CreateJobFile( const wxString& aFullFilename )
118 {
119  bool success;
120  wxString msg;
121 
122  success = WriteJSONJobFile( aFullFilename );
123 
124  if( !success )
125  {
126  if( m_reporter )
127  {
128  msg.Printf( _( "Unable to create job file \"%s\"" ), aFullFilename );
130  }
131  }
132  else if( m_reporter )
133  {
134  msg.Printf( _( "Create Gerber job file \"%s\"" ), aFullFilename );
136  }
137 
138  return success;
139 }
140 
141 
143 {
144  wxString text;
145  openBlock();
146  addJSONObject( "\"Header\":\n" );
147  openBlock();
148 
149  // Creates the GenerationSoftware
150  addJSONObject( "\"GenerationSoftware\":\n" );
151  openBlock();
152  addJSONObject( "\"Vendor\": \"KiCad\",\n" );
153  addJSONObject( "\"Application\": \"Pcbnew\",\n" );
154  text.Printf( "\"Version\": \"%s\"\n", GetBuildVersion() );
155  addJSONObject( text );
157 
158  // creates the TF.CreationDate ext:
159  // The attribute value must conform to the full version of the ISO 8601
160  // date and time format, including time and time zone. Note that this is
161  // the date the Gerber file was effectively created,
162  // not the time the project of PCB was started
163  wxDateTime date( wxDateTime::GetTimeNow() );
164  // Date format: see http://www.cplusplus.com/reference/ctime/strftime
165  wxString msg = date.Format( wxT( "%z" ) ); // Extract the time zone offset
166  // The time zone offset format is + (or -) mm or hhmm (mm = number of minutes, hh = number of hours)
167  // we want +(or -) hh:mm
168  if( msg.Len() > 3 )
169  msg.insert( 3, ":", 1 );
170 
171  text.Printf( wxT( "\"CreationDate\": \"%s%s\"\n" ),date.FormatISOCombined(), msg );
172  addJSONObject( text );
173 
175 }
176 
177 
179 {
180  if( m_JSONbuffer.Last() == ',' )
181  {
182  m_JSONbuffer.RemoveLast();
183  return;
184  }
185 
186  if( m_JSONbuffer.Last() == '\n' )
187  {
188  m_JSONbuffer.RemoveLast();
189 
190  if( m_JSONbuffer.Last() == ',' )
191  m_JSONbuffer.RemoveLast();
192 
193  m_JSONbuffer.Append( '\n' );
194  }
195 }
196 
197 bool GERBER_JOBFILE_WRITER::WriteJSONJobFile( const wxString& aFullFilename )
198 {
199  // Note: in Gerber job file, dimensions are in mm, and are floating numbers
200  FILE* jobFile = wxFopen( aFullFilename, "wt" );
201 
202  m_JSONbuffer.Empty();
203  m_indent = 0;
204 
205  if( jobFile == nullptr )
206  return false;
207 
209 
210  // output the job file header
211  addJSONHeader();
212 
213  // Add the General Specs
215 
216  // Job file support a few design rules:
218 
219  // output the gerber file list:
221 
222  // output the board stackup:
224 
225  // Close job file full block data
226  removeJSONSepararator(); // remove the last separator
227  closeBlock();
228 
229  fputs( TO_UTF8( m_JSONbuffer ), jobFile );
230 
231  fclose( jobFile );
232 
233  return true;
234 }
235 
236 
238 {
239  addJSONObject( "\"GeneralSpecs\":\n" );
240  openBlock();
241 
242  addJSONObject( "\"ProjectId\":\n" );
243  openBlock();
244 
245  // Creates the ProjectId. Format is (from Gerber file format doc):
246  // ProjectId,<project id>,<project GUID>,<revision id>*%
247  // <project id> is the name of the project, restricted to basic ASCII symbols only,
248  // and comma not accepted
249  // All illegal chars will be replaced by underscore
250  // Rem: <project id> accepts only ASCII 7 code (only basic ASCII codes are allowed in gerber files).
251  //
252  // <project GUID> is a string which is an unique id of a project.
253  // However Kicad does not handle such a project GUID, so it is built from the board name
254  wxFileName fn = m_pcb->GetFileName();
255  wxString msg = fn.GetFullName();
256 
257  // Build a <project GUID>, from the board name
258  wxString guid = GbrMakeProjectGUIDfromString( msg );
259 
260  // build the <project id> string: this is the board short filename (without ext)
261  // and all non ASCII chars are replaced by '_'
262  msg = fn.GetName();
263 
264  // build the <rec> string. All non ASCII chars and comma are replaced by '_'
265  wxString rev = m_pcb->GetTitleBlock().GetRevision();
266 
267  if( rev.IsEmpty() )
268  rev = wxT( "rev?" );
269 
270  addJSONObject( wxString::Format( "\"Name\": \"%s\",\n", msg.ToAscii() ) );
271  addJSONObject( wxString::Format( "\"GUID\": \"%s\",\n", guid ) );
272  addJSONObject( wxString::Format( "\"Revision\": \"%s\"\n", rev.ToAscii() ) );
273 
275 
276  // output the bord size in mm:
278  addJSONObject( "\"Size\":\n" );
279  openBlock();
280 
281  addJSONObject( wxString::Format( "\"X\": %.3f,\n", brect.GetWidth()*m_conversionUnits ) );
282  addJSONObject( wxString::Format( "\"Y\": %.3f\n", brect.GetHeight()*m_conversionUnits ) );
284 
285  // Add some data to the JSON header, GeneralSpecs:
286  // number of copper layers
287  addJSONObject( wxString::Format( "\"LayerNumber\": %d,\n", m_pcb->GetCopperLayerCount() ) );
288 
289  // Board thickness
290  addJSONObject( wxString::Format( "\"BoardThickness\": %.3f,\n",
292 
293 #if 0 // Not yet in use
294  /* The board type according to IPC-2221. There are six primary board types:
295  - Type 1 - Single-sided
296  - Type 2 - Double-sided
297  - Type 3 - Multilayer, TH components only
298  - Type 4 - Multilayer, with TH, blind and/or buried vias.
299  - Type 5 - Multilayer metal-core board, TH components only
300  - Type 6 - Multilayer metal-core
301  */
302  addJSONObject( wxString::Format( "\"IPC-2221-Type\": \"%d\",\n", 4 ) );
303 
304  /* Via protection: key words:
305  Ia Tented - Single-sided
306  Ib Tented - Double-sided
307  IIa Tented and Covered - Single-sided
308  IIb Tented and Covered - Double-sided
309  IIIa Plugged - Single-sided
310  IIIb Plugged - Double-sided
311  IVa Plugged and Covered - Single-sided
312  IVb Plugged and Covered - Double-sided
313  V Filled (fully plugged)
314  VI Filled and Covered
315  VIII Filled and Capped
316  None...No protection
317  */
318  addJSONObject( wxString::Format( "\"ViaProtection\": \"%s\",\n", "Ib" ) );
319 #endif
322 }
323 
324 
326 {
327  // Add the Files Attributes section in JSON format to m_JSONbuffer
328  addJSONObject( "\"FilesAttributes\":\n" );
329  openArrayBlock();
330 
331  for( unsigned ii = 0; ii < m_params.m_GerberFileList.GetCount(); ii ++ )
332  {
333  wxString& name = m_params.m_GerberFileList[ii];
334  PCB_LAYER_ID layer = m_params.m_LayerId[ii];
335  wxString gbr_layer_id;
336  bool skip_file = false; // true to skip files which should not be in job file
337  const char* polarity = "Positive";
338 
339  if( layer <= B_Cu )
340  {
341  gbr_layer_id = "Copper,L";
342 
343  if( layer == B_Cu )
344  gbr_layer_id << m_pcb->GetCopperLayerCount();
345  else
346  gbr_layer_id << layer+1;
347 
348  gbr_layer_id << ",";
349 
350  if( layer == B_Cu )
351  gbr_layer_id << "Bot";
352  else if( layer == F_Cu )
353  gbr_layer_id << "Top";
354  else
355  gbr_layer_id << "Inr";
356  }
357 
358  else
359  {
360  switch( layer )
361  {
362  case B_Adhes:
363  gbr_layer_id = "Glue,Bot"; break;
364  case F_Adhes:
365  gbr_layer_id = "Glue,Top"; break;
366 
367  case B_Paste:
368  gbr_layer_id = "SolderPaste,Bot"; break;
369  case F_Paste:
370  gbr_layer_id = "SolderPaste,Top"; break;
371 
372  case B_SilkS:
373  gbr_layer_id = "Legend,Bot"; break;
374  case F_SilkS:
375  gbr_layer_id = "Legend,Top"; break;
376 
377  case B_Mask:
378  gbr_layer_id = "SolderMask,Bot"; polarity = "Negative"; break;
379  case F_Mask:
380  gbr_layer_id = "SolderMask,Top"; polarity = "Negative"; break;
381 
382  case Edge_Cuts:
383  gbr_layer_id = "Profile"; break;
384 
385  case B_Fab:
386  gbr_layer_id = "AssemblyDrawing,Bot"; break;
387  case F_Fab:
388  gbr_layer_id = "AssemblyDrawing,Top"; break;
389 
390  case Dwgs_User:
391  case Cmts_User:
392  case Eco1_User:
393  case Eco2_User:
394  case Margin:
395  case B_CrtYd:
396  case F_CrtYd:
397  skip_file = true; break;
398 
399  default:
400  skip_file = true;
401  m_reporter->Report( "Unexpected layer id in job file",
403  break;
404  }
405  }
406 
407  if( !skip_file )
408  {
409  // name can contain non ASCII7 chars.
410  // Only ASCII7 chars are accepted in gerber files. others must be converted to
411  // a gerber hexa sequence.
412  std::string strname = formatStringToGerber( name );
413 
414  openBlock();
415  addJSONObject( wxString::Format( "\"Path\": \"%s\",\n", strname.c_str() ) );
416  addJSONObject( wxString::Format( "\"FileFunction\": \"%s\",\n", gbr_layer_id ) ),
417  addJSONObject( wxString::Format( "\"FilePolarity\": \"%s\"\n", polarity ) );
419  }
420  }
421  // Close the file list:
422  removeJSONSepararator(); // remove the last separator
424 }
425 
426 
428 {
429  // Add the Design Rules section in JSON format to m_JSONbuffer
430  // Job file support a few design rules:
431  const BOARD_DESIGN_SETTINGS& dsnSettings = m_pcb->GetDesignSettings();
432  NETCLASS defaultNC = *dsnSettings.GetDefault();
433  int minclearanceOuter = defaultNC.GetClearance();
434  bool hasInnerLayers = m_pcb->GetCopperLayerCount() > 2;
435 
436  // Search a smaller clearance in other net classes, if any.
437  for( NETCLASSES::const_iterator it = dsnSettings.m_NetClasses.begin();
438  it != dsnSettings.m_NetClasses.end();
439  ++it )
440  {
441  NETCLASS netclass = *it->second;
442  minclearanceOuter = std::min( minclearanceOuter, netclass.GetClearance() );
443  }
444 
445  // job file knows different clearance types.
446  // Kicad knows only one clearance for pads and tracks
447  int minclearance_track2track = minclearanceOuter;
448 
449  // However, pads can have a specific clearance defined for a pad or a footprint,
450  // and min clearance can be dependent on layers.
451  // Search for a minimal pad clearance:
452  int minPadClearanceOuter = defaultNC.GetClearance();
453  int minPadClearanceInner = defaultNC.GetClearance();
454 
455  for( MODULE* module : m_pcb->Modules() )
456  {
457  for( auto& pad : module->Pads() )
458  {
459  if( ( pad->GetLayerSet() & LSET::InternalCuMask() ).any() )
460  minPadClearanceInner = std::min( minPadClearanceInner, pad->GetClearance() );
461 
462  if( ( pad->GetLayerSet() & LSET::ExternalCuMask() ).any() )
463  minPadClearanceOuter = std::min( minPadClearanceOuter, pad->GetClearance() );
464  }
465  }
466 
467 
468  addJSONObject( "\"DesignRules\":\n" );
469  openArrayBlock();
470 
471  openBlock();
472  addJSONObject( "\"Layers\": \"Outer\",\n" );
473  addJSONObject( wxString::Format( "\"PadToPad\": %.3f,\n", minPadClearanceOuter*m_conversionUnits ) );
474  addJSONObject( wxString::Format( "\"PadToTrack\": %.3f,\n", minPadClearanceOuter*m_conversionUnits ) );
475  addJSONObject( wxString::Format( "\"TrackToTrack\": %.3f,\n", minclearance_track2track*m_conversionUnits ) );
476 
477  // Until this is changed in Kicad, use the same value for internal tracks
478  int minclearanceInner = minclearanceOuter;
479 
480  // Output the minimal track width
481  int mintrackWidthOuter = INT_MAX;
482  int mintrackWidthInner = INT_MAX;
483 
484  for( TRACK* track : m_pcb->Tracks() )
485  {
486  if( track->Type() == PCB_VIA_T )
487  continue;
488 
489  if( track->GetLayer() == B_Cu || track->GetLayer() == F_Cu )
490  mintrackWidthOuter = std::min( mintrackWidthOuter, track->GetWidth() );
491  else
492  mintrackWidthInner = std::min( mintrackWidthInner, track->GetWidth() );
493  }
494 
495  if( mintrackWidthOuter != INT_MAX )
496  addJSONObject( wxString::Format( "\"MinLineWidth\": %.3f,\n",
497  mintrackWidthOuter*m_conversionUnits ) );
498 
499  // Output the minimal zone to xx clearance
500  // Note: zones can have a zone clearance set to 0
501  // if happens, the actual zone clearance is the clearance of its class
502  minclearanceOuter = INT_MAX;
503  minclearanceInner = INT_MAX;
504 
505  for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
506  {
507  ZONE_CONTAINER* zone = m_pcb->GetArea( ii );
508 
509  if( zone->GetIsKeepout() || !zone->IsOnCopperLayer() )
510  continue;
511 
512  int zclerance = zone->GetClearance();
513 
514  if( zone->GetLayer() == B_Cu || zone->GetLayer() == F_Cu )
515  minclearanceOuter = std::min( minclearanceOuter, zclerance );
516  else
517  minclearanceInner = std::min( minclearanceInner, zclerance );
518  }
519 
520  if( minclearanceOuter != INT_MAX )
521  addJSONObject( wxString::Format( "\"TrackToRegion\": %.3f,\n",
522  minclearanceOuter*m_conversionUnits ) );
523 
524  if( minclearanceOuter != INT_MAX )
525  addJSONObject( wxString::Format( "\"RegionToRegion\": %.3f,\n",
526  minclearanceOuter*m_conversionUnits ) );
527 
528  removeJSONSepararator(); // remove the last separator
529 
530  if( !hasInnerLayers )
531  closeBlock();
532  else
534 
535 
536  if( hasInnerLayers )
537  {
538  openBlock();
539  addJSONObject( "\"Layers\": \"Inner\",\n" );
540  addJSONObject( wxString::Format( "\"PadToPad\": %.3f,\n", minPadClearanceInner*m_conversionUnits ) );
541  addJSONObject( wxString::Format( "\"PadToTrack\": %.3f,\n", minPadClearanceInner*m_conversionUnits ) );
542  addJSONObject( wxString::Format( "\"TrackToTrack\": %.3f,\n", minclearance_track2track*m_conversionUnits ) );
543 
544  if( mintrackWidthInner != INT_MAX )
545  addJSONObject( wxString::Format( "\"MinLineWidth\": %.3f,\n", mintrackWidthInner*m_conversionUnits ) );
546 
547  if( minclearanceInner != INT_MAX )
548  addJSONObject( wxString::Format( "\"TrackToRegion\": %.3f,\n", minclearanceInner*m_conversionUnits ) );
549 
550  if( minclearanceInner != INT_MAX )
551  addJSONObject( wxString::Format( "\"RegionToRegion\": %.3f,\n", minclearanceInner*m_conversionUnits ) );
552 
553  removeJSONSepararator(); // remove the last separator
554  closeBlock();
555  }
556 
557  // Close DesignRules
559 }
560 
561 
563 {
564  // Add the Material Stackup section in JSON format to m_JSONbuffer
565  addJSONObject( "\"MaterialStackup\":\n" );
566  openArrayBlock();
567 
568  // Build the candidates: only layers on a board are candidates:
569  LSET maskLayer;
570 
571  for( unsigned ii = 0; ii < m_params.m_GerberFileList.GetCount(); ii ++ )
572  {
573  PCB_LAYER_ID layer = m_params.m_LayerId[ii];
574 
575  if( layer <= B_Cu )
576  maskLayer.set( layer );
577  else
578  {
579  switch( layer )
580  {
581  case B_Paste:
582  case F_Paste:
583  case B_SilkS:
584  case F_SilkS:
585  case B_Mask:
586  case F_Mask:
587  maskLayer.set( layer );
588  break;
589 
590  case Edge_Cuts:
591  case B_Adhes:
592  case F_Adhes:
593  case B_Fab:
594  case F_Fab:
595  case Dwgs_User:
596  case Cmts_User:
597  case Eco1_User:
598  case Eco2_User:
599  case Margin:
600  case B_CrtYd:
601  case F_CrtYd:
602  break;
603 
604  default:
606  wxString::Format( "Unexpected layer id %d in job file", layer ),
608  break;
609  }
610  }
611  }
612 
613  // build a candidate list (in reverse order: bottom to top):
614  LSEQ list = maskLayer.SeqStackupBottom2Top();
615  // Generate the list (top to bottom):
616  for( int ii = list.size()-1; ii >= 0; --ii )
617  {
618  PCB_LAYER_ID layer = list[ii];
619  wxString layer_type;
620  wxString color;
621  wxString dielectric;
622  double thickness = 0.0; // layer thickness in mm
623 
624  if( layer <= B_Cu )
625  {
626  layer_type = "Copper";
627  //thickness = 0.035;
628  }
629  else
630  {
631  switch( layer )
632  {
633  case B_Paste:
634  case F_Paste:
635  layer_type = "SolderPaste";
636  break;
637 
638  case B_SilkS:
639  case F_SilkS:
640  //color = "White";
641  layer_type = "Legend";
642  break;
643 
644  case B_Mask:
645  case F_Mask:
646  //color = "Green";
647  //thickness = 0.025;
648  layer_type = "SolderMask";
649  break;
650 
651  default:
652  break;
653  }
654  }
655 
656  openBlock();
657  addJSONObject( wxString::Format( "\"Type\": \"%s\",\n", layer_type ) );
658 
659  if( !color.IsEmpty() )
660  addJSONObject( wxString::Format( "\"Color\": \"%s\",\n", color ) );
661 
662  if( thickness > 0.0 )
663  addJSONObject( wxString::Format( "\"Thickness\": %f,\n", thickness ) );
664 
665  std::string strname = formatStringToGerber( m_pcb->GetLayerName( layer ) );
666  addJSONObject( wxString::Format( "\"Notes\": \"Layer %s\",\n", strname.c_str() ) );
669 
670  if( layer < B_Cu ) // Add dielectric between copper layers
671  {
672  dielectric = "FR4"; // Temporary
673 
674  openBlock();
675  addJSONObject( wxString::Format( "\"Type\": \"%s\",\n", "Dielectric" ) );
676 
677  if( thickness > 0.0 )
678  addJSONObject( wxString::Format( "\"Thickness\": %f,\n", color ) );
679 
680  if( !dielectric.IsEmpty() )
681  addJSONObject( wxString::Format( "\"Material\": \"%s\",\n", dielectric ) );
682 
683  addJSONObject( wxString::Format( "\"Notes\": \"Layers L%d/L%d\",\n",
684  layer+1, layer+2 ) );
687  }
688  }
689 
692 }
a class to handle special data (items attributes) during plot.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
NETCLASSPTR GetDefault() const
Function GetDefault.
bool CreateJobFile(const wxString &aFullFilename)
Creates a Gerber job file.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
int GetClearance() const
Definition: netclass.h:162
void removeJSONSepararator()
Remove the comma if it is the last char in m_JSONbuffer, or the previous char if the last char is a ...
void addJSONHeader()
Add the job file header in JSON format to m_JSONbuffer.
Class BOARD to handle a board.
int color
Definition: DXF_plotter.cpp:62
int GetCopperLayerCount() const
Function GetCopperLayerCount.
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:175
const char * sideKeyValue(enum ONSIDE aValue)
int GetHeight() const
Definition: eda_rect.h:118
void addJSONObject(const wxString &aParam)
Add aParam to m_JSONbuffer, with suitable indentation.
Classes to handle copper zones.
iterator end()
Definition: netclass.h:249
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
Classes used to generate a Gerber job file in JSON.
void closeBlock()
close a JSON block: decrement indentation and add &#39;}&#39;
void addJSONFilesAttributes()
Add the Files Attributes section in JSON format to m_JSONbuffer.
std::string formatStringToGerber(const wxString &aString)
This helper function "normalize" aString and convert it to a Gerber std::string Normalisation means c...
NETCLASS_MAP::const_iterator const_iterator
Definition: netclass.h:251
LSEQ SeqStackupBottom2Top() const
Function SeqStackBottom2Top returns the sequence that is typical for a bottom-to-top stack-up...
Definition: lset.cpp:412
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_zone.cpp:774
void openBlock()
open a JSON block: add &#39;{&#39; and increment indentation
Board plot function definition file.
const EDA_RECT GetBoardEdgesBoundingBox() const
Function GetBoardEdgesBoundingBox Returns the board bounding box calculated using exclusively the boa...
Definition: class_board.h:804
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:629
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
wxArrayString m_GerberFileList
PCB_LAYER_ID
A quick note on layer IDs:
Class LSET is a set of PCB_LAYER_IDs.
iterator begin()
Definition: netclass.h:248
DLIST_ITERATOR_WRAPPER< MODULE > Modules()
Definition: class_board.h:254
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
wxString GbrMakeProjectGUIDfromString(wxString &aText)
A helper function to build a project GUID using format RFC4122 Version 1 or 4 from the project name...
const wxString & GetFileName() const
Definition: class_board.h:237
const wxString & GetRevision() const
Definition: title_block.h:89
Class NETCLASS handles a collection of nets and the parameters used to route or test these nets...
Definition: netclass.h:55
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
The common library.
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:633
static LSET ExternalCuMask()
Function ExternalCuMask returns a mask holding the Front and Bottom layers.
Definition: lset.cpp:703
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
void openArrayBlock()
open a JSON array block: add &#39;[&#39; and increment indentation
void closeBlockWithSep()
close a JSON block: decrement indentation and add &#39;}&#39; and &#39;,&#39;
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1020
Class LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
bool WriteJSONJobFile(const wxString &aFullFilename)
Creates an Gerber job file in JSON format.
void closeArrayBlockWithSep()
close a JSON array block: decrement indentation and add &#39;]&#39; and &#39;,&#39;
bool IsOnCopperLayer() const
Function IsOnCopperLayer.
Definition: class_zone.cpp:181
TITLE_BLOCK & GetTitleBlock()
Definition: class_board.h:559
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:991
const char * name
Definition: DXF_plotter.cpp:61
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
void addJSONDesignRules()
Add the Design Rules section in JSON format to m_JSONbuffer.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
std::vector< PCB_LAYER_ID > m_LayerId
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
DLIST_ITERATOR_WRAPPER< TRACK > Tracks()
Definition: class_board.h:253
Module description (excepted pads)
void addJSONMaterialStackup()
Add the Material Stackup section in JSON format to m_JSONbuffer This is the ordered list of stackup l...
void addJSONGeneralSpecs()
Add the General Specs in JSON format to m_JSONbuffer.
GERBER_JOBFILE_WRITER(BOARD *aPcb, REPORTER *aReporter=nullptr)
#define min(a, b)
Definition: auxiliary.h:85
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.