KiCad PCB EDA Suite
export_to_pcbnew.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) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2020 KiCad Developers, see change_log.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 
25 #include <vector>
26 
27 #include <export_to_pcbnew.h>
28 
29 #include <confirm.h>
30 #include <kicad_string.h>
31 #include <locale_io.h>
32 #include <macros.h>
33 #include <trigo.h>
34 #include <gerbview_frame.h>
35 #include <gerber_file_image.h>
36 #include <gerber_file_image_list.h>
37 #include <build_version.h>
39 #include "excellon_image.h"
40 
41 // Imported function
42 extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
43 
44 
45 GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName )
46 {
47  m_gerbview_frame = aFrame;
48  m_pcb_file_name = aFileName;
49  m_fp = NULL;
51 }
52 
53 
55 {
56 }
57 
58 
59 bool GBR_TO_PCB_EXPORTER::ExportPcb( const LAYER_NUM* aLayerLookUpTable, int aCopperLayers )
60 {
61  LOCALE_IO toggle; // toggles on, then off, the C locale.
62 
63  m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) );
64 
65  if( m_fp == NULL )
66  {
67  wxString msg;
68  msg.Printf( _( "Cannot create file \"%s\"" ), m_pcb_file_name );
70  return false;
71  }
72 
73  m_pcbCopperLayersCount = aCopperLayers;
74 
75  writePcbHeader( aLayerLookUpTable );
76 
77  // create an image of gerber data
78  const int pcbCopperLayerMax = 31;
80 
81  // First collect all the holes. We'll use these to generate pads, vias, etc.
82  for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
83  {
84  EXCELLON_IMAGE* excellon = dynamic_cast<EXCELLON_IMAGE*>( images->GetGbrImage( layer ) );
85 
86  if( excellon == NULL ) // Layer not yet used or not a drill image
87  continue;
88 
89  for( GERBER_DRAW_ITEM* gerb_item : excellon->GetItems() )
90  collect_hole( gerb_item );
91  }
92 
93  // Next: non copper layers:
94  for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
95  {
96  GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
97 
98  if( gerber == NULL ) // Graphic layer not yet used
99  continue;
100 
101  LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
102 
103  if( !IsPcbLayer( pcb_layer_number ) )
104  continue;
105 
106  if( pcb_layer_number <= pcbCopperLayerMax ) // copper layer
107  continue;
108 
109  for( GERBER_DRAW_ITEM* gerb_item : gerber->GetItems() )
110  export_non_copper_item( gerb_item, pcb_layer_number );
111  }
112 
113  // Copper layers
114  for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer )
115  {
116  GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
117 
118  if( gerber == NULL ) // Graphic layer not yet used
119  continue;
120 
121  LAYER_NUM pcb_layer_number = aLayerLookUpTable[layer];
122 
123  if( pcb_layer_number < 0 || pcb_layer_number > pcbCopperLayerMax )
124  continue;
125 
126  for( GERBER_DRAW_ITEM* gerb_item : gerber->GetItems() )
127  export_copper_item( gerb_item, pcb_layer_number );
128  }
129 
130  // Now write out the holes we collected earlier as vias
131  for( const EXPORT_VIA& via : m_vias )
132  export_via( via );
133 
134  fprintf( m_fp, ")\n" );
135 
136  fclose( m_fp );
137  m_fp = NULL;
138  return true;
139 }
140 
141 
143 {
144  // used when a D_CODE is not found. default D_CODE to draw a flashed item
145  static D_CODE dummyD_CODE( 0 );
146 
147  wxPoint seg_start = aGbrItem->m_Start;
148  wxPoint seg_end = aGbrItem->m_End;
149  D_CODE* d_codeDescr = aGbrItem->GetDcodeDescr();
150  SHAPE_POLY_SET polygon;
151 
152  if( d_codeDescr == NULL )
153  d_codeDescr = &dummyD_CODE;
154 
155  switch( aGbrItem->m_Shape )
156  {
157  case GBR_POLYGON:
158  writePcbPolygon( aGbrItem->m_Polygon, aLayer );
159  break;
160 
161  case GBR_SPOT_CIRCLE:
162  case GBR_SPOT_RECT:
163  case GBR_SPOT_OVAL:
164  case GBR_SPOT_POLY:
165  case GBR_SPOT_MACRO:
166  d_codeDescr->ConvertShapeToPolygon();
167  writePcbPolygon( d_codeDescr->m_Polygon, aLayer, aGbrItem->GetABPosition( seg_start ) );
168  break;
169 
170  case GBR_ARC:
171  {
172  double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
173  (double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
174  double b = atan2( (double) ( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
175  (double) ( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
176 
177  double angle = RAD2DEG(b - a);
178  seg_start = aGbrItem->m_ArcCentre;
179 
180  // Ensure arc orientation is CCW
181  if( angle < 0 )
182  angle += 360.0;
183 
184  // Reverse Y axis:
185  seg_start.y = -seg_start.y;
186  seg_end.y = -seg_end.y;
187 
188  if( angle == 360.0 || angle == 0 )
189  {
190  fprintf( m_fp, "(gr_circle (center %s %s) (end %s %s) (layer %s) (width %s))\n",
191  Double2Str( MapToPcbUnits(seg_start.x) ).c_str(),
192  Double2Str( MapToPcbUnits(seg_start.y) ).c_str(),
193  Double2Str( MapToPcbUnits(seg_end.x) ).c_str(),
194  Double2Str( MapToPcbUnits(seg_end.y) ).c_str(),
195  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ),
196  Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str()
197  );
198  }
199  else
200  {
201  fprintf( m_fp, "(gr_arc (start %s %s) (end %s %s) (angle %s) (layer %s) (width %s))\n",
202  Double2Str( MapToPcbUnits(seg_start.x) ).c_str(),
203  Double2Str( MapToPcbUnits(seg_start.y) ).c_str(),
204  Double2Str( MapToPcbUnits(seg_end.x) ).c_str(),
205  Double2Str( MapToPcbUnits(seg_end.y) ).c_str(),
206  Double2Str( angle ).c_str(),
207  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ),
208  Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str()
209  );
210  }
211  }
212  break;
213 
214  case GBR_CIRCLE:
215  // Reverse Y axis:
216  seg_start.y = -seg_start.y;
217  seg_end.y = -seg_end.y;
218 
219  fprintf( m_fp, "(gr_circle (start %s %s) (end %s %s) (layer %s) (width %s))\n",
220  Double2Str( MapToPcbUnits( seg_start.x ) ).c_str(),
221  Double2Str( MapToPcbUnits( seg_start.y ) ).c_str(),
222  Double2Str( MapToPcbUnits( seg_end.x ) ).c_str(),
223  Double2Str( MapToPcbUnits( seg_end.y ) ).c_str(),
224  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ),
225  Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str() );
226  break;
227 
228  case GBR_SEGMENT:
229  // Reverse Y axis:
230  seg_start.y = -seg_start.y;
231  seg_end.y = -seg_end.y;
232 
233  fprintf( m_fp, "(gr_line (start %s %s) (end %s %s) (layer %s) (width %s))\n",
234  Double2Str( MapToPcbUnits( seg_start.x ) ).c_str(),
235  Double2Str( MapToPcbUnits( seg_start.y ) ).c_str(),
236  Double2Str( MapToPcbUnits( seg_end.x ) ).c_str(),
237  Double2Str( MapToPcbUnits( seg_end.y ) ).c_str(),
238  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ),
239  Double2Str( MapToPcbUnits( aGbrItem->m_Size.x ) ).c_str() );
240  break;
241  }
242 }
243 
244 
245 /*
246  * Many holes will be pads, but we have no way to create those without footprints, and creating
247  * a footprint per pad is not really viable.
248  *
249  * So we use vias to mimic holes, with the loss of any hole shape (as we only have round holes
250  * in vias at present).
251  *
252  * We start out with a via size minimally larger than the hole. We'll leave it this way if
253  * the pad gets drawn as a copper polygon, or increase it to the proper size if it has a
254  * circular, concentric copper flashing.
255  */
257 {
258  int size = std::min( aGbrItem->m_Size.x, aGbrItem->m_Size.y );
259  m_vias.emplace_back( aGbrItem->m_Start, size + 1, size );
260 }
261 
262 
264 {
265  wxPoint via_pos = aVia.m_Pos;
266 
267  // Reverse Y axis:
268  via_pos.y = -via_pos.y;
269 
270  // Layers are Front to Back
271  fprintf( m_fp, " (via (at %s %s) (size %s) (drill %s)",
272  Double2Str( MapToPcbUnits( via_pos.x ) ).c_str(),
273  Double2Str( MapToPcbUnits( via_pos.y ) ).c_str(),
274  Double2Str( MapToPcbUnits( aVia.m_Size ) ).c_str(),
275  Double2Str( MapToPcbUnits( aVia.m_Drill ) ).c_str() );
276 
277  fprintf( m_fp, " (layers %s %s))\n",
280 }
281 
282 
284 {
285  switch( aGbrItem->m_Shape )
286  {
287  case GBR_SPOT_CIRCLE:
288  case GBR_SPOT_RECT:
289  case GBR_SPOT_OVAL:
290  export_flashed_copper_item( aGbrItem, aLayer );
291  break;
292 
293  case GBR_ARC:
294  export_segarc_copper_item( aGbrItem, aLayer );
295  break;
296 
297  case GBR_POLYGON:
298  // One can use a polygon or a zone to output a Gerber region.
299  // none are perfect.
300  // The current way is use a polygon, as the zone export
301  // is exprimental and only for tests.
302 #if 1
303  writePcbPolygon( aGbrItem->m_Polygon, aLayer );
304 #else
305  // Only for tests:
306  writePcbZoneItem( aGbrItem, aLayer );
307 #endif
308  break;
309 
310  default:
311  export_segline_copper_item( aGbrItem, aLayer );
312  break;
313  }
314 }
315 
316 
318 {
319  wxPoint seg_start, seg_end;
320 
321  seg_start = aGbrItem->m_Start;
322  seg_end = aGbrItem->m_End;
323 
324  // Reverse Y axis:
325  seg_start.y = -seg_start.y;
326  seg_end.y = -seg_end.y;
327 
328  writeCopperLineItem( seg_start, seg_end, aGbrItem->m_Size.x, aLayer );
329 }
330 
331 
332 void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart,
333  const wxPoint& aEnd,
334  int aWidth, LAYER_NUM aLayer )
335 {
336  fprintf( m_fp, "(segment (start %s %s) (end %s %s) (width %s) (layer %s) (net 0))\n",
337  Double2Str( MapToPcbUnits(aStart.x) ).c_str(),
338  Double2Str( MapToPcbUnits(aStart.y) ).c_str(),
339  Double2Str( MapToPcbUnits(aEnd.x) ).c_str(),
340  Double2Str( MapToPcbUnits(aEnd.y) ).c_str(),
341  Double2Str( MapToPcbUnits( aWidth ) ).c_str(),
342  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
343 }
344 
345 
347 {
348  double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ),
349  (double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) );
350  double b = atan2( (double) ( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
351  (double) ( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
352 
353  wxPoint start = aGbrItem->m_Start;
354  wxPoint end = aGbrItem->m_End;
355 
356  /* Because Pcbnew does not know arcs in tracks,
357  * approximate arc by segments (SEG_COUNT__CIRCLE segment per 360 deg)
358  * The arc is drawn anticlockwise from the start point to the end point.
359  */
360  #define SEG_COUNT_CIRCLE 16
361  #define DELTA_ANGLE 2 * M_PI / SEG_COUNT_CIRCLE
362 
363  // calculate the number of segments from a to b.
364  // we want CNT_PER_360 segments fo a circle
365  if( a > b )
366  b += 2 * M_PI;
367 
368  wxPoint curr_start = start;
369  wxPoint seg_start, seg_end;
370 
371  int ii = 1;
372 
373  for( double rot = a; rot < (b - DELTA_ANGLE); rot += DELTA_ANGLE, ii++ )
374  {
375  seg_start = curr_start;
376  wxPoint curr_end = start;
377  RotatePoint( &curr_end, aGbrItem->m_ArcCentre,
378  -RAD2DECIDEG( DELTA_ANGLE * ii ) );
379  seg_end = curr_end;
380  // Reverse Y axis:
381  seg_start.y = -seg_start.y;
382  seg_end.y = -seg_end.y;
383  writeCopperLineItem( seg_start, seg_end, aGbrItem->m_Size.x, aLayer );
384  curr_start = curr_end;
385  }
386 
387  if( end != curr_start )
388  {
389  seg_start = curr_start;
390  seg_end = end;
391  // Reverse Y axis:
392  seg_start.y = -seg_start.y;
393  seg_end.y = -seg_end.y;
394  writeCopperLineItem( seg_start, seg_end, aGbrItem->m_Size.x, aLayer );
395  }
396 }
397 
398 
399 /*
400  * Flashed items are usually pads or vias. Pads are problematic because we have no way to
401  * represent one in Pcbnew outside of a footprint (and creating a footprint per pad isn't really
402  * viable).
403  * If we've already created a via from a hole, and the flashed copper item is a simple circle
404  * then we'll enlarge the via to the proper size. Otherwise we create a copper polygon to
405  * represent the flashed item (which is presumably a pad).
406  */
408  LAYER_NUM aLayer )
409 {
410  static D_CODE flashed_item_D_CODE( 0 );
411 
412  D_CODE* d_codeDescr = aGbrItem->GetDcodeDescr();
413  SHAPE_POLY_SET polygon;
414 
415  if( d_codeDescr == NULL )
416  d_codeDescr = &flashed_item_D_CODE;
417 
418  if( aGbrItem->m_Shape == GBR_SPOT_CIRCLE )
419  {
420  // See if there's a via that we can enlarge to fit this flashed item
421  for( EXPORT_VIA& via : m_vias )
422  {
423  if( via.m_Pos == aGbrItem->m_Start )
424  {
425  via.m_Size = std::max( via.m_Size, aGbrItem->m_Size.x );
426  return;
427  }
428  }
429  }
430 
431  d_codeDescr->ConvertShapeToPolygon();
432  wxPoint offset = aGbrItem->GetABPosition( aGbrItem->m_Start );
433 
434  writePcbPolygon( d_codeDescr->m_Polygon, aLayer, offset );
435 }
436 
437 
438 void GBR_TO_PCB_EXPORTER::writePcbHeader( const LAYER_NUM* aLayerLookUpTable )
439 {
440  fprintf( m_fp, "(kicad_pcb (version 4) (host Gerbview \"%s\")\n\n",
441  TO_UTF8( GetBuildVersion() ) );
442 
443  // Write layers section
444  fprintf( m_fp, " (layers \n" );
445 
446  for( int ii = 0; ii < m_pcbCopperLayersCount; ii++ )
447  {
448  int id = ii;
449 
450  if( ii == m_pcbCopperLayersCount-1)
451  id = B_Cu;
452 
453  fprintf( m_fp, " (%d %s signal)\n", id, TO_UTF8( GetPCBDefaultLayerName( id ) ) );
454  }
455 
456  for( int ii = B_Adhes; ii < PCB_LAYER_ID_COUNT; ii++ )
457  {
458  if( GetPCBDefaultLayerName( ii ).IsEmpty() ) // Layer not available for export
459  continue;
460 
461  fprintf( m_fp, " (%d %s user)\n", ii, TO_UTF8( GetPCBDefaultLayerName( ii ) ) );
462  }
463 
464  fprintf( m_fp, " )\n\n" );
465 }
466 
467 
469  const wxPoint& aOffset )
470 {
471  SHAPE_POLY_SET polys = aPolys;
472 
473  // Cleanup the polygon
475 
476  // Ensure the polygon is valid:
477  if( polys.OutlineCount() == 0 )
478  return;
479 
481 
482  SHAPE_LINE_CHAIN& poly = polys.Outline( 0 );
483 
484  fprintf( m_fp, "(gr_poly (pts " );
485 
486  #define MAX_COORD_CNT 4
487  int jj = MAX_COORD_CNT;
488  int cnt_max = poly.PointCount() -1;
489 
490  // Do not generate last corner, if it is the same point as the first point:
491  if( poly.CPoint( 0 ) == poly.CPoint( cnt_max ) )
492  cnt_max--;
493 
494  for( int ii = 0; ii <= cnt_max; ii++ )
495  {
496  if( --jj == 0 )
497  {
498  jj = MAX_COORD_CNT;
499  fprintf( m_fp, "\n" );
500  }
501 
502  fprintf( m_fp, " (xy %s %s)",
503  Double2Str( MapToPcbUnits( poly.CPoint( ii ).x + aOffset.x ) ).c_str(),
504  Double2Str( MapToPcbUnits( -poly.CPoint( ii ).y + aOffset.y ) ).c_str() );
505  }
506 
507  fprintf( m_fp, ")" );
508 
509  if( jj != MAX_COORD_CNT )
510  fprintf( m_fp, "\n" );
511 
512  fprintf( m_fp, "(layer %s) (width 0) )\n",
513  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
514 }
515 
516 
518 {
519  SHAPE_POLY_SET polys = aGbrItem->m_Polygon;
521 
522  if( polys.OutlineCount() == 0 )
523  return;
524 
525  fprintf( m_fp, "(zone (net 0) (net_name \"\") (layer %s) (tstamp 0000000) (hatch edge 0.508)\n",
526  TO_UTF8( GetPCBDefaultLayerName( aLayer ) ) );
527 
528  fprintf( m_fp, " (connect_pads (clearance 0.0))\n" );
529 
530  fprintf( m_fp, " (min_thickness 0.1) (filled_areas_thickness no)\n"
531  " (fill (thermal_gap 0.3) (thermal_bridge_width 0.3))\n" );
532 
533  // Now, write the zone outlines with holes.
534  // first polygon is the main outline, next are holes
535  // One cannot know the initial zone outline.
536  // However most of (if not all) holes are just items with clearance,
537  // not really a hole in the initial zone outline.
538  // So we build a zone outline only with no hole.
539  fprintf( m_fp, " (polygon\n (pts" );
540 
541  SHAPE_LINE_CHAIN& poly = polys.Outline( 0 );
542 
543  #define MAX_COORD_CNT 4
544  int jj = MAX_COORD_CNT;
545  int cnt_max = poly.PointCount() -1;
546 
547  // Do not generate last corner, if it is the same point as the first point:
548  if( poly.CPoint( 0 ) == poly.CPoint( cnt_max ) )
549  cnt_max--;
550 
551  for( int ii = 0; ii <= cnt_max; ii++ )
552  {
553  if( --jj == 0 )
554  {
555  jj = MAX_COORD_CNT;
556  fprintf( m_fp, "\n " );
557  }
558 
559  fprintf( m_fp, " (xy %s %s)", Double2Str( MapToPcbUnits( poly.CPoint( ii ).x ) ).c_str(),
560  Double2Str( MapToPcbUnits( -poly.CPoint( ii ).y ) ).c_str() );
561  }
562 
563  fprintf( m_fp, ")\n" );
564 
565  fprintf( m_fp, " )\n)\n" );
566 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
double MapToPcbUnits(int aValue) const
In Pcbnew files units are mm for coordinates.
std::vector< EXPORT_VIA > m_vias
D_CODE * GetDcodeDescr() const
Return the GetDcodeDescr of this object, or NULL.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
void writePcbPolygon(const SHAPE_POLY_SET &aPolys, LAYER_NUM aLayer, const wxPoint &aOffset={ 0, 0 })
write a non-copper polygon to the board file.
GERBER_DRAW_ITEMS & GetItems()
This file is part of the common library.
GBR_TO_PCB_EXPORTER(GERBVIEW_FRAME *aFrame, const wxString &aFileName)
double RAD2DEG(double rad)
Definition: trigo.h:232
Hold the image data and parameters for one gerber file and layer parameters.
double RAD2DECIDEG(double rad)
Definition: trigo.h:236
void export_via(const EXPORT_VIA &aVia)
write a via to the board file.
#define DELTA_ANGLE
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
int PointCount() const
Function PointCount()
SHAPE_POLY_SET m_Polygon
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
const VECTOR2I & CPoint(int aIndex) const
Function Point()
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Return the image position of aPosition for this object.
#define NULL
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
wxString GetBuildVersion()
Get the full KiCad version string.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
void export_copper_item(const GERBER_DRAW_ITEM *aGbrItem, LAYER_NUM aLayer)
write a track (or via) to the board file.
GERBVIEW_FRAME * m_gerbview_frame
Definition of file extensions used in Kicad.
void collect_hole(const GERBER_DRAW_ITEM *aGbrItem)
collect holes from a drill layer.
void Simplify(POLYGON_MODE aFastMode)
void export_flashed_copper_item(const GERBER_DRAW_ITEM *aGbrItem, LAYER_NUM aLayer)
Function export_flashed_copper_item write a synthetic pad to the board file.
void export_segline_copper_item(const GERBER_DRAW_ITEM *aGbrItem, LAYER_NUM aLayer)
Function export_segline_copper_item write a track (not via) to the board file.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
void export_segarc_copper_item(const GERBER_DRAW_ITEM *aGbrItem, LAYER_NUM aLayer)
Function export_segarc_copper_item write a set of tracks (arcs are approximated by track segments) to...
int LAYER_NUM
This can be replaced with int and removed.
GBR_LAYOUT * GetGerberLayout() const
void writePcbZoneItem(const GERBER_DRAW_ITEM *aGbrItem, LAYER_NUM aLayer)
write a zone item to the board file.
void export_non_copper_item(const GERBER_DRAW_ITEM *aGbrItem, LAYER_NUM aLayer)
write a non copper line or arc to the board file.
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void writeCopperLineItem(const wxPoint &aStart, const wxPoint &aEnd, int aWidth, LAYER_NUM aLayer)
function writeCopperLineItem basic write function to write a a TRACK item to the board file,...
#define MAX_COORD_CNT
#define _(s)
Definition: 3d_actions.cpp:33
SHAPE_LINE_CHAIN.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
const wxString GetPCBDefaultLayerName(LAYER_NUM aLayerNumber)
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:41
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:107
bool ExportPcb(const LAYER_NUM *aLayerLookUpTable, int aCopperLayers)
Function ExportPcb saves a board from a set of Gerber images.
void ConvertShapeToPolygon()
Function ConvertShapeToPolygon convert a shape to an equivalent polygon.
Definition: dcode.cpp:300
bool IsPcbLayer(LAYER_NUM aLayer)
Test whether a layer is a valid layer for Pcbnew.
void writePcbHeader(const LAYER_NUM *aLayerLookUpTable)
function writePcbHeader Write a very basic header to the board file
std::string Double2Str(double aValue)
Prints a float number without using scientific notation and no trailing 0 We want to avoid scientific...
Definition: string.cpp:873