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>
71 #include <gerber_file_image.h>
72 #include <gerber_file_image_list.h>
73 #include <excellon_image.h>
74 #include <kicad_string.h>
75 #include <X2_gerber_attributes.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  auto gerber_layer = images->GetGbrImage( layerId );
167  auto drill_layer = dynamic_cast<EXCELLON_IMAGE*>( gerber_layer );
168 
169  if( gerber_layer && !drill_layer )
170  {
171  // The active layer contains old gerber data we have to clear
172  Erase_Current_DrawLayer( false );
173  }
174 
175  if( drill_layer == nullptr )
176  {
177  drill_layer = new EXCELLON_IMAGE( layerId );
178  layerId = images->AddGbrImage( drill_layer, layerId );
179  }
180 
181  if( layerId < 0 )
182  {
183  DisplayError( this, _( "No room to load file" ) );
184  return false;
185  }
186 
187  // Read the Excellon drill file:
188  bool success = drill_layer->LoadFile( aFullFileName );
189 
190  if( !success )
191  {
192  msg.Printf( _( "File %s not found" ), GetChars( aFullFileName ) );
193  DisplayError( this, msg );
194  return false;
195  }
196 
197  // Display errors list
198  if( drill_layer->GetMessages().size() > 0 )
199  {
200  HTML_MESSAGE_BOX dlg( this, _( "Error reading EXCELLON drill file" ) );
201  dlg.ListSet( drill_layer->GetMessages() );
202  dlg.ShowModal();
203  }
204 
205  if( success )
206  {
207  EDA_DRAW_PANEL_GAL* canvas = GetGalCanvas();
208 
209  if( canvas )
210  {
211  KIGFX::VIEW* view = canvas->GetView();
212 
213  for( GERBER_DRAW_ITEM* item = drill_layer->GetItemsList(); item; item = item->Next() )
214  {
215  view->Add( (KIGFX::VIEW_ITEM*) item );
216  }
217  }
218  }
219 
220  return success;
221 }
222 
223 /*
224  * Read a EXCELLON file.
225  * Gerber classes are used because there is likeness between Gerber files
226  * and Excellon files
227  * DCode can easily store T code (tool size) as round (or oval) shape
228  * Drill commands are similar to flashed gerber items
229  * Routing commands are similar to Gerber polygons
230  * coordinates have the same format as Gerber, can be given in:
231  * decimal format (i.i. floating notation format)
232  * integer 2.4 format in imperial units,
233  * integer 3.2 or 3.3 format (metric units).
234  */
235 
236 bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName )
237 {
238  // Set the default parmeter values:
239  ResetDefaultValues();
241 
242  m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
243 
244  if( m_Current_File == NULL )
245  return false;
246 
247  m_FileName = aFullFileName;
248 
249  LOCALE_IO toggleIo;
250 
251  // FILE_LINE_READER will close the file.
252  FILE_LINE_READER excellonReader( m_Current_File, m_FileName );
253 
254  while( true )
255  {
256  if( excellonReader.ReadLine() == 0 )
257  break;
258 
259  char* line = excellonReader.Line();
260  char* text = StrPurge( line );
261 
262  if( *text == ';' ) // comment: skip line
263  continue;
264 
265  if( m_State == EXCELLON_IMAGE::READ_HEADER_STATE )
266  {
267  Execute_HEADER_Command( text );
268  }
269  else
270  {
271  switch( *text )
272  {
273  case 'M':
274  Execute_HEADER_Command( text );
275  break;
276 
277  case 'G': /* Line type Gxx : command */
278  Execute_EXCELLON_G_Command( text );
279  break;
280 
281  case 'X':
282  case 'Y': // command like X12550Y19250
283  Execute_Drill_Command(text);
284  break;
285 
286  case 'I':
287  case 'J': /* Auxiliary Move command */
288  m_IJPos = ReadIJCoord( text );
289  if( *text == '*' ) // command like X35142Y15945J504
290  {
291  Execute_Drill_Command( text);
292  }
293  break;
294 
295  case 'T': // Tool command
296  Select_Tool( text );
297  break;
298 
299  case '%':
300  break;
301 
302  default:
303  {
304  wxString msg;
305  msg.Printf( wxT( "Unexpected symbol &lt;%c&gt;" ), *text );
306  AddMessageToList( msg );
307  }
308  break;
309  } // End switch
310  }
311  }
312 
313  // Add our file attribute, to identify the drill file
315  char* text = (char*)file_attribute;
316  int dummyline = 0;
317  dummy.ParseAttribCmd( m_Current_File, NULL, 0, text, dummyline );
318  delete m_FileFunction;
319  m_FileFunction = new X2_ATTRIBUTE_FILEFUNCTION( dummy );
320 
321  m_InUse = true;
322 
323  return true;
324 }
325 
326 
328 {
329  EXCELLON_CMD* cmd = NULL;
330  wxString msg;
331 
332  // Search command in list
333  for( unsigned ii = 0; ; ii++ )
334  {
335  EXCELLON_CMD* candidate = &excellonHeaderCmdList[ii];
336  int len = candidate->m_Name.size();
337 
338  if( len == 0 ) // End of list reached
339  break;
340 
341  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
342  {
343  cmd = candidate;
344  text += len;
345  break;
346  }
347  }
348 
349  if( !cmd )
350  {
351  msg.Printf( wxT( "Unknown Excellon command &lt;%s&gt;" ), text );
352  AddMessageToList( msg );
353  while( *text )
354  text++;
355 
356  return false;
357  }
358 
359  // Execute command
360  // some do nothing
361  switch( cmd->m_Code )
362  {
363  case DRILL_SKIP:
364  case DRILL_M_UNKNOWN:
365  break;
366 
367  case DRILL_M_END:
368  break;
369 
370  case DRILL_M_ENDREWIND:
371  break;
372 
373  case DRILL_M_MESSAGE:
374  break;
375 
376  case DRILL_M_LONGMESSAGE:
377  break;
378 
379  case DRILL_M_HEADER:
380  m_State = READ_HEADER_STATE;
381  break;
382 
383  case DRILL_M_ENDHEADER:
384  m_State = READ_PROGRAM_STATE;
385  break;
386 
387  case DRILL_REWIND_STOP: // End of header. No action in a viewer
388  m_State = READ_PROGRAM_STATE;
389  break;
390 
391  case DRILL_M_METRIC:
392  SelectUnits( true );
393  break;
394 
395  case DRILL_METRICHEADER: // command like METRIC,TZ or METRIC,LZ
396  SelectUnits( true );
397  if( *text != ',' )
398  {
399  AddMessageToList( _( "METRIC command has no parameter" ) );
400  break;
401  }
402  text++; // skip separator
403  if( *text == 'T' )
404  m_NoTrailingZeros = false;
405  else
406  m_NoTrailingZeros = true;
407  break;
408 
409  case DRILL_M_IMPERIAL:
410  SelectUnits( false );
411  break;
412 
413  case DRILL_IMPERIALHEADER: // command like INCH,TZ or INCH,LZ
414  SelectUnits( false );
415  if( *text != ',' )
416  {
417  AddMessageToList( _( "INCH command has no parameter" ) );
418  break;
419  }
420  text++; // skip separator
421  if( *text == 'T' )
422  m_NoTrailingZeros = false;
423  else
424  m_NoTrailingZeros = true;
425  break;
426 
428  break;
429 
430  case DRILL_M_ENDPATTERN:
431  break;
432 
433  case DRILL_M_CANNEDTEXT:
434  break;
435 
436  case DRILL_M_TIPCHECK:
437  break;
438 
439  case DRILL_DETECT_BROKEN:
440  break;
441 
443  if( *text != ',' )
444  {
445  AddMessageToList( _( "ICI command has no parameter" ) );
446  break;
447  }
448  text++; // skip separator
449  // Parameter should be ON or OFF
450  if( strncasecmp( text, "OFF", 3 ) == 0 )
451  m_Relative = false;
452  else if( strncasecmp( text, "ON", 2 ) == 0 )
453  m_Relative = true;
454  else
455  AddMessageToList( _( "ICI command has incorrect parameter" ) );
456  break;
457 
459  break;
460 
462  break;
463 
464  case DRILL_AXIS_VERSION:
465  break;
466 
467  case DRILL_RESET_CMD:
468  break;
469 
471  break;
472 
473  case DRILL_FMT:
474  break;
475 
477  readToolInformation( text );
478  break;
479  }
480 
481  while( *text )
482  text++;
483 
484  return true;
485 }
486 
487 
489 {
490  // Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00
491  // and enter the TCODE param in list (using the D_CODE param management, which
492  // is similar to TCODE params.
493  if( *aText == 'T' ) // This is the beginning of the definition
494  aText++;
495 
496  // Read tool number:
497  int iprm = ReadInt( aText, false );
498 
499  // Skip Feed rate and Spindle speed, if any here
500  while( *aText && ( *aText == 'F' || *aText == 'S' ) )
501  {
502  aText++;
503  ReadInt( aText, false );
504  }
505 
506  // Read tool shape
507  if( ! *aText )
508  AddMessageToList( wxString:: Format(
509  _( "Tool definition shape not found" ) ) );
510  else if( *aText != 'C' )
511  AddMessageToList( wxString:: Format(
512  _( "Tool definition '%c' not supported" ), *aText ) );
513  if( *aText )
514  aText++;
515 
516  //read tool diameter:
517  double dprm = ReadDouble( aText, false );
518  m_Has_DCode = true;
519 
520  // Initialize Dcode to handle this Tool
521  // Remember: dcodes are >= FIRST_DCODE
522  D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE );
523 
524  if( dcode == NULL )
525  return false;
526 
527  // conv_scale = scaling factor from inch to Internal Unit
528  double conv_scale = IU_PER_MILS * 1000;
529 
530  if( m_GerbMetric )
531  conv_scale /= 25.4;
532 
533  dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
534  dcode->m_Shape = APT_CIRCLE;
535  dcode->m_Defined = true;
536 
537  return true;
538 }
539 
541 {
542  D_CODE* tool;
543  GERBER_DRAW_ITEM * gbritem;
544 
545  while( true )
546  {
547  switch( *text )
548  {
549  case 'X':
550  ReadXYCoord( text );
551  break;
552  case 'Y':
553  ReadXYCoord( text );
554  break;
555  case 'G': // G85 is found here for oval holes
556  m_PreviousPos = m_CurrentPos;
557  Execute_EXCELLON_G_Command( text );
558  break;
559  case 0: // E.O.L: execute command
560  tool = GetDCODE( m_Current_Tool );
561 
562  if( !tool )
563  {
564  wxString msg;
565  msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
566  AddMessageToList( msg );
567  return false;
568  }
569 
570  gbritem = new GERBER_DRAW_ITEM( this );
571  m_Drawings.Append( gbritem );
572 
573  if( m_SlotOn ) // Oblong hole
574  {
575  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
576  m_PreviousPos, m_CurrentPos,
577  tool->m_Size, false );
578  // the hole is made: reset the slot on command (G85)
579  // (it is needed for each oblong hole)
580  m_SlotOn = false;
581  }
582  else
583  {
584  fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
585  m_CurrentPos, tool->m_Size, false );
586  }
587 
588  StepAndRepeatItem( *gbritem );
589  m_PreviousPos = m_CurrentPos;
590  return true;
591  break;
592 
593  default:
594  text++;
595  break;
596  }
597  }
598 
599  return true;
600 }
601 
602 
603 bool EXCELLON_IMAGE::Select_Tool( char*& text )
604 {
605  // Select the tool from the command line Tn, with n = 1 ... TOOLS_MAX_COUNT - 1
606  // Because some drill file have an embedded TCODE definition (like T1C.008F0S0)
607  // in tool selection command, if the tool is not defined in list,
608  // and the definition is embedded, it will be entered in list
609  char * startline = text; // the tool id starts here.
610  int tool_id = TCodeNumber( text );
611 
612  // T0 is legal, but is not a selection tool. it is a special command
613  if( tool_id >= 0 )
614  {
615  int dcode_id = tool_id + FIRST_DCODE; // Remember: dcodes are >= FIRST_DCODE
616 
617  if( dcode_id > (TOOLS_MAX_COUNT - 1) )
618  dcode_id = TOOLS_MAX_COUNT - 1;
619 
620  m_Current_Tool = dcode_id;
621  D_CODE* currDcode = GetDCODEOrCreate( dcode_id, true );
622 
623  if( currDcode == NULL && tool_id > 0 ) // if the definition is embedded, enter it
624  {
625  text = startline; // text starts at the beginning of the command
626  readToolInformation( text );
627  currDcode = GetDCODE( dcode_id );
628  }
629 
630  if( currDcode )
631  currDcode->m_InUse = true;
632  }
633 
634  while( *text )
635  text++;
636 
637  return tool_id >= 0;
638 }
639 
640 
642 {
643  EXCELLON_CMD* cmd = NULL;
644  bool success = false;
645  int id = DRILL_G_UNKNOWN;
646 
647  // Search command in list
648  EXCELLON_CMD* candidate;
649  char * gcmd = text; // gcmd points the G command, for error messages.
650 
651  for( unsigned ii = 0; ; ii++ )
652  {
653  candidate = &excellon_G_CmdList[ii];
654  int len = candidate->m_Name.size();
655  if( len == 0 ) // End of list reached
656  break;
657  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
658  {
659  cmd = candidate;
660  text += len;
661  success = true;
662  id = cmd->m_Code;
663  break;
664  }
665  }
666 
667  switch( id )
668  {
669  case DRILL_G_ZERO_SET:
670  ReadXYCoord( text );
671  m_Offset = m_CurrentPos;
672  break;
673 
674  case DRILL_G_ROUT:
675  m_SlotOn = false;
676  m_PolygonFillMode = true;
677  break;
678 
679  case DRILL_G_DRILL:
680  m_SlotOn = false;
681  m_PolygonFillMode = false;
682  break;
683 
684  case DRILL_G_SLOT:
685  m_SlotOn = true;
686  break;
687 
688  case DRILL_G_LINEARMOVE:
689  m_Iterpolation = GERB_INTERPOL_LINEAR_1X;
690  break;
691 
692  case DRILL_G_CWMOVE:
693  m_Iterpolation = GERB_INTERPOL_ARC_NEG;
694  break;
695 
696  case DRILL_G_CCWMOVE:
697  m_Iterpolation = GERB_INTERPOL_ARC_POS;
698  break;
699 
700  case DRILL_G_ABSOLUTE:
701  m_Relative = false; // false = absolute coord
702  break;
703 
704  case DRILL_G_INCREMENTAL:
705  m_Relative = true; // true = relative coord
706  break;
707 
708  case DRILL_G_UNKNOWN:
709  default:
710  {
711  wxString msg;
712  msg.Printf( _( "Unknown Excellon G Code: &lt;%s&gt;" ), GetChars(FROM_UTF8(gcmd)) );
713  AddMessageToList( msg );
714  while( *text )
715  text++;
716  return false;
717  }
718  }
719  return success;
720 }
721 
722 void EXCELLON_IMAGE::SelectUnits( bool aMetric )
723 {
724  /* Coordinates are measured either in inch or metric (millimeters).
725  * Inch coordinates are in six digits (00.0000) with increments
726  * as small as 0.0001 (1/10,000).
727  * Metric coordinates can be measured in microns (thousandths of a millimeter)
728  * in one of the following three ways:
729  * Five digit 10 micron resolution (000.00)
730  * Six digit 10 micron resolution (0000.00)
731  * Six digit micron resolution (000.000)
732  *
733  * Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
734  * metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
735  */
736  if( aMetric )
737  {
738  m_GerbMetric = true;
739  // number of digits in mantissa
740  m_FmtScale.x = m_FmtScale.y = fmtMantissaMM;
741  // number of digits (mantissa+interger)
742  m_FmtLen.x = m_FmtLen.y = fmtIntegerMM+fmtMantissaMM;
743  }
744  else
745  {
746  m_GerbMetric = false;
747  m_FmtScale.x = m_FmtScale.y = fmtMantissaInch;
748  m_FmtLen.x = m_FmtLen.y = fmtIntegerInch+fmtMantissaInch;
749  }
750 }
static EXCELLON_CMD excellon_G_CmdList[]
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF...
char * ReadLine() override
Function ReadLine reads a line of text into the buffer and increments the line number counter...
Definition: richio.cpp:194
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
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
This file is part of the common library.
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
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[]
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
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
void Erase_Current_DrawLayer(bool query)
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)
void ClearMessageList()
Function ClearMessageList Clear the message list Call it before reading a Gerber file.
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
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.
static const char file_attribute[]
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...
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:50
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:882
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:309
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:241
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.