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