KiCad PCB EDA Suite
excellon_read_drill_file.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-2016 Jean-Pierre Charras <jp.charras at wanadoo.fr>
5  * Copyright (C) 1992-2016 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 
25 /*
26  * Here is a sample of drill files created by Pcbnew, in decimal format:
27  * (Note: coordinates formats are same as Gerber, and T commands are near Gerber D commands).
28  * M48
29  * ;DRILL file {PCBnew (2011-03-14 BZR 2894)-testing} date 15/03/2011 14:23:22
30  * ;FORMAT={-:-/ absolute / inch / decimal}
31  * FMAT,2
32  * INCH,TZ
33  * T1C0.02
34  * T2C0.032
35  * %
36  * G90
37  * G05
38  * M72
39  * T1
40  * X1.580Y-1.360
41  * X1.580Y-4.860
42  * X8.680Y-1.360
43  * X8.680Y-4.860
44  * T2
45  * X2.930Y-3.560
46  * X5.280Y-2.535
47  * X5.405Y-2.610
48  * X5.620Y-2.900
49  * T0
50  * M30
51  */
52  /*
53  * Note there are some variant of tool definition:
54  * T1F00S00C0.2 or T1C0.02F00S00 ... Feed Rate and Spindle Speed of Tool 1
55  * Feed Rate and Spindle Speed are just skipped because they are not used in a viewer
56  */
57 
65 #include <fctsys.h>
66 #include <common.h>
67 #include <confirm.h>
68 
69 #include <gerbview.h>
70 #include <gerbview_frame.h>
73 #include <class_excellon.h>
74 #include <kicad_string.h>
76 
77 #include <cmath>
78 
79 #include <html_messagebox.h>
80 
81 // Default format for dimensions: they are the default values, not the actual values
82 // number of digits in mantissa:
83 static const int fmtMantissaMM = 3;
84 static const int fmtMantissaInch = 4;
85 // number of digits, integer part:
86 static const int fmtIntegerMM = 3;
87 static const int fmtIntegerInch = 2;
88 
89 extern int ReadInt( char*& text, bool aSkipSeparator = true );
90 extern double ReadDouble( char*& text, bool aSkipSeparator = true );
91 
92 // See ds274d.cpp:
93 extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
94  APERTURE_T aAperture,
95  int Dcode_index,
96  const wxPoint& aPos,
97  wxSize aSize,
98  bool aLayerNegative );
99 void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
100  int Dcode_index,
101  const wxPoint& aStart,
102  const wxPoint& aEnd,
103  wxSize aPenSize,
104  bool aLayerNegative );
105 
106 // Getber X2 files have a file attribute which specify the type of image
107 // (copper, solder paste ... and sides tpo, bottom or inner copper layers)
108 // Excellon drill files do not have attributes, so, just to identify the image
109 // In gerbview, we add this attribute, like a Gerber drill file
110 static const char file_attribute[] = ".FileFunction,Other,Drill*";
111 
113 {
114  { "M0", DRILL_M_END, -1 }, // End of Program - No Rewind
115  { "M00", DRILL_M_END, -1 }, // End of Program - No Rewind
116  { "M30", DRILL_M_ENDREWIND, -1 }, // End of Program Rewind
117  { "M47", DRILL_M_MESSAGE, -1 }, // Operator Message
118  { "M45", DRILL_M_LONGMESSAGE, -1 }, // Long Operator message (use more than one line)
119  { "M48", DRILL_M_HEADER, 0 }, // beginning of a header
120  { "M95", DRILL_M_ENDHEADER, 0 }, // End of the header
121  { "METRIC", DRILL_METRICHEADER, 1 },
122  { "INCH", DRILL_IMPERIALHEADER, 1 },
123  { "M71", DRILL_M_METRIC, 1 },
124  { "M72", DRILL_M_IMPERIAL, 1 },
125  { "M25", DRILL_M_BEGINPATTERN, 0 }, // Beginning of Pattern
126  { "M01", DRILL_M_ENDPATTERN, 0 }, // End of Pattern
127  { "M97", DRILL_M_CANNEDTEXT, -1 },
128  { "M98", DRILL_M_CANNEDTEXT, -1 },
129  { "DETECT", DRILL_DETECT_BROKEN, -1 },
130  { "ICI", DRILL_INCREMENTALHEADER, 1 },
131  { "FMAT", DRILL_FMT, 1 }, // Use Format command
132  { "ATC", DRILL_AUTOMATIC_TOOL_CHANGE, 0 },
133  { "TCST", DRILL_TOOL_CHANGE_STOP, 0 }, // Tool Change Stop
134  { "AFS", DRILL_AUTOMATIC_SPEED }, // Automatic Feeds and Speeds
135  { "VER", DRILL_AXIS_VERSION, 1 }, // Selection of X and Y Axis Version
136  { "R", DRILL_RESET_CMD, -1 }, // Reset commands
137  { "%", DRILL_REWIND_STOP, -1 }, // Rewind stop. End of the header
138  { "/", DRILL_SKIP, -1 }, // Clear Tool Linking. End of the header
139  // Keep this item after all commands starting by 'T':
140  { "T", DRILL_TOOL_INFORMATION, 0 }, // Tool Information
141  { "", DRILL_M_UNKNOWN, 0 } // last item in list
142 };
143 
145 {
146  { "G90", DRILL_G_ABSOLUTE, 0 }, // Absolute Mode
147  { "G91", DRILL_G_INCREMENTAL, 0 }, // Incremental Input Mode
148  { "G90", DRILL_G_ZEROSET, 0 }, // Absolute Mode
149  { "G00", DRILL_G_ROUT, 1 }, // Route Mode
150  { "G05", DRILL_G_DRILL, 0 }, // Drill Mode
151  { "G85", DRILL_G_SLOT, 0 }, // Drill Mode slot (oval holes)
152  { "G01", DRILL_G_LINEARMOVE, 0 }, // Linear (Straight Line) Mode
153  { "G02", DRILL_G_CWMOVE, 0 }, // Circular CW Mode
154  { "G03", DRILL_G_CCWMOVE, 0 }, // Circular CCW Mode
155  { "G93", DRILL_G_ZERO_SET, 1 }, // Zero Set (XnnYmm and coordintes origin)
156  { "", DRILL_G_UNKNOWN, 0 }, // last item in list
157 };
158 
159 
160 bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
161 {
162  wxString msg;
163  int layerId = getActiveLayer(); // current layer used in GerbView
165  EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) images->GetGbrImage( layerId );
166 
167  if( drill_Layer == NULL )
168  {
169  drill_Layer = new EXCELLON_IMAGE( layerId );
170  layerId = images->AddGbrImage( drill_Layer, layerId );
171  }
172 
173  if( layerId < 0 )
174  {
175  DisplayError( this, _( "No room to load file" ) );
176  return false;
177  }
178 
179  // Read the Excellon drill file:
180  bool success = drill_Layer->LoadFile( aFullFileName );
181 
182  if( !success )
183  {
184  msg.Printf( _( "File %s not found" ), GetChars( aFullFileName ) );
185  DisplayError( this, msg );
186  return false;
187  }
188 
189  // Display errors list
190  if( drill_Layer->GetMessages().size() > 0 )
191  {
192  HTML_MESSAGE_BOX dlg( this, _( "Error reading EXCELLON drill file" ) );
193  dlg.ListSet( drill_Layer->GetMessages() );
194  dlg.ShowModal();
195  }
196  return success;
197 }
198 
199 /*
200  * Read a EXCELLON file.
201  * Gerber classes are used because there is likeness between Gerber files
202  * and Excellon files
203  * DCode can easily store T code (tool size) as round (or oval) shape
204  * Drill commands are similar to flashed gerber items
205  * Routing commands are similar to Gerber polygons
206  * coordinates have the same format as Gerber, can be given in:
207  * decimal format (i.i. floating notation format)
208  * integer 2.4 format in imperial units,
209  * integer 3.2 or 3.3 format (metric units).
210  */
211 
212 bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
213 {
214  // Set the default parmeter values:
217 
218  m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
219 
220  if( m_Current_File == NULL )
221  return false;
222 
223  m_FileName = aFullFileName;
224 
225  LOCALE_IO toggleIo;
226 
227  // FILE_LINE_READER will close the file.
228  FILE_LINE_READER excellonReader( m_Current_File, m_FileName );
229 
230  while( true )
231  {
232  if( excellonReader.ReadLine() == 0 )
233  break;
234 
235  char* line = excellonReader.Line();
236  char* text = StrPurge( line );
237 
238  if( *text == ';' ) // comment: skip line
239  continue;
240 
242  {
243  Execute_HEADER_Command( text );
244  }
245  else
246  {
247  switch( *text )
248  {
249  case 'M':
250  Execute_HEADER_Command( text );
251  break;
252 
253  case 'G': /* Line type Gxx : command */
255  break;
256 
257  case 'X':
258  case 'Y': // command like X12550Y19250
259  Execute_Drill_Command(text);
260  break;
261 
262  case 'I':
263  case 'J': /* Auxiliary Move command */
264  m_IJPos = ReadIJCoord( text );
265  if( *text == '*' ) // command like X35142Y15945J504
266  {
267  Execute_Drill_Command( text);
268  }
269  break;
270 
271  case 'T': // Tool command
272  Select_Tool( text );
273  break;
274 
275  case '%':
276  break;
277 
278  default:
279  {
280  wxString msg;
281  msg.Printf( wxT( "Unexpected symbol &lt;%c&gt;" ), *text );
282  AddMessageToList( msg );
283  }
284  break;
285  } // End switch
286  }
287  }
288 
289  // Add our file attribute, to identify the drill file
291  char* text = (char*)file_attribute;
292  dummy.ParseAttribCmd( m_Current_File, NULL, 0, text );
293  delete m_FileFunction;
295 
296  m_InUse = true;
297 
298  return true;
299 }
300 
301 
303 {
304  EXCELLON_CMD* cmd = NULL;
305  wxString msg;
306 
307  // Search command in list
308  for( unsigned ii = 0; ; ii++ )
309  {
310  EXCELLON_CMD* candidate = &excellonHeaderCmdList[ii];
311  int len = candidate->m_Name.size();
312 
313  if( len == 0 ) // End of list reached
314  break;
315 
316  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
317  {
318  cmd = candidate;
319  text += len;
320  break;
321  }
322  }
323 
324  if( !cmd )
325  {
326  msg.Printf( wxT( "Unknown Excellon command &lt;%s&gt;" ), text );
327  AddMessageToList( msg );
328  while( *text )
329  text++;
330 
331  return false;
332  }
333 
334  // Execute command
335  // some do nothing
336  switch( cmd->m_Code )
337  {
338  case DRILL_SKIP:
339  case DRILL_M_UNKNOWN:
340  break;
341 
342  case DRILL_M_END:
343  break;
344 
345  case DRILL_M_ENDREWIND:
346  break;
347 
348  case DRILL_M_MESSAGE:
349  break;
350 
351  case DRILL_M_LONGMESSAGE:
352  break;
353 
354  case DRILL_M_HEADER:
356  break;
357 
358  case DRILL_M_ENDHEADER:
360  break;
361 
362  case DRILL_REWIND_STOP: // End of header. No action in a viewer
364  break;
365 
366  case DRILL_M_METRIC:
367  SelectUnits( true );
368  break;
369 
370  case DRILL_METRICHEADER: // command like METRIC,TZ or METRIC,LZ
371  SelectUnits( true );
372  if( *text != ',' )
373  {
374  AddMessageToList( _( "METRIC command has no parameter" ) );
375  break;
376  }
377  text++; // skip separator
378  if( *text == 'T' )
379  m_NoTrailingZeros = false;
380  else
381  m_NoTrailingZeros = true;
382  break;
383 
384  case DRILL_M_IMPERIAL:
385  SelectUnits( false );
386  break;
387 
388  case DRILL_IMPERIALHEADER: // command like INCH,TZ or INCH,LZ
389  SelectUnits( false );
390  if( *text != ',' )
391  {
392  AddMessageToList( _( "INCH command has no parameter" ) );
393  break;
394  }
395  text++; // skip separator
396  if( *text == 'T' )
397  m_NoTrailingZeros = false;
398  else
399  m_NoTrailingZeros = true;
400  break;
401 
403  break;
404 
405  case DRILL_M_ENDPATTERN:
406  break;
407 
408  case DRILL_M_CANNEDTEXT:
409  break;
410 
411  case DRILL_M_TIPCHECK:
412  break;
413 
414  case DRILL_DETECT_BROKEN:
415  break;
416 
418  if( *text != ',' )
419  {
420  AddMessageToList( _( "ICI command has no parameter" ) );
421  break;
422  }
423  text++; // skip separator
424  // Parameter should be ON or OFF
425  if( strncasecmp( text, "OFF", 3 ) == 0 )
426  m_Relative = false;
427  else if( strncasecmp( text, "ON", 2 ) == 0 )
428  m_Relative = true;
429  else
430  AddMessageToList( _( "ICI command has incorrect parameter" ) );
431  break;
432 
434  break;
435 
437  break;
438 
439  case DRILL_AXIS_VERSION:
440  break;
441 
442  case DRILL_RESET_CMD:
443  break;
444 
446  break;
447 
448  case DRILL_FMT:
449  break;
450 
452  readToolInformation( text );
453  break;
454  }
455 
456  while( *text )
457  text++;
458 
459  return true;
460 }
461 
462 
464 {
465  // Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00
466  // and enter the TCODE param in list (using the D_CODE param management, which
467  // is similar to TCODE params.
468  if( *aText == 'T' ) // This is the beginning of the definition
469  aText++;
470 
471  // Read tool number:
472  int iprm = ReadInt( aText, false );
473 
474  // Skip Feed rate and Spindle speed, if any here
475  while( *aText && ( *aText == 'F' || *aText == 'S' ) )
476  {
477  aText++;
478  ReadInt( aText, false );
479  }
480 
481  // Read tool shape
482  if( ! *aText )
484  _( "Tool definition shape not found" ) ) );
485  else if( *aText != 'C' )
487  _( "Tool definition '%c' not supported" ), *aText ) );
488  if( *aText )
489  aText++;
490 
491  //read tool diameter:
492  double dprm = ReadDouble( aText, false );
493  m_Has_DCode = true;
494 
495  // Initialize Dcode to handle this Tool
496  // Remember: dcodes are >= FIRST_DCODE
497  D_CODE* dcode = GetDCODE( iprm + FIRST_DCODE );
498 
499  if( dcode == NULL )
500  return false;
501 
502  // conv_scale = scaling factor from inch to Internal Unit
503  double conv_scale = IU_PER_MILS * 1000;
504 
505  if( m_GerbMetric )
506  conv_scale /= 25.4;
507 
508  dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
509  dcode->m_Shape = APT_CIRCLE;
510  dcode->m_Defined = true;
511 
512  return true;
513 }
514 
516 {
517  D_CODE* tool;
518  GERBER_DRAW_ITEM * gbritem;
519 
520  while( true )
521  {
522  switch( *text )
523  {
524  case 'X':
525  ReadXYCoord( text );
526  break;
527  case 'Y':
528  ReadXYCoord( text );
529  break;
530  case 'G': // G85 is found here for oval holes
533  break;
534  case 0: // E.O.L: execute command
535  tool = GetDCODE( m_Current_Tool, false );
536 
537  if( !tool )
538  {
539  wxString msg;
540  msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
541  AddMessageToList( msg );
542  return false;
543  }
544 
545  gbritem = new GERBER_DRAW_ITEM( this );
546  m_Drawings.Append( gbritem );
547 
548  if( m_SlotOn ) // Oblong hole
549  {
550  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
552  tool->m_Size, false );
553  // the hole is made: reset the slot on command (G85)
554  // (it is needed for each oblong hole)
555  m_SlotOn = false;
556  }
557  else
558  {
559  fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
560  m_CurrentPos, tool->m_Size, false );
561  }
562 
563  StepAndRepeatItem( *gbritem );
565  return true;
566  break;
567 
568  default:
569  text++;
570  break;
571  }
572  }
573 
574  return true;
575 }
576 
577 
578 bool EXCELLON_IMAGE::Select_Tool( char*& text )
579 {
580  // Select the tool from the command line Tn, with n = 1 ... TOOLS_MAX_COUNT - 1
581  // Because some drill file have an embedded TCODE definition (like T1C.008F0S0)
582  // in tool selection command, if the tool is not defined in list,
583  // and the definition is embedded, it will be entered in list
584  char * startline = text; // the tool id starts here.
585  int tool_id = TCodeNumber( text );
586 
587  // T0 is legal, but is not a selection tool. it is a special command
588  if( tool_id >= 0 )
589  {
590  int dcode_id = tool_id + FIRST_DCODE; // Remember: dcodes are >= FIRST_DCODE
591 
592  if( dcode_id > (TOOLS_MAX_COUNT - 1) )
593  dcode_id = TOOLS_MAX_COUNT - 1;
594 
595  m_Current_Tool = dcode_id;
596  D_CODE* currDcode = GetDCODE( dcode_id , false );
597 
598  if( currDcode == NULL && tool_id > 0 ) // if the definition is embedded, enter it
599  {
600  text = startline; // text starts at the beginning of the command
601  readToolInformation( text );
602  currDcode = GetDCODE( dcode_id , false );
603  }
604 
605  if( currDcode )
606  currDcode->m_InUse = true;
607  }
608 
609  while( *text )
610  text++;
611 
612  return tool_id >= 0;
613 }
614 
615 
617 {
618  EXCELLON_CMD* cmd = NULL;
619  bool success = false;
620  int id = DRILL_G_UNKNOWN;
621 
622  // Search command in list
623  EXCELLON_CMD* candidate;
624  char * gcmd = text; // gcmd points the G command, for error messages.
625 
626  for( unsigned ii = 0; ; ii++ )
627  {
628  candidate = &excellon_G_CmdList[ii];
629  int len = candidate->m_Name.size();
630  if( len == 0 ) // End of list reached
631  break;
632  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
633  {
634  cmd = candidate;
635  text += len;
636  success = true;
637  id = cmd->m_Code;
638  break;
639  }
640  }
641 
642  switch( id )
643  {
644  case DRILL_G_ZERO_SET:
645  ReadXYCoord( text );
647  break;
648 
649  case DRILL_G_ROUT:
650  m_SlotOn = false;
651  m_PolygonFillMode = true;
652  break;
653 
654  case DRILL_G_DRILL:
655  m_SlotOn = false;
656  m_PolygonFillMode = false;
657  break;
658 
659  case DRILL_G_SLOT:
660  m_SlotOn = true;
661  break;
662 
663  case DRILL_G_LINEARMOVE:
665  break;
666 
667  case DRILL_G_CWMOVE:
669  break;
670 
671  case DRILL_G_CCWMOVE:
673  break;
674 
675  case DRILL_G_ABSOLUTE:
676  m_Relative = false; // false = absolute coord
677  break;
678 
679  case DRILL_G_INCREMENTAL:
680  m_Relative = true; // true = relative coord
681  break;
682 
683  case DRILL_G_UNKNOWN:
684  default:
685  {
686  wxString msg;
687  msg.Printf( _( "Unknown Excellon G Code: &lt;%s&gt;" ), GetChars(FROM_UTF8(gcmd)) );
688  AddMessageToList( msg );
689  while( *text )
690  text++;
691  return false;
692  }
693  }
694  return success;
695 }
696 
697 void EXCELLON_IMAGE::SelectUnits( bool aMetric )
698 {
699  /* Coordinates are measured either in inch or metric (millimeters).
700  * Inch coordinates are in six digits (00.0000) with increments
701  * as small as 0.0001 (1/10,000).
702  * Metric coordinates can be measured in microns (thousandths of a millimeter)
703  * in one of the following three ways:
704  * Five digit 10 micron resolution (000.00)
705  * Six digit 10 micron resolution (0000.00)
706  * Six digit micron resolution (000.000)
707  *
708  * Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
709  * metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
710  */
711  if( aMetric )
712  {
713  m_GerbMetric = true;
714  // number of digits in mantissa
716  // number of digits (mantissa+interger)
718  }
719  else
720  {
721  m_GerbMetric = false;
724  }
725 }
GERBER_FILE_IMAGE_LIST * GetImagesList()
static EXCELLON_CMD excellon_G_CmdList[]
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF...
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
char * ReadLine() override
Function ReadLine reads a line of text into the buffer and increments the line number counter...
Definition: richio.cpp:196
class X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma ...
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
char * StrPurge(char *text)
Function StrPurge removes leading and training spaces, tabs and end of line chars in text return a po...
Definition: string.cpp:194
virtual void ResetDefaultValues() override
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
wxPoint ReadXYCoord(char *&Text)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) ...
This file is part of the common library.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:98
wxPoint ReadIJCoord(char *&Text)
Function ReadIJCoord Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These...
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:106
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:99
static EXCELLON_CMD excellonHeaderCmdList[]
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
static const int fmtMantissaInch
static const int fmtIntegerInch
D_CODE * GetDCODE(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
static const int fmtMantissaMM
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const wxPoint &aPos, wxSize aSize, bool aLayerNegative)
Function fillFlashedGBRITEM initializes a given GBRITEM so that it can draw a circle which is filled ...
Definition: rs274d.cpp:108
void ClearMessageList()
Function ClearMessageList Clear the message list Call it before reading a Gerber file.
bool Select_Tool(char *&text)
int AddGbrImage(GERBER_FILE_IMAGE *aGbrImage, int aIdx)
Add a GERBER_FILE_IMAGE* at index aIdx or at the first free location if aIdx < 0. ...
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
bool Execute_HEADER_Command(char *&text)
bool LoadFile(const wxString &aFullFileName)
Read and load a drill (EXCELLON format) file.
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:108
Class FILE_LINE_READER is a LINE_READER that reads from an open file.
Definition: richio.h:180
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
#define FIRST_DCODE
Definition: dcode.h:70
char * Line() const
Function Line returns a pointer to the last line that was read in.
Definition: richio.h:139
APERTURE_T
Enum APERTURE_T is the set of all gerber aperture types allowed, according to page 16 of http://gerbv...
Definition: dcode.h:49
void ListSet(const wxString &aList)
Function ListSet Add a list of items.
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:100
const wxArrayString & GetMessages() const
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
static const int fmtIntegerMM
bool Execute_Drill_Command(char *&text)
GBR_LAYOUT * GetGerberLayout() const
std::string m_Name
Class HTML_MESSAGE_BOX.
excellon_state m_State
static const char file_attribute[]
int TCodeNumber(char *&aText)
bool readToolInformation(char *&aText)
Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list...
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:81
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...
DLIST< GERBER_DRAW_ITEM > m_Drawings
double ReadDouble(char *&text, bool aSkipSeparator=true)
Function ReadDouble reads a double from an ASCII character buffer.
int getActiveLayer()
Function getActiveLayer returns the active layer.
#define TOOLS_MAX_COUNT
Definition: dcode.h:72
The common library.
bool Execute_EXCELLON_G_Command(char *&text)
void SelectUnits(bool aMetric)
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Function fillLineGBRITEM initializes a given GBRITEM so that it can draw a linear D code...
Definition: rs274d.cpp:161
bool Read_EXCELLON_File(const wxString &aFullFileName)
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.