KiCad PCB EDA Suite
drawing_sheet_default_description.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-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/*
27 * keyword used in drawing sheet are listed in drawing_sheet.keywords file
28 */
29
30/*
31 * Items use coordinates.
32 * A coordinate is defined relative to a page corner
33 * A coordinate is the X pos, the Y pos, and the corner which is the coordinate origin
34 * the default is the bottom right corner
35 * example: (start 10 0 ltcorner) or (start 20 10)
36 * The direction depends on the corner: a positive coordinate define a point
37 * from the corner origin, to the opposite corner.
38 *
39 * Items are defined by a name, coordinates in mm and some attributes,
40 * and can be repeated.
41 * for instance (repeat 2) (incrx 2) (incry 2) repeat the item 2 times,
42 * and coordinates are incremented by 2 on X direction, and 2 on Y direction
43 * Comments are allowed. they are inside (), and start by the keyword comment
44 * example:
45 * (comment rect around the title block)
46 *
47 * Lines and rect are defined by 2 coordinates start and end, and attributes.
48 * Attributes are linewidth and repeat parameters.
49 * example:
50 * (line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
51 * (rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) )
52 *
53 * Texts are defined by the text (between quotes), the position, and attributes
54 * example
55 * "(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )"
56 * the text can be rotated by (rotation <value>) with value = rot angle in degrees
57 * (font (size 1.3 1.3) bold italic) defines a specific size,
58 * with bold and italic options
59 * (justify <justif keyword>) controls the text justification (the default is left)
60 * justif keyword is center, left, right, top and bottom
61 * (justify center top) is a text centered on X axis and top aligned on vertical axis
62 * The text size can be constrained:
63 * (maxlen <value>) and (maxheight <value>) force the actual text x and/or y size to be
64 * reduced to limit the text height to the maxheight value,
65 * and the full text x size to the maxlen value.
66 * If the actual text size is smaller than limits, its size is not modified.
67 *
68 * Texts can include a format symbol, a la printf.
69 * At run time these format symbols will be replaced by their actual value.
70 *
71 * format symbols are:
72 *
73 * %% = replaced by %
74 * %K = Kicad version
75 * %Z = paper format name (A4, USLetter ...)
76 * %Y = company name
77 * %D = date
78 * %R = revision
79 * %S = sheet number
80 * %N = number of sheets
81 * %Cx = comment (x = 0 to 9 to identify the comment)
82 * %F = filename
83 * %P = sheet path (sheet full name)
84 * %T = title
85 *
86 * example:
87 * (tbtext \"Size: %Z\" ...) displays "Size A4" or Size USLetter"
88 *
89 * Poly Polygons
90 * Set of filled polygons are supported.
91 *
92 * The main purpose is to allow logos, or complex shapes
93 * They support the repeat and rotation options
94 * They are defined by
95 * (polygon (position ..) <rotation> <linewidth>
96 * the parameter linewidth defines the pen size used to draw/plot
97 * the polygon outlines (default = 0)
98 * example:
99 * (polygon (pos 134 18 rbcorner) (rotate 20) (linewidth 0.00254)
100 *
101 * and a list of corners like
102 * (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
103 * .... )
104 *
105 * each sequence like
106 * (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
107 * .... )
108 * defines a polygon.
109 * Each coordinate is relative to the polygon position.
110 * Therefore a "polygon" is in fact a set of polygons, of a poly polygon
111 *
112 */
113
114
115// height of the coordinates band 2.0 mm
116// coordinates text size 1.3 mm
117// default text size 1.5 mm
118// default line width 0.15 mm
119// frame ref pitch 50 mm
120
121// Default drawing sheet (sizes are in mm)
122extern const char defaultDrawingSheet[] =
123 "(kicad_wks (version 20210606) (generator pl_editor)\n"
124 "(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"
125 "(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
126 "(rect (name \"\") (start 110 34) (end 2 2) (comment \"rect around the title block\"))\n"
127 "(rect (name \"\") (start 0 0 ltcorner) (end 0 0) (repeat 2) (incrx 2) (incry 2))\n"
128 "(line (name \"\") (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50))\n"
129 "(tbtext \"1\" (name \"\") (pos 25 1 ltcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))\n"
130 "(line (name \"\") (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50))\n"
131 "(tbtext \"1\" (name \"\") (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50))\n"
132 "(line (name \"\") (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50))\n"
133 "(tbtext \"A\" (name \"\") (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))\n"
134 "(line (name \"\") (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50))\n"
135 "(tbtext \"A\" (name \"\") (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50))\n"
136 "(tbtext \"Date: ${ISSUE_DATE}\" (name \"\") (pos 87 6.9))\n"
137 "(line (name \"\") (start 110 5.5) (end 2 5.5))\n"
138 "(tbtext \"${KICAD_VERSION}\" (name \"\") (pos 109 4.1) (comment \"Kicad version\"))\n"
139 "(line (name \"\") (start 110 8.5) (end 2 8.5))\n"
140 "(tbtext \"Rev: ${REVISION}\" (name \"\") (pos 24 6.9) (font bold))\n"
141 "(tbtext \"Size: ${PAPER}\" (name \"\") (pos 109 6.9) (comment \"Paper format name\"))\n"
142 "(tbtext \"Id: ${#}/${##}\" (name \"\") (pos 24 4.1) (comment \"Sheet id\"))\n"
143 "(line (name \"\") (start 110 12.5) (end 2 12.5))\n"
144 "(tbtext \"Title: ${TITLE}\" (name \"\") (pos 109 10.7) (font (size 2 2) bold italic))\n"
145 "(tbtext \"File: ${FILENAME}\" (name \"\") (pos 109 14.3))\n"
146 "(line (name \"\") (start 110 18.5) (end 2 18.5))\n"
147 "(tbtext \"Sheet: ${SHEETPATH}\" (name \"\") (pos 109 17))\n"
148 "(tbtext \"${COMPANY}\" (name \"\") (pos 109 20) (font bold) (comment \"Company name\"))\n"
149 "(tbtext \"${COMMENT1}\" (name \"\") (pos 109 23) (comment \"Comment 0\"))\n"
150 "(tbtext \"${COMMENT2}\" (name \"\") (pos 109 26) (comment \"Comment 1\"))\n"
151 "(tbtext \"${COMMENT3}\" (name \"\") (pos 109 29) (comment \"Comment 2\"))\n"
152 "(tbtext \"${COMMENT4}\" (name \"\") (pos 109 32) (comment \"Comment 3\"))\n"
153 "(line (name \"\") (start 90 8.5) (end 90 5.5))\n"
154 "(line (name \"\") (start 26 8.5) (end 26 2))\n"
155 ")\n";
156
157extern const char emptyDrawingSheet[] =
158 "(kicad_wks (version 20210606) (generator pl_editor)\n"
159 "(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"
160 "(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"
161 "(line (name \"segm1:Line\") (start 0 0) (end 0 0))\n"
162 ")\n";
const char emptyDrawingSheet[]
const char defaultDrawingSheet[]