You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.6 KiB

  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) 2021 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. /**
  21. * @file gbr_plotter_aperture_macros.h
  22. * @brief specialized plotter for GERBER files format
  23. */
  24. #pragma once
  25. // A aperture macro to define a rounded rect pad shape
  26. // In many gerber readers, the rotation of the full shape is broken
  27. // so we are using primitives that does not need a rotation around aperture origin.
  28. // Note also the primitive 1 (circle) can use 4 or 5 parameters
  29. // the 5th parameter is the rotation (not used by Kicad ) around aperture origin and is
  30. // a recent optional parameter and can create compatibility issues with old
  31. // Gerber viewer, so it is not output (default = 0).
  32. #define APER_MACRO_ROUNDRECT_NAME "RoundRect"
  33. #define APER_MACRO_ROUNDRECT_HEADER \
  34. "%AMRoundRect*\n\
  35. 0 Rectangle with rounded corners*\n\
  36. 0 $1 Rounding radius*\n\
  37. 0 $2 $3 $4 $5 $6 $7 $8 $9 X,Y pos of 4 corners*\n\
  38. 0 Add a 4 corners polygon primitive as box body*\n\
  39. 4,1,4,$2,$3,$4,$5,$6,$7,$8,$9,$2,$3,0*\n\
  40. 0 Add four circle primitives for the rounded corners*\n\
  41. 1,1,$1+$1,$2,$3*\n\
  42. 1,1,$1+$1,$4,$5*\n\
  43. 1,1,$1+$1,$6,$7*\n\
  44. 1,1,$1+$1,$8,$9*\n\
  45. 0 Add four rect primitives between the rounded corners*\n\
  46. 20,1,$1+$1,$2,$3,$4,$5,0*\n\
  47. 20,1,$1+$1,$4,$5,$6,$7,0*\n\
  48. 20,1,$1+$1,$6,$7,$8,$9,0*\n\
  49. 20,1,$1+$1,$8,$9,$2,$3,0*\
  50. %\n"
  51. // A aperture macro to define a rotated rect pad shape
  52. #define APER_MACRO_ROT_RECT_NAME "RotRect"
  53. #define APER_MACRO_ROT_RECT_HEADER \
  54. "%AMRotRect*\n\
  55. 0 Rectangle, with rotation*\n\
  56. 0 The origin of the aperture is its center*\n\
  57. 0 $1 length*\n\
  58. 0 $2 width*\n\
  59. 0 $3 Rotation angle, in degrees counterclockwise*\n\
  60. 0 Add horizontal line*\n\
  61. 21,1,$1,$2,0,0,$3*%\n"
  62. // A aperture macro to define a oval pad shape
  63. // In many gerber readers, the rotation of the full shape is broken
  64. // so we are using a primitive that does not need a rotation to be
  65. // plotted
  66. #define APER_MACRO_SHAPE_OVAL_NAME "HorizOval"
  67. #define APER_MACRO_SHAPE_OVAL_HEADER \
  68. "%AMHorizOval*\n\
  69. 0 Thick line with rounded ends*\n\
  70. 0 $1 width*\n\
  71. 0 $2 $3 position (X,Y) of the first rounded end (center of the circle)*\n\
  72. 0 $4 $5 position (X,Y) of the second rounded end (center of the circle)*\n\
  73. 0 Add line between two ends*\n\
  74. 20,1,$1,$2,$3,$4,$5,0*\n\
  75. 0 Add two circle primitives to create the rounded ends*\n\
  76. 1,1,$1,$2,$3*\n\
  77. 1,1,$1,$4,$5*%\n"
  78. // A aperture macro to define a trapezoid (polygon) by 4 corners
  79. // and a rotation angle
  80. #define APER_MACRO_OUTLINE4P_NAME "Outline4P"
  81. #define APER_MACRO_OUTLINE4P_HEADER \
  82. "%AMOutline4P*\n\
  83. 0 Free polygon, 4 corners , with rotation*\n\
  84. 0 The origin of the aperture is its center*\n\
  85. 0 number of corners: always 4*\n\
  86. 0 $1 to $8 corner X, Y*\n\
  87. 0 $9 Rotation angle, in degrees counterclockwise*\n\
  88. 0 create outline with 4 corners*\n\
  89. 4,1,4,$1,$2,$3,$4,$5,$6,$7,$8,$1,$2,$9*%\n"
  90. // A aperture macro to define a polygon by 5 corners
  91. // and a rotation angle (useful for chamfered rect pads)
  92. #define APER_MACRO_OUTLINE5P_NAME "Outline5P"
  93. #define APER_MACRO_OUTLINE5P_HEADER \
  94. "%AMOutline5P*\n\
  95. 0 Free polygon, 5 corners , with rotation*\n\
  96. 0 The origin of the aperture is its center*\n\
  97. 0 number of corners: always 5*\n\
  98. 0 $1 to $10 corner X, Y*\n\
  99. 0 $11 Rotation angle, in degrees counterclockwise*\n\
  100. 0 create outline with 5 corners*\n\
  101. 4,1,5,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$1,$2,$11*%\n"
  102. // A aperture macro to define a polygon by 6 corners
  103. // and a rotation angle (useful for chamfered rect pads)
  104. #define APER_MACRO_OUTLINE6P_NAME "Outline6P"
  105. #define APER_MACRO_OUTLINE6P_HEADER \
  106. "%AMOutline6P*\n\
  107. 0 Free polygon, 6 corners , with rotation*\n\
  108. 0 The origin of the aperture is its center*\n\
  109. 0 number of corners: always 6*\n\
  110. 0 $1 to $12 corner X, Y*\n\
  111. 0 $13 Rotation angle, in degrees counterclockwise*\n\
  112. 0 create outline with 6 corners*\n\
  113. 4,1,6,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$1,$2,$13*%\n"
  114. // A aperture macro to define a polygon by 7 corners
  115. // and a rotation angle (useful for chamfered rect pads)
  116. #define APER_MACRO_OUTLINE7P_NAME "Outline7P"
  117. #define APER_MACRO_OUTLINE7P_HEADER \
  118. "%AMOutline7P*\n\
  119. 0 Free polygon, 7 corners , with rotation*\n\
  120. 0 The origin of the aperture is its center*\n\
  121. 0 number of corners: always 7*\n\
  122. 0 $1 to $14 corner X, Y*\n\
  123. 0 $15 Rotation angle, in degrees counterclockwise*\n\
  124. 0 create outline with 7 corners*\n\
  125. 4,1,7,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$1,$2,$15*%\n"
  126. // A aperture macro to define a polygon by 8 corners
  127. // and a rotation angle (useful for chamfered rect pads)
  128. #define APER_MACRO_OUTLINE8P_NAME "Outline8P"
  129. #define APER_MACRO_OUTLINE8P_HEADER \
  130. "%AMOutline8P*\n\
  131. 0 Free polygon, 8 corners , with rotation*\n\
  132. 0 The origin of the aperture is its center*\n\
  133. 0 number of corners: always 8*\n\
  134. 0 $1 to $16 corner X, Y*\n\
  135. 0 $17 Rotation angle, in degrees counterclockwise*\n\
  136. 0 create outline with 8 corners*\n\
  137. 4,1,8,$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$1,$2,$17*%\n"