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 #include <view/view.h>
77 
78 #include <cmath>
79 
80 #include <html_messagebox.h>
81 
82 // Default format for dimensions: they are the default values, not the actual values
83 // number of digits in mantissa:
84 static const int fmtMantissaMM = 3;
85 static const int fmtMantissaInch = 4;
86 // number of digits, integer part:
87 static const int fmtIntegerMM = 3;
88 static const int fmtIntegerInch = 2;
89 
90 extern int ReadInt( char*& text, bool aSkipSeparator = true );
91 extern double ReadDouble( char*& text, bool aSkipSeparator = true );
92 
93 // See ds274d.cpp:
94 extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
95  APERTURE_T aAperture,
96  int Dcode_index,
97  const wxPoint& aPos,
98  wxSize aSize,
99  bool aLayerNegative );
100 void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem,
101  int Dcode_index,
102  const wxPoint& aStart,
103  const wxPoint& aEnd,
104  wxSize aPenSize,
105  bool aLayerNegative );
106 
107 // Getber X2 files have a file attribute which specify the type of image
108 // (copper, solder paste ... and sides tpo, bottom or inner copper layers)
109 // Excellon drill files do not have attributes, so, just to identify the image
110 // In gerbview, we add this attribute, like a Gerber drill file
111 static const char file_attribute[] = ".FileFunction,Other,Drill*";
112 
114 {
115  { "M0", DRILL_M_END, -1 }, // End of Program - No Rewind
116  { "M00", DRILL_M_END, -1 }, // End of Program - No Rewind
117  { "M30", DRILL_M_ENDREWIND, -1 }, // End of Program Rewind
118  { "M47", DRILL_M_MESSAGE, -1 }, // Operator Message
119  { "M45", DRILL_M_LONGMESSAGE, -1 }, // Long Operator message (use more than one line)
120  { "M48", DRILL_M_HEADER, 0 }, // beginning of a header
121  { "M95", DRILL_M_ENDHEADER, 0 }, // End of the header
122  { "METRIC", DRILL_METRICHEADER, 1 },
123  { "INCH", DRILL_IMPERIALHEADER, 1 },
124  { "M71", DRILL_M_METRIC, 1 },
125  { "M72", DRILL_M_IMPERIAL, 1 },
126  { "M25", DRILL_M_BEGINPATTERN, 0 }, // Beginning of Pattern
127  { "M01", DRILL_M_ENDPATTERN, 0 }, // End of Pattern
128  { "M97", DRILL_M_CANNEDTEXT, -1 },
129  { "M98", DRILL_M_CANNEDTEXT, -1 },
130  { "DETECT", DRILL_DETECT_BROKEN, -1 },
131  { "ICI", DRILL_INCREMENTALHEADER, 1 },
132  { "FMAT", DRILL_FMT, 1 }, // Use Format command
133  { "ATC", DRILL_AUTOMATIC_TOOL_CHANGE, 0 },
134  { "TCST", DRILL_TOOL_CHANGE_STOP, 0 }, // Tool Change Stop
135  { "AFS", DRILL_AUTOMATIC_SPEED }, // Automatic Feeds and Speeds
136  { "VER", DRILL_AXIS_VERSION, 1 }, // Selection of X and Y Axis Version
137  { "R", DRILL_RESET_CMD, -1 }, // Reset commands
138  { "%", DRILL_REWIND_STOP, -1 }, // Rewind stop. End of the header
139  { "/", DRILL_SKIP, -1 }, // Clear Tool Linking. End of the header
140  // Keep this item after all commands starting by 'T':
141  { "T", DRILL_TOOL_INFORMATION, 0 }, // Tool Information
142  { "", DRILL_M_UNKNOWN, 0 } // last item in list
143 };
144 
146 {
147  { "G90", DRILL_G_ABSOLUTE, 0 }, // Absolute Mode
148  { "G91", DRILL_G_INCREMENTAL, 0 }, // Incremental Input Mode
149  { "G90", DRILL_G_ZEROSET, 0 }, // Absolute Mode
150  { "G00", DRILL_G_ROUT, 1 }, // Route Mode
151  { "G05", DRILL_G_DRILL, 0 }, // Drill Mode
152  { "G85", DRILL_G_SLOT, 0 }, // Drill Mode slot (oval holes)
153  { "G01", DRILL_G_LINEARMOVE, 0 }, // Linear (Straight Line) Mode
154  { "G02", DRILL_G_CWMOVE, 0 }, // Circular CW Mode
155  { "G03", DRILL_G_CCWMOVE, 0 }, // Circular CCW Mode
156  { "G93", DRILL_G_ZERO_SET, 1 }, // Zero Set (XnnYmm and coordintes origin)
157  { "", DRILL_G_UNKNOWN, 0 }, // last item in list
158 };
159 
160 
161 bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
162 {
163  wxString msg;
164  int layerId = GetActiveLayer(); // current layer used in GerbView
166  EXCELLON_IMAGE* drill_Layer = (EXCELLON_IMAGE*) images->GetGbrImage( layerId );
167 
168  if( drill_Layer == NULL )
169  {
170  drill_Layer = new EXCELLON_IMAGE( layerId );
171  layerId = images->AddGbrImage( drill_Layer, layerId );
172  }
173 
174  if( layerId < 0 )
175  {
176  DisplayError( this, _( "No room to load file" ) );
177  return false;
178  }
179 
180  // Read the Excellon drill file:
181  bool success = drill_Layer->LoadFile( aFullFileName );
182 
183  if( !success )
184  {
185  msg.Printf( _( "File %s not found" ), GetChars( aFullFileName ) );
186  DisplayError( this, msg );
187  return false;
188  }
189 
190  // Display errors list
191  if( drill_Layer->GetMessages().size() > 0 )
192  {
193  HTML_MESSAGE_BOX dlg( this, _( "Error reading EXCELLON drill file" ) );
194  dlg.ListSet( drill_Layer->GetMessages() );
195  dlg.ShowModal();
196  }
197 
198  // TODO(JE) Is this the best place to add items to the view?
199  if( success )
200  {
201  EDA_DRAW_PANEL_GAL* canvas = GetGalCanvas();
202 
203  if( canvas )
204  {
205  KIGFX::VIEW* view = canvas->GetView();
206 
207  for( GERBER_DRAW_ITEM* item = drill_Layer->GetItemsList(); item; item = item->Next() )
208  {
209  view->Add( (KIGFX::VIEW_ITEM*) item );
210  }
211  }
212  }
213 
214  return success;
215 }
216 
217 /*
218  * Read a EXCELLON file.
219  * Gerber classes are used because there is likeness between Gerber files
220  * and Excellon files
221  * DCode can easily store T code (tool size) as round (or oval) shape
222  * Drill commands are similar to flashed gerber items
223  * Routing commands are similar to Gerber polygons
224  * coordinates have the same format as Gerber, can be given in:
225  * decimal format (i.i. floating notation format)
226  * integer 2.4 format in imperial units,
227  * integer 3.2 or 3.3 format (metric units).
228  */
229 
230 bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
231 {
232  // Set the default parmeter values:
235 
236  m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
237 
238  if( m_Current_File == NULL )
239  return false;
240 
241  m_FileName = aFullFileName;
242 
243  LOCALE_IO toggleIo;
244 
245  // FILE_LINE_READER will close the file.
246  FILE_LINE_READER excellonReader( m_Current_File, m_FileName );
247 
248  while( true )
249  {
250  if( excellonReader.ReadLine() == 0 )
251  break;
252 
253  char* line = excellonReader.Line();
254  char* text = StrPurge( line );
255 
256  if( *text == ';' ) // comment: skip line
257  continue;
258 
260  {
261  Execute_HEADER_Command( text );
262  }
263  else
264  {
265  switch( *text )
266  {
267  case 'M':
268  Execute_HEADER_Command( text );
269  break;
270 
271  case 'G': /* Line type Gxx : command */
273  break;
274 
275  case 'X':
276  case 'Y': // command like X12550Y19250
277  Execute_Drill_Command(text);
278  break;
279 
280  case 'I':
281  case 'J': /* Auxiliary Move command */
282  m_IJPos = ReadIJCoord( text );
283  if( *text == '*' ) // command like X35142Y15945J504
284  {
285  Execute_Drill_Command( text);
286  }
287  break;
288 
289  case 'T': // Tool command
290  Select_Tool( text );
291  break;
292 
293  case '%':
294  break;
295 
296  default:
297  {
298  wxString msg;
299  msg.Printf( wxT( "Unexpected symbol &lt;%c&gt;" ), *text );
300  AddMessageToList( msg );
301  }
302  break;
303  } // End switch
304  }
305  }
306 
307  // Add our file attribute, to identify the drill file
309  char* text = (char*)file_attribute;
310  int dummyline = 0;
311  dummy.ParseAttribCmd( m_Current_File, NULL, 0, text, dummyline );
312  delete m_FileFunction;
314 
315  m_InUse = true;
316 
317  return true;
318 }
319 
320 
322 {
323  EXCELLON_CMD* cmd = NULL;
324  wxString msg;
325 
326  // Search command in list
327  for( unsigned ii = 0; ; ii++ )
328  {
329  EXCELLON_CMD* candidate = &excellonHeaderCmdList[ii];
330  int len = candidate->m_Name.size();
331 
332  if( len == 0 ) // End of list reached
333  break;
334 
335  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
336  {
337  cmd = candidate;
338  text += len;
339  break;
340  }
341  }
342 
343  if( !cmd )
344  {
345  msg.Printf( wxT( "Unknown Excellon command &lt;%s&gt;" ), text );
346  AddMessageToList( msg );
347  while( *text )
348  text++;
349 
350  return false;
351  }
352 
353  // Execute command
354  // some do nothing
355  switch( cmd->m_Code )
356  {
357  case DRILL_SKIP:
358  case DRILL_M_UNKNOWN:
359  break;
360 
361  case DRILL_M_END:
362  break;
363 
364  case DRILL_M_ENDREWIND:
365  break;
366 
367  case DRILL_M_MESSAGE:
368  break;
369 
370  case DRILL_M_LONGMESSAGE:
371  break;
372 
373  case DRILL_M_HEADER:
375  break;
376 
377  case DRILL_M_ENDHEADER:
379  break;
380 
381  case DRILL_REWIND_STOP: // End of header. No action in a viewer
383  break;
384 
385  case DRILL_M_METRIC:
386  SelectUnits( true );
387  break;
388 
389  case DRILL_METRICHEADER: // command like METRIC,TZ or METRIC,LZ
390  SelectUnits( true );
391  if( *text != ',' )
392  {
393  AddMessageToList( _( "METRIC command has no parameter" ) );
394  break;
395  }
396  text++; // skip separator
397  if( *text == 'T' )
398  m_NoTrailingZeros = false;
399  else
400  m_NoTrailingZeros = true;
401  break;
402 
403  case DRILL_M_IMPERIAL:
404  SelectUnits( false );
405  break;
406 
407  case DRILL_IMPERIALHEADER: // command like INCH,TZ or INCH,LZ
408  SelectUnits( false );
409  if( *text != ',' )
410  {
411  AddMessageToList( _( "INCH command has no parameter" ) );
412  break;
413  }
414  text++; // skip separator
415  if( *text == 'T' )
416  m_NoTrailingZeros = false;
417  else
418  m_NoTrailingZeros = true;
419  break;
420 
422  break;
423 
424  case DRILL_M_ENDPATTERN:
425  break;
426 
427  case DRILL_M_CANNEDTEXT:
428  break;
429 
430  case DRILL_M_TIPCHECK:
431  break;
432 
433  case DRILL_DETECT_BROKEN:
434  break;
435 
437  if( *text != ',' )
438  {
439  AddMessageToList( _( "ICI command has no parameter" ) );
440  break;
441  }
442  text++; // skip separator
443  // Parameter should be ON or OFF
444  if( strncasecmp( text, "OFF", 3 ) == 0 )
445  m_Relative = false;
446  else if( strncasecmp( text, "ON", 2 ) == 0 )
447  m_Relative = true;
448  else
449  AddMessageToList( _( "ICI command has incorrect parameter" ) );
450  break;
451 
453  break;
454 
456  break;
457 
458  case DRILL_AXIS_VERSION:
459  break;
460 
461  case DRILL_RESET_CMD:
462  break;
463 
465  break;
466 
467  case DRILL_FMT:
468  break;
469 
471  readToolInformation( text );
472  break;
473  }
474 
475  while( *text )
476  text++;
477 
478  return true;
479 }
480 
481 
483 {
484  // Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00
485  // and enter the TCODE param in list (using the D_CODE param management, which
486  // is similar to TCODE params.
487  if( *aText == 'T' ) // This is the beginning of the definition
488  aText++;
489 
490  // Read tool number:
491  int iprm = ReadInt( aText, false );
492 
493  // Skip Feed rate and Spindle speed, if any here
494  while( *aText && ( *aText == 'F' || *aText == 'S' ) )
495  {
496  aText++;
497  ReadInt( aText, false );
498  }
499 
500  // Read tool shape
501  if( ! *aText )
503  _( "Tool definition shape not found" ) ) );
504  else if( *aText != 'C' )
506  _( "Tool definition '%c' not supported" ), *aText ) );
507  if( *aText )
508  aText++;
509 
510  //read tool diameter:
511  double dprm = ReadDouble( aText, false );
512  m_Has_DCode = true;
513 
514  // Initialize Dcode to handle this Tool
515  // Remember: dcodes are >= FIRST_DCODE
516  D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE );
517 
518  if( dcode == NULL )
519  return false;
520 
521  // conv_scale = scaling factor from inch to Internal Unit
522  double conv_scale = IU_PER_MILS * 1000;
523 
524  if( m_GerbMetric )
525  conv_scale /= 25.4;
526 
527  dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
528  dcode->m_Shape = APT_CIRCLE;
529  dcode->m_Defined = true;
530 
531  return true;
532 }
533 
535 {
536  D_CODE* tool;
537  GERBER_DRAW_ITEM * gbritem;
538 
539  while( true )
540  {
541  switch( *text )
542  {
543  case 'X':
544  ReadXYCoord( text );
545  break;
546  case 'Y':
547  ReadXYCoord( text );
548  break;
549  case 'G': // G85 is found here for oval holes
552  break;
553  case 0: // E.O.L: execute command
554  tool = GetDCODE( m_Current_Tool );
555 
556  if( !tool )
557  {
558  wxString msg;
559  msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
560  AddMessageToList( msg );
561  return false;
562  }
563 
564  gbritem = new GERBER_DRAW_ITEM( this );
565  m_Drawings.Append( gbritem );
566 
567  if( m_SlotOn ) // Oblong hole
568  {
569  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
571  tool->m_Size, false );
572  // the hole is made: reset the slot on command (G85)
573  // (it is needed for each oblong hole)
574  m_SlotOn = false;
575  }
576  else
577  {
578  fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
579  m_CurrentPos, tool->m_Size, false );
580  }
581 
582  StepAndRepeatItem( *gbritem );
584  return true;
585  break;
586 
587  default:
588  text++;
589  break;
590  }
591  }
592 
593  return true;
594 }
595 
596 
597 bool EXCELLON_IMAGE::Select_Tool( char*& text )
598 {
599  // Select the tool from the command line Tn, with n = 1 ... TOOLS_MAX_COUNT - 1
600  // Because some drill file have an embedded TCODE definition (like T1C.008F0S0)
601  // in tool selection command, if the tool is not defined in list,
602  // and the definition is embedded, it will be entered in list
603  char * startline = text; // the tool id starts here.
604  int tool_id = TCodeNumber( text );
605 
606  // T0 is legal, but is not a selection tool. it is a special command
607  if( tool_id >= 0 )
608  {
609  int dcode_id = tool_id + FIRST_DCODE; // Remember: dcodes are >= FIRST_DCODE
610 
611  if( dcode_id > (TOOLS_MAX_COUNT - 1) )
612  dcode_id = TOOLS_MAX_COUNT - 1;
613 
614  m_Current_Tool = dcode_id;
615  D_CODE* currDcode = GetDCODEOrCreate( dcode_id, true );
616 
617  if( currDcode == NULL && tool_id > 0 ) // if the definition is embedded, enter it
618  {
619  text = startline; // text starts at the beginning of the command
620  readToolInformation( text );
621  currDcode = GetDCODE( dcode_id );
622  }
623 
624  if( currDcode )
625  currDcode->m_InUse = true;
626  }
627 
628  while( *text )
629  text++;
630 
631  return tool_id >= 0;
632 }
633 
634 
636 {
637  EXCELLON_CMD* cmd = NULL;
638  bool success = false;
639  int id = DRILL_G_UNKNOWN;
640 
641  // Search command in list
642  EXCELLON_CMD* candidate;
643  char * gcmd = text; // gcmd points the G command, for error messages.
644 
645  for( unsigned ii = 0; ; ii++ )
646  {
647  candidate = &excellon_G_CmdList[ii];
648  int len = candidate->m_Name.size();
649  if( len == 0 ) // End of list reached
650  break;
651  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
652  {
653  cmd = candidate;
654  text += len;
655  success = true;
656  id = cmd->m_Code;
657  break;
658  }
659  }
660 
661  switch( id )
662  {
663  case DRILL_G_ZERO_SET:
664  ReadXYCoord( text );
666  break;
667 
668  case DRILL_G_ROUT:
669  m_SlotOn = false;
670  m_PolygonFillMode = true;
671  break;
672 
673  case DRILL_G_DRILL:
674  m_SlotOn = false;
675  m_PolygonFillMode = false;
676  break;
677 
678  case DRILL_G_SLOT:
679  m_SlotOn = true;
680  break;
681 
682  case DRILL_G_LINEARMOVE:
684  break;
685 
686  case DRILL_G_CWMOVE:
688  break;
689 
690  case DRILL_G_CCWMOVE:
692  break;
693 
694  case DRILL_G_ABSOLUTE:
695  m_Relative = false; // false = absolute coord
696  break;
697 
698  case DRILL_G_INCREMENTAL:
699  m_Relative = true; // true = relative coord
700  break;
701 
702  case DRILL_G_UNKNOWN:
703  default:
704  {
705  wxString msg;
706  msg.Printf( _( "Unknown Excellon G Code: &lt;%s&gt;" ), GetChars(FROM_UTF8(gcmd)) );
707  AddMessageToList( msg );
708  while( *text )
709  text++;
710  return false;
711  }
712  }
713  return success;
714 }
715 
716 void EXCELLON_IMAGE::SelectUnits( bool aMetric )
717 {
718  /* Coordinates are measured either in inch or metric (millimeters).
719  * Inch coordinates are in six digits (00.0000) with increments
720  * as small as 0.0001 (1/10,000).
721  * Metric coordinates can be measured in microns (thousandths of a millimeter)
722  * in one of the following three ways:
723  * Five digit 10 micron resolution (000.00)
724  * Six digit 10 micron resolution (0000.00)
725  * Six digit micron resolution (000.000)
726  *
727  * Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
728  * metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
729  */
730  if( aMetric )
731  {
732  m_GerbMetric = true;
733  // number of digits in mantissa
735  // number of digits (mantissa+interger)
737  }
738  else
739  {
740  m_GerbMetric = false;
743  }
744 }
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
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
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:94
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:102
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
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
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:107
void ClearMessageList()
Function ClearMessageList Clear the message list Call it before reading a Gerber file.
bool Select_Tool(char *&text)
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
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. ...
Class VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW...
Definition: view_item.h:83
GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files which are loaded...
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
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:104
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:71
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:50
void ListSet(const wxString &aList)
Function ListSet Add a list of items.
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
const wxArrayString & GetMessages() const
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
GERBER_DRAW_ITEM * Next() const
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:82
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
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
GERBER_FILE_IMAGE_LIST * GetImagesList() const
double ReadDouble(char *&text, bool aSkipSeparator=true)
Function ReadDouble reads a double from an ASCII character buffer.
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText, int &aLineNum)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
The common library.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:870
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:312
bool Execute_EXCELLON_G_Command(char *&text)
Class VIEW.
Definition: view.h:58
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:71
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE...
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:162
bool Read_EXCELLON_File(const wxString &aFullFileName)
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.