KiCad PCB EDA Suite
rs274d.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, you may find one here:
23  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
24  * or you may search the http://www.gnu.org website for the version 2 license,
25  * or you may write to the Free Software Foundation, Inc.,
26  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27  */
28 
29 #include <fctsys.h>
30 #include <common.h>
31 
32 #include <gerbview.h>
33 #include <gerbview_frame.h>
34 #include <trigo.h>
35 #include <gerber_file_image.h>
36 #include <X2_gerber_attributes.h>
37 
38 #include <cmath>
39 
40 /* Gerber: NOTES about some important commands found in RS274D and RS274X (G codes).
41  * Some are now deprecated, but deprecated commands must be known by the Gerber reader
42  * Gn =
43  * G01 linear interpolation (linear trace)
44  * G02, G20, G21 Circular interpolation, clockwise
45  * G03, G30, G31 Circular interpolation, counterclockwise
46  * G04 = comment. Since Sept 2014, file attributes and other X2 attributes can be found here
47  * if the line starts by G04 #@!
48  * G06 parabolic interpolation
49  * G07 Cubic Interpolation
50  * G10 linear interpolation (scale x10)
51  * G11 linear interpolation (0.1x range)
52  * G12 linear interpolation (0.01x scale)
53  * G36 Start polygon mode (called a region, because the "polygon" can include arcs)
54  * G37 Stop polygon mode (and close it)
55  * G54 Selection Tool (outdated)
56  * G60 linear interpolation (scale x100)
57  * G70 Select Units = Inches
58  * G71 Select Units = Millimeters
59  * G74 enable 90 deg mode for arcs (CW or CCW)
60  * G75 enable 360 degrees for arcs (CW or CCW)
61  * G90 mode absolute coordinates
62  *
63  * X, Y
64  * X and Y are followed by + or - and m + n digits (not separated)
65  * m = integer part
66  * n = part after the comma
67  *ic formats: m = 2, n = 3 (size 2.3)
68  * m = 3, n = 4 (size 3.4)
69  * eg
70  * GxxX00345Y-06123*
71  *
72  * Tools and D_CODES
73  * Tool number (identification of shapes)
74  * 10 to 999
75  * D_CODES:
76  * D01 ... D9 = command codes:
77  * D01 = activating light (pen down) when placement
78  * D02 = light extinction (pen up) when placement
79  * D03 = Flash
80  * D09 = VAPE Flash (I never see this command in gerber file)
81  * D51 = G54 preceded by -> Select VAPE
82  *
83  * D10 ... D999 = Identification Tool: tool selection
84  */
85 
86 
87 /* Local Functions (are lower case since they are private to this source file)
88 **/
89 
90 
104  APERTURE_T aAperture,
105  int Dcode_index,
106  const wxPoint& aPos,
107  wxSize aSize,
108  bool aLayerNegative )
109 {
110  aGbrItem->m_Size = aSize;
111  aGbrItem->m_Start = aPos;
112  aGbrItem->m_End = aGbrItem->m_Start;
113  aGbrItem->m_DCode = Dcode_index;
114  aGbrItem->SetLayerPolarity( aLayerNegative );
115  aGbrItem->m_Flashed = true;
116  aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict );
117 
118  switch( aAperture )
119  {
120  case APT_POLYGON: // flashed regular polygon
121  aGbrItem->m_Shape = GBR_SPOT_POLY;
122  break;
123 
124  case APT_CIRCLE:
125  aGbrItem->m_Shape = GBR_SPOT_CIRCLE;
126  aGbrItem->m_Size.y = aGbrItem->m_Size.x;
127  break;
128 
129  case APT_OVAL:
130  aGbrItem->m_Shape = GBR_SPOT_OVAL;
131  break;
132 
133  case APT_RECT:
134  aGbrItem->m_Shape = GBR_SPOT_RECT;
135  break;
136 
137  case APT_MACRO:
138  aGbrItem->m_Shape = GBR_SPOT_MACRO;
139 
140  // Cache the bounding box for aperture macros
141  aGbrItem->GetDcodeDescr()->GetMacro()->GetApertureMacroShape( aGbrItem, aPos );
142  break;
143  }
144 }
145 
146 
159  int Dcode_index,
160  const wxPoint& aStart,
161  const wxPoint& aEnd,
162  wxSize aPenSize,
163  bool aLayerNegative )
164 {
165  aGbrItem->m_Flashed = false;
166 
167  aGbrItem->m_Size = aPenSize;
168 
169  aGbrItem->m_Start = aStart;
170  aGbrItem->m_End = aEnd;
171 
172  aGbrItem->m_DCode = Dcode_index;
173  aGbrItem->SetLayerPolarity( aLayerNegative );
174 
175  aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict );
176 }
177 
178 
207 void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index,
208  const wxPoint& aStart, const wxPoint& aEnd,
209  const wxPoint& aRelCenter, wxSize aPenSize,
210  bool aClockwise, bool aMultiquadrant,
211  bool aLayerNegative )
212 {
213  wxPoint center, delta;
214 
215  aGbrItem->m_Shape = GBR_ARC;
216  aGbrItem->m_Size = aPenSize;
217  aGbrItem->m_Flashed = false;
218 
219  if( aGbrItem->m_GerberImageFile )
220  aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict );
221 
222  if( aMultiquadrant )
223  center = aStart + aRelCenter;
224  else
225  {
226  // in single quadrant mode the relative coordinate aRelCenter is always >= 0
227  // So we must recalculate the actual sign of aRelCenter.x and aRelCenter.y
228  center = aRelCenter;
229 
230  // calculate arc end coordinate relative to the starting point,
231  // because center is relative to the center point
232  delta = aEnd - aStart;
233 
234  // now calculate the relative to aStart center position, for a draw function
235  // that use trigonometric arc angle (or counter-clockwise)
236  /* Quadrants:
237  * Y
238  * 2 | 1
239  * -------X
240  * 3 | 4
241  * C = actual relative arc center, S = arc start (axis origin) E = relative arc end
242  */
243  if( (delta.x >= 0) && (delta.y >= 0) )
244  {
245  /* Quadrant 1 (trigo or cclockwise):
246  * C | E
247  * ---S---
248  * 3 | 4
249  */
250  center.x = -center.x;
251  }
252  else if( (delta.x >= 0) && (delta.y < 0) )
253  {
254  /* Quadrant 4 (trigo or cclockwise):
255  * 2 | C
256  * ---S---
257  * 3 | E
258  */
259  // Nothing to do
260  }
261  else if( (delta.x < 0) && (delta.y >= 0) )
262  {
263  /* Quadrant 2 (trigo or cclockwise):
264  * E | 1
265  * ---S---
266  * C | 4
267  */
268  center.x = -center.x;
269  center.y = -center.y;
270  }
271  else
272  {
273  /* Quadrant 3 (trigo or cclockwise):
274  * 2 | 1
275  * ---S---
276  * E | C
277  */
278  center.y = -center.y;
279  }
280 
281  // Due to your draw arc function, we need this:
282  if( !aClockwise )
283  center = - center;
284 
285  // Calculate actual arc center coordinate:
286  center += aStart;
287  }
288 
289  if( aClockwise )
290  {
291  aGbrItem->m_Start = aStart;
292  aGbrItem->m_End = aEnd;
293  }
294  else
295  {
296  aGbrItem->m_Start = aEnd;
297  aGbrItem->m_End = aStart;
298  }
299 
300  aGbrItem->m_ArcCentre = center;
301 
302  aGbrItem->m_DCode = Dcode_index;
303  aGbrItem->SetLayerPolarity( aLayerNegative );
304 }
305 
306 
334 static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
335  const wxPoint& aStart, const wxPoint& aEnd,
336  const wxPoint& rel_center,
337  bool aClockwise, bool aMultiquadrant,
338  bool aLayerNegative )
339 {
340  /* in order to calculate arc parameters, we use fillArcGBRITEM
341  * so we muse create a dummy track and use its geometric parameters
342  */
343  static GERBER_DRAW_ITEM dummyGbrItem( NULL );
344 
345  aGbrItem->SetLayerPolarity( aLayerNegative );
346 
347  fillArcGBRITEM( &dummyGbrItem, 0,
348  aStart, aEnd, rel_center, wxSize(0, 0),
349  aClockwise, aMultiquadrant, aLayerNegative );
350 
351  aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict );
352 
353  wxPoint center;
354  center = dummyGbrItem.m_ArcCentre;
355 
356  // Calculate coordinates relative to arc center;
357  wxPoint start = dummyGbrItem.m_Start - center;
358  wxPoint end = dummyGbrItem.m_End - center;
359 
360  /* Calculate angle arc
361  * angles are in 0.1 deg
362  * angle is trigonometrical (counter-clockwise),
363  * and axis is the X,Y gerber coordinates
364  */
365  double start_angle = ArcTangente( start.y, start.x );
366  double end_angle = ArcTangente( end.y, end.x );
367 
368  // dummyTrack has right geometric parameters, but
369  // fillArcGBRITEM calculates arc parameters for a draw function that expects
370  // start_angle < end_angle. So ensure this is the case here:
371  // Due to the fact atan2 returns angles between -180 to + 180 degrees,
372  // this is not always the case ( a modulo 360.0 degrees can be lost )
373  if( start_angle > end_angle )
374  end_angle += 3600;
375 
376  double arc_angle = start_angle - end_angle;
377  // Approximate arc by 36 segments per 360 degree
378  const int increment_angle = 3600 / 36;
379  int count = std::abs( arc_angle / increment_angle );
380 
381  if( aGbrItem->m_Polygon.OutlineCount() == 0 )
382  aGbrItem->m_Polygon.NewOutline();
383 
384  // calculate polygon corners
385  // when arc is counter-clockwise, dummyGbrItem arc goes from end to start
386  // and we must always create a polygon from start to end.
387  wxPoint start_arc = start;
388  for( int ii = 0; ii <= count; ii++ )
389  {
390  double rot;
391  wxPoint end_arc = start;
392  if( aClockwise )
393  rot = ii * increment_angle; // rot is in 0.1 deg
394  else
395  rot = (count - ii) * increment_angle; // rot is in 0.1 deg
396 
397  if( ii < count )
398  RotatePoint( &end_arc, -rot );
399  else // last point
400  end_arc = aClockwise ? end : start;
401 
402  aGbrItem->m_Polygon.Append( VECTOR2I( end_arc + center ) );
403 
404  start_arc = end_arc;
405  }
406 }
407 
408 
409 /* Read the Gnn sequence and returns the value nn.
410  */
412 {
413  int ii = 0;
414  char* text;
415  char line[1024];
416 
417  if( Text == NULL )
418  return 0;
419  Text++;
420  text = line;
421  while( IsNumber( *Text ) )
422  {
423  *(text++) = *(Text++);
424  }
425 
426  *text = 0;
427  ii = atoi( line );
428  return ii;
429 }
430 
431 
432 /* Get the sequence Dnn and returns the value nn
433  */
435 {
436  int ii = 0;
437  char* text;
438  char line[1024];
439 
440  if( Text == NULL )
441  return 0;
442 
443  Text++;
444  text = line;
445  while( IsNumber( *Text ) )
446  *(text++) = *(Text++);
447 
448  *text = 0;
449  ii = atoi( line );
450  return ii;
451 }
452 
453 
454 bool GERBER_FILE_IMAGE::Execute_G_Command( char*& text, int G_command )
455 {
456 // D( printf( "%22s: G_CODE<%d>\n", __func__, G_command ); )
457 
458  switch( G_command )
459  {
460  case GC_PHOTO_MODE: // can starts a D03 flash command: redundant, can
461  // be safely ignored
462  break;
463 
466  break;
467 
470  break;
471 
474  break;
475 
476  case GC_COMMENT:
477  // Skip comment, but only if the line does not start by "G04 #@! "
478  // which is a metadata, i.e. a X2 command inside the comment.
479  // this comment is called a "structured comment"
480  if( strncmp( text, " #@! ", 5 ) == 0 )
481  {
482  text += 5;
483  // The string starting at text is the same as the X2 attribute,
484  // but a X2 attribute ends by '%'. So we build the X2 attribute string
485  std::string x2buf;
486 
487  while( *text && (*text != '*') )
488  {
489  x2buf += *text;
490  text++;
491  }
492  // add the end of X2 attribute string
493  x2buf += "*%";
494  x2buf += '\0';
495 
496  char* cptr = (char*)x2buf.data();
497  int code_command = ReadXCommandID( cptr );
498  ExecuteRS274XCommand( code_command, NULL, 0, cptr );
499  }
500 
501  while( *text && (*text != '*') )
502  text++;
503  break;
504 
505  case GC_SELECT_TOOL:
506  {
507  int D_commande = DCodeNumber( text );
508 
509  if( D_commande < FIRST_DCODE )
510  return false;
511  if( D_commande > (TOOLS_MAX_COUNT - 1) )
512  D_commande = TOOLS_MAX_COUNT - 1;
513  m_Current_Tool = D_commande;
514  D_CODE* pt_Dcode = GetDCODE( D_commande );
515 
516  if( pt_Dcode )
517  pt_Dcode->m_InUse = true;
518 
519  break;
520  }
521 
522  case GC_SPECIFY_INCHES:
523  m_GerbMetric = false; // false = Inches, true = metric
524  break;
525 
527  m_GerbMetric = true; // false = Inches, true = metric
528  break;
529 
530  case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
531  m_360Arc_enbl = false;
532  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
533  m_AsArcG74G75Cmd = true;
534  break;
535 
537  m_360Arc_enbl = true;
538  m_AsArcG74G75Cmd = true;
539  break;
540 
542  m_Relative = false; // false = absolute Coord, true = relative
543  // Coord
544  break;
545 
547  m_Relative = true; // false = absolute Coord, true = relative
548  // Coord
549  break;
550 
552  m_PolygonFillMode = true;
553  m_Exposure = false;
554  break;
555 
557  if( m_Exposure && GetLastItemInList() ) // End of polygon
558  {
559  GERBER_DRAW_ITEM * gbritem = GetLastItemInList();
560 
561  if( gbritem->m_Polygon.VertexCount() )
562  gbritem->m_Polygon.Append( gbritem->m_Polygon.CVertex( 0 ) );
563 
564  StepAndRepeatItem( *gbritem );
565  }
566  m_Exposure = false;
567  m_PolygonFillMode = false;
569  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
570  break;
571 
572  case GC_MOVE: // Non existent
573  default:
574  {
575  wxString msg;
576  msg.Printf( wxT( "G%0.2d command not handled" ), G_command );
577  AddMessageToList( msg );
578  return false;
579  }
580  }
581 
582 
583  return true;
584 }
585 
586 
587 bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
588 {
589  wxSize size( 15, 15 );
590 
591  APERTURE_T aperture = APT_CIRCLE;
592  GERBER_DRAW_ITEM* gbritem;
593 
594  int dcode = 0;
595  D_CODE* tool = NULL;
596  wxString msg;
597 
598  if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
599  {
600  if( D_commande > (TOOLS_MAX_COUNT - 1) )
601  D_commande = TOOLS_MAX_COUNT - 1;
602 
603  // remember which tool is selected, nothing is done with it in this
604  // call
605  m_Current_Tool = D_commande;
606 
607  D_CODE* pt_Dcode = GetDCODE( D_commande );
608 
609  if( pt_Dcode )
610  pt_Dcode->m_InUse = true;
611  else
612  m_Has_MissingDCode = true;
613 
614  return true;
615  }
616  else // D_commande = 0..9: this is a pen command (usually D1, D2 or D3)
617  {
618  m_Last_Pen_Command = D_commande;
619  }
620 
621  if( m_PolygonFillMode ) // Enter a polygon description:
622  {
623  switch( D_commande )
624  {
625  case 1: // code D01 Draw line, exposure ON
626  if( !m_Exposure ) // Start a new polygon outline:
627  {
628  m_Exposure = true;
629  gbritem = new GERBER_DRAW_ITEM( this );
630  AddItemToList( gbritem );
631  gbritem->m_Shape = GBR_POLYGON;
632  gbritem->m_Flashed = false;
633  gbritem->m_DCode = 0; // No DCode for a Polygon (Region in Gerber dialect)
634 
635 
636  if( gbritem->m_GerberImageFile )
637  {
639  gbritem->m_AperFunction = gbritem->m_GerberImageFile->m_AperFunction;
640  }
641  }
642 
643  switch( m_Iterpolation )
644  {
647  // Before any arc command, a G74 or G75 command must be set.
648  // Otherwise the Gerber file is invalid
649  if( !m_AsArcG74G75Cmd )
650  {
651  AddMessageToList( _( "Invalid Gerber file: missing G74 or G75 arc command" ) );
652  // Disable further warning messages:
653  m_AsArcG74G75Cmd = true;
654  }
655 
656  gbritem = GetLastItemInList();
657 
658  fillArcPOLY( gbritem, m_PreviousPos,
660  ( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ? false : true,
661  m_360Arc_enbl, GetLayerParams().m_LayerNegative );
662  break;
663 
664  default:
665  gbritem = GetLastItemInList();
666 
667  gbritem->m_Start = m_PreviousPos; // m_Start is used as temporary storage
668  if( gbritem->m_Polygon.OutlineCount() == 0 )
669  {
670  gbritem->m_Polygon.NewOutline();
671  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_Start ) );
672  }
673 
674  gbritem->m_End = m_CurrentPos; // m_End is used as temporary storage
675  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_End ) );
676  break;
677  }
678 
681  break;
682 
683  case 2: // code D2: exposure OFF (i.e. "move to")
684  if( m_Exposure && GetLastItemInList() ) // End of polygon
685  {
686  gbritem = GetLastItemInList();
687  gbritem->m_Polygon.Append( gbritem->m_Polygon.CVertex( 0 ) );
688  StepAndRepeatItem( *gbritem );
689  }
690  m_Exposure = false;
693  break;
694 
695  default:
696  return false;
697  }
698  }
699  else
700  {
701  switch( D_commande )
702  {
703  case 1: // code D01 Draw line, exposure ON
704  m_Exposure = true;
705 
706  tool = GetDCODE( m_Current_Tool );
707 
708  if( tool )
709  {
710  size = tool->m_Size;
711  dcode = tool->m_Num_Dcode;
712  aperture = tool->m_Shape;
713  }
714 
715  switch( m_Iterpolation )
716  {
718  gbritem = new GERBER_DRAW_ITEM( this );
719  AddItemToList( gbritem );
720 
721  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
722  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
723  StepAndRepeatItem( *gbritem );
724  break;
725 
728  gbritem = new GERBER_DRAW_ITEM( this );
729  AddItemToList( gbritem );
730 
731  if( m_LastCoordIsIJPos )
732  {
733  fillArcGBRITEM( gbritem, dcode, m_PreviousPos,
734  m_CurrentPos, m_IJPos, size,
736  false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
737  m_LastCoordIsIJPos = false;
738  }
739  else
740  {
741  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
742  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
743  }
744 
745  StepAndRepeatItem( *gbritem );
746 
747  break;
748 
749  default:
750  msg.Printf( wxT( "RS274D: DCODE Command: interpol error (type %X)" ),
751  m_Iterpolation );
752  AddMessageToList( msg );
753  break;
754  }
755 
757  break;
758 
759  case 2: // code D2: exposure OFF (i.e. "move to")
760  m_Exposure = false;
762  break;
763 
764  case 3: // code D3: flash aperture
765  tool = GetDCODE( m_Current_Tool );
766  if( tool )
767  {
768  size = tool->m_Size;
769  dcode = tool->m_Num_Dcode;
770  aperture = tool->m_Shape;
771  }
772 
773  gbritem = new GERBER_DRAW_ITEM( this );
774  AddItemToList( gbritem );
775  fillFlashedGBRITEM( gbritem, aperture, dcode, m_CurrentPos,
776  size, GetLayerParams().m_LayerNegative );
777  StepAndRepeatItem( *gbritem );
779  break;
780 
781  default:
782  return false;
783  }
784  }
785 
786  return true;
787 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
int OutlineCount() const
Returns the number of outlines in the set
bool Execute_DCODE_Command(char *&text, int D_command)
Definition: rs274d.cpp:587
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
static void fillArcPOLY(GERBER_DRAW_ITEM *aGbrItem, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &rel_center, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcPOLY creates an arc G code when found in poly outlines.
Definition: rs274d.cpp:334
Definition: dcode.h:53
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
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
int VertexCount(int aOutline=-1, int aHole=-1) const
Returns the number of vertices in a given outline/hole
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
void SetNetAttributes(const GBR_NETLIST_METADATA &aNetAttributes)
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
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:158
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET m_Polygon
int ReadXCommandID(char *&text)
reads two bytes of data and assembles them into an int with the first byte in the sequence put into t...
Definition: rs274x.cpp:116
Definition: dcode.h:52
int GCodeNumber(char *&Text)
Definition: rs274d.cpp:411
bool ExecuteRS274XCommand(int aCommand, char *aBuff, unsigned int aBuffSize, char *&aText)
executes a RS274X command
Definition: rs274x.cpp:199
GERBER_DRAW_ITEM * GetLastItemInList() const
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, wxPoint aShapePos)
Function GetApertureMacroShape Calculate the primitive shape for flashed items.
void AddItemToList(GERBER_DRAW_ITEM *aItem)
Add a new GERBER_DRAW_ITEM item to the drawings list.
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:434
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
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
int NewOutline()
Creates a new empty polygon in the set and returns its index
void fillArcGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aRelCenter, wxSize aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcGBRITEM initializes a given GBRITEM so that it can draw an arc G code.
Definition: rs274d.cpp:207
bool m_Exposure
whether an aperture macro tool is flashed on or off
bool Execute_G_Command(char *&text, int G_command)
Definition: rs274d.cpp:454
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
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:103
#define _(s)
Definition: 3d_actions.cpp:33
GBR_NETLIST_METADATA m_NetAttributeDict
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void SetLayerPolarity(bool aNegative)
The common library.
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
#define IsNumber(x)
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
GERBER_FILE_IMAGE * m_GerberImageFile
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)