KiCad PCB EDA Suite
gbr_plotter_aperture_macros.h
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) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
26 #pragma once
27 
28 // A aperture macro to define a rounded rect pad shape
29 // In many gerber readers, the rotation of the full shape is broken
30 // so we are using primitives that does not need a rotation around aperture origin.
31 // Note also the primitive 1 (circle) can use 4 or 5 parameters
32 // the 5th parameter is the rotation (not used by Kicad ) around aperture origin and is
33 // a recent optional parameter and can create compatibility issues with old
34 // Gerber viewer, so it is not output (default = 0).
35 
36 #define APER_MACRO_ROUNDRECT_NAME "RoundRect"
37 
38 #define APER_MACRO_ROUNDRECT_HEADER \
39 "%AMRoundRect*\n\
40 0 Rectangle with rounded corners*\n\
41 0 $1 Rounding radius*\n\
42 0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*\n\
43 0 Add a 4 corners polygon primitive as box body*\n\
44 4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*\n\
45 0 Add four circle primitives for the rounded corners*\n\
46 1,1,$1+$1,$2,$3*\n\
47 1,1,$1+$1,$4,$5*\n\
48 1,1,$1+$1,$6,$7*\n\
49 1,1,$1+$1,$8,$9*\n\
50 0 Add four rect primitives between the rounded corners*\n\
51 20,1,$1+$1,$2,$3,$4,$5,0*\n\
52 20,1,$1+$1,$4,$5,$6,$7,0*\n\
53 20,1,$1+$1,$6,$7,$8,$9,0*\n\
54 20,1,$1+$1,$8,$9,$2,$3,0*\
55 %\n"
56 
57 // A aperture macro to define a rotated rect pad shape
58 #define APER_MACRO_ROT_RECT_NAME "RotRect"
59 
60 #define APER_MACRO_ROT_RECT_HEADER \
61 "%AMRotRect*\n\
62 0 Rectangle, with rotation*\n\
63 0 The origin of the aperture is its center*\n\
64 0 $1 length*\n\
65 0 $2 width*\n\
66 0 $3 Rotation angle, in degrees counterclockwise*\n\
67 0 Add horizontal line*\n\
68 21,1,$1,$2,0,0,$3*%\n"
69 
70 
71 // A aperture macro to define a oval pad shape
72 // In many gerber readers, the rotation of the full shape is broken
73 // so we are using a primitive that does not need a rotation to be
74 // plotted
75 #define APER_MACRO_SHAPE_OVAL_NAME "HorizOval"
76 
77 #define APER_MACRO_SHAPE_OVAL_HEADER \
78 "%AMHorizOval*\n\
79 0 Thick line with rounded ends*\n\
80 0 $1 width*\n\
81 0 $2 $3 position (X,Y) of the first rounded end (center of the circle)*\n\
82 0 $4 $5 position (X,Y) of the second rounded end (center of the circle)*\n\
83 0 Add line between two ends*\n\
84 20,1,$1,$2,$3,$4,$5,0*\n\
85 0 Add two circle primitives to create the rounded ends*\n\
86 1,1,$1,$2,$3*\n\
87 1,1,$1,$4,$5*%\n"
88 
89 // A aperture macro to define a trapezoid (polygon) by 4 corners
90 // and a rotation angle
91 #define APER_MACRO_OUTLINE4P_NAME "Outline4P"
92 
93 #define APER_MACRO_OUTLINE4P_HEADER \
94 "%AMOutline4P*\n\
95 0 Free polygon, 4 corners , with rotation*\n\
96 0 The origin of the aperture is its center*\n\
97 0 number of corners: always 4*\n\
98 0 $1 to $8 corner X, Y*\n\
99 0 $9 Rotation angle, in degrees counterclockwise*\n\
100 0 create outline with 4 corners*\n\
101 4,1,4,$1,$2,$3,$4,$5,$6,$7,$8,$1,$2,$9*%\n"
102 
103 // A aperture macro to define a polygon by 5 corners
104 // and a rotation angle (usefull for chamfered rect pads)
105 #define APER_MACRO_OUTLINE5P_NAME "Outline5P"
106 
107 #define APER_MACRO_OUTLINE5P_HEADER \
108 "%AMOutline5P*\n\
109 0 Free polygon, 5 corners , with rotation*\n\
110 0 The origin of the aperture is its center*\n\
111 0 number of corners: always 8*\n\
112 0 $1 to $10 corner X, Y*\n\
113 0 $11 Rotation angle, in degrees counterclockwise*\n\
114 0 create outline with 8 corners*\n\
115 4,1,5,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$1,$2,$11*%\n"
116 
117 // A aperture macro to define a polygon by 6 corners
118 // and a rotation angle (usefull for chamfered rect pads)
119 #define APER_MACRO_OUTLINE6P_NAME "Outline6P"
120 
121 #define APER_MACRO_OUTLINE6P_HEADER \
122 "%AMOutline6P*\n\
123 0 Free polygon, 6 corners , with rotation*\n\
124 0 The origin of the aperture is its center*\n\
125 0 number of corners: always 6*\n\
126 0 $1 to $12 corner X, Y*\n\
127 0 $13 Rotation angle, in degrees counterclockwise*\n\
128 0 create outline with 6 corners*\n\
129 4,1,6,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$1,$2,$13*%\n"
130 
131 // A aperture macro to define a polygon by 7 corners
132 // and a rotation angle (usefull for chamfered rect pads)
133 #define APER_MACRO_OUTLINE7P_NAME "Outline7P"
134 
135 #define APER_MACRO_OUTLINE7P_HEADER \
136 "%AMOutline7P*\n\
137 0 Free polygon, 7 corners , with rotation*\n\
138 0 The origin of the aperture is its center*\n\
139 0 number of corners: always 7*\n\
140 0 $1 to $14 corner X, Y*\n\
141 0 $15 Rotation angle, in degrees counterclockwise*\n\
142 0 create outline with 7 corners*\n\
143 4,1,7,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$1,$2,$15*%\n"
144 
145 // A aperture macro to define a polygon by 8 corners
146 // and a rotation angle (usefull for chamfered rect pads)
147 #define APER_MACRO_OUTLINE8P_NAME "Outline8P"
148 
149 #define APER_MACRO_OUTLINE8P_HEADER \
150 "%AMOutline8P*\n\
151 0 Free polygon, 8 corners , with rotation*\n\
152 0 The origin of the aperture is its center*\n\
153 0 number of corners: always 8*\n\
154 0 $1 to $16 corner X, Y*\n\
155 0 $17 Rotation angle, in degrees counterclockwise*\n\
156 0 create outline with 8 corners*\n\
157 4,1,8,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$1,$2,$17*%\n"