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