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.

162 lines
7.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
  5. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /*
  26. * keyword used in drawing sheet are listed in drawing_sheet.keywords file
  27. */
  28. /*
  29. * Items use coordinates.
  30. * A coordinate is defined relative to a page corner
  31. * A coordinate is the X pos, the Y pos, and the corner which is the coordinate origin
  32. * the default is the bottom right corner
  33. * example: (start 10 0 ltcorner) or (start 20 10)
  34. * The direction depends on the corner: a positive coordinate define a point
  35. * from the corner origin, to the opposite corner.
  36. *
  37. * Items are defined by a name, coordinates in mm and some attributes,
  38. * and can be repeated.
  39. * for instance (repeat 2) (incrx 2) (incry 2) repeat the item 2 times,
  40. * and coordinates are incremented by 2 on X direction, and 2 on Y direction
  41. * Comments are allowed. they are inside (), and start by the keyword comment
  42. * example:
  43. * (comment rect around the title block)
  44. *
  45. * Lines and rect are defined by 2 coordinates start and end, and attributes.
  46. * Attributes are linewidth and repeat parameters.
  47. * example:
  48. * (line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
  49. * (rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) )
  50. *
  51. * Texts are defined by the text (between quotes), the position, and attributes
  52. * example
  53. * "(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )"
  54. * the text can be rotated by (rotation <value>) with value = rot angle in degrees
  55. * (font (size 1.3 1.3) bold italic) defines a specific size,
  56. * with bold and italic options
  57. * (justify <justif keyword>) controls the text justification (the default is left)
  58. * justif keyword is center, left, right, top and bottom
  59. * (justify center top) is a text centered on X axis and top aligned on vertical axis
  60. * The text size can be constrained:
  61. * (maxlen <value>) and (maxheight <value>) force the actual text x and/or y size to be
  62. * reduced to limit the text height to the maxheight value,
  63. * and the full text x size to the maxlen value.
  64. * If the actual text size is smaller than limits, its size is not modified.
  65. *
  66. * Texts can include a format symbol, a la printf.
  67. * At run time these format symbols will be replaced by their actual value.
  68. *
  69. * format symbols are:
  70. *
  71. * %% = replaced by %
  72. * %K = Kicad version
  73. * %Z = paper format name (A4, USLetter ...)
  74. * %Y = company name
  75. * %D = date
  76. * %R = revision
  77. * %S = sheet number
  78. * %N = number of sheets
  79. * %Cx = comment (x = 0 to 9 to identify the comment)
  80. * %F = filename
  81. * %P = sheet path (sheet full name)
  82. * %T = title
  83. *
  84. * example:
  85. * (tbtext \"Size: %Z\" ...) displays "Size A4" or Size USLetter"
  86. *
  87. * Poly Polygons
  88. * Set of filled polygons are supported.
  89. *
  90. * The main purpose is to allow logos, or complex shapes
  91. * They support the repeat and rotation options
  92. * They are defined by
  93. * (polygon (position ..) <rotation> <linewidth>
  94. * the parameter linewidth defines the pen size used to draw/plot
  95. * the polygon outlines (default = 0)
  96. * example:
  97. * (polygon (pos 134 18 rbcorner) (rotate 20) (linewidth 0.00254)
  98. *
  99. * and a list of corners like
  100. * (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
  101. * .... )
  102. *
  103. * each sequence like
  104. * (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
  105. * .... )
  106. * defines a polygon.
  107. * Each coordinate is relative to the polygon position.
  108. * Therefore a "polygon" is in fact a set of polygons, of a poly polygon
  109. *
  110. */
  111. // height of the coordinates band 2.0 mm
  112. // coordinates text size 1.3 mm
  113. // default text size 1.5 mm
  114. // default line width 0.15 mm
  115. // frame ref pitch 50 mm
  116. // Default drawing sheet (sizes are in mm)
  117. extern const char defaultDrawingSheet[] =
  118. "(kicad_wks (version 20210606) (generator pl_editor)\n"
  119. "(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"
  120. "(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
  121. "(rect (name \"\") (start 110 34) (end 2 2) (comment \"rect around the title block\"))\n"
  122. "(rect (name \"\") (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2))\n"
  123. "(line (name \"\") (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50))\n"
  124. "(tbtext \"1\" (name \"\") (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))\n"
  125. "(line (name \"\") (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50))\n"
  126. "(tbtext \"1\" (name \"\") (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))\n"
  127. "(line (name \"\") (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50))\n"
  128. "(tbtext \"A\" (name \"\") (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))\n"
  129. "(line (name \"\") (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50))\n"
  130. "(tbtext \"A\" (name \"\") (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))\n"
  131. "(tbtext \"Date: ${ISSUE_DATE}\" (name \"\") (pos 87 6.9))\n"
  132. "(line (name \"\") (start 110 5.5) (end 2 5.5))\n"
  133. "(tbtext \"${KICAD_VERSION}\" (name \"\") (pos 109 4.1) (comment \"Kicad version\"))\n"
  134. "(line (name \"\") (start 110 8.5) (end 2 8.5))\n"
  135. "(tbtext \"Rev: ${REVISION}\" (name \"\") (pos 24 6.9) (font bold))\n"
  136. "(tbtext \"Size: ${PAPER}\" (name \"\") (pos 109 6.9) (comment \"Paper format name\"))\n"
  137. "(tbtext \"Id: ${#}/${##}\" (name \"\") (pos 24 4.1) (comment \"Sheet id\"))\n"
  138. "(line (name \"\") (start 110 12.5) (end 2 12.5))\n"
  139. "(tbtext \"Title: ${TITLE}\" (name \"\") (pos 109 10.7) (font (size 2 2) bold italic))\n"
  140. "(tbtext \"File: ${FILENAME}\" (name \"\") (pos 109 14.3))\n"
  141. "(line (name \"\") (start 110 18.5) (end 2 18.5))\n"
  142. "(tbtext \"Sheet: ${SHEETPATH}\" (name \"\") (pos 109 17))\n"
  143. "(tbtext \"${COMPANY}\" (name \"\") (pos 109 20) (font bold) (comment \"Company name\"))\n"
  144. "(tbtext \"${COMMENT1}\" (name \"\") (pos 109 23) (comment \"Comment 0\"))\n"
  145. "(tbtext \"${COMMENT2}\" (name \"\") (pos 109 26) (comment \"Comment 1\"))\n"
  146. "(tbtext \"${COMMENT3}\" (name \"\") (pos 109 29) (comment \"Comment 2\"))\n"
  147. "(tbtext \"${COMMENT4}\" (name \"\") (pos 109 32) (comment \"Comment 3\"))\n"
  148. "(line (name \"\") (start 90 8.5) (end 90 5.5))\n"
  149. "(line (name \"\") (start 26 8.5) (end 26 2))\n"
  150. ")\n";
  151. extern const char emptyDrawingSheet[] =
  152. "(kicad_wks (version 20210606) (generator pl_editor)\n"
  153. "(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"
  154. "(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
  155. "(line (name \"segm1:Line\") (start 0 0) (end 0 0))\n"
  156. ")\n";