File: routestyles.script

package info (click to toggle)
pcb 1%3A4.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 29,760 kB
  • sloc: ansic: 138,451; sh: 8,447; yacc: 5,135; pascal: 4,820; makefile: 2,039; perl: 580; lex: 439; awk: 116; lisp: 86; tcl: 63; xml: 20
file content (182 lines) | stat: -rw-r--r-- 5,905 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#
# Route Styles Tests
#
# Things to test:
#  * Generation of new route strings (with mask apertures)
#  * Generation of old route strings (without mask apertures)
#  * Parsing of new route strings
#  * Parsing of old route strings
#  * File version is bumped if there are new route strings
#  * File version is not bumped if all route strings are old
#
#  This test produces 5 output files:
#    * zero-apertures-save.pcb:
#      This file tests that we can save files in the old format correctly if
#      all of the mask aperture parameters are zeroed out.
#      Evaluation criteria:
#        1. This file should contain four tented (SM aperture = 0) vias of
#           different sizes (see below)
#        2. The file version should be 20091103.
#        3. The route styles should be Newstyle0 .. Newstyle3.
#        4. All route styles should have 4 parameters.
#
#    * non-zero-apertures-save.pcb
#      This file tests that we can save files in the new format. (It may be
#      unnecessary, as I think the mixed cases covers this)
#      Evaluation criteria:
#        1. This file should contain four tented vias, and four clear vias
#        2. The file version should be 20180318
#        3. The route styles should be Newstyle4 .. Newstyle7.
#        4. All route styles should have 5 parameters.
#
#    * mixed-apertures-save.pcb
#      This file tests that we can save files with mixed formats.
#      Evaluation criteria:
#        1. The file should have three rows of four vias. The first row should
#           be tented, the second row should be clear, and the third row
#           should have two clear, and two tented.
#        2. The file version should be 20180318
#        3. The route styles should be Newstyle[4,5,8,9]
#        4. Styles 4 and 5 should have 5 paramters, styles 8 and 9 should have
#           4 parameters.
#
#    * zero-apertures-load.pcb
#      This file checks that we were able to load a file with the old
#      format.
#      1. The file should have two rows of 4 vias, all vias should be
#         tented.
#
#    * mixed-apertures-load.pcb
#      This file checks that we were able to load a file with both the new 
#      format strings and the old format strings.
#      1. The file should have four rows of four vias. The first row should
#         be tented, the second should be clear, the third and fourth should
#         both have two clear and two tented.
#
# TODO:
#  * Lines and arcs
#  * Include polygons for testing keep away
#
# Presently, we have no way through this interface of testing the
# integration with the guis, so, that will have to be tested by hand.
#

# Start with the default pcb to prevent user preferences from sneaking into
# the tests.
LoadFrom(Layout, default.pcb)

# Turn on the solder mask
Display(ToggleMask)

#
# This first set of tests addresses the generation of route strings. 
#
# The first tests saves a file that have all 0 mask aperture (old format). This
# should save with the old file version, and be backwards compatible. 
#

#               #         name, line width, via dia., drill, keepaway, mask
SetupRouteStyle(0, "Newstyle0",      10mil,    20mil, 10mil,    10mil, 0mil)
SetupRouteStyle(1, "Newstyle1",      20mil,    30mil, 20mil,    20mil, 0mil)
SetupRouteStyle(2, "Newstyle2",      30mil,    40mil, 30mil,    30mil, 0mil)
SetupRouteStyle(3, "Newstyle3",      40mil,    50mil, 40mil,    40mil, 0mil)

RouteStyle(1)
CreateVia(100, 100, mil)
RouteStyle(2)
CreateVia(200, 100, mil)
RouteStyle(3)
CreateVia(300, 100, mil)
RouteStyle(4)
CreateVia(400, 100, mil)

# This should save a pcb file in the old format.
SaveTo(LayoutAs, zero-apertures-save.pcb)

#
# The second test saves a file with all styles having a non-zero mask
# aperture. These should all save with the new style string format and the
# file version bump.
#

#               #         name, line width, via dia., drill, keepaway, mask
SetupRouteStyle(0, "Newstyle4",      10mil,    20mil, 10mil,    10mil, 30mil)
SetupRouteStyle(1, "Newstyle5",      20mil,    30mil, 20mil,    20mil, 40mil)
SetupRouteStyle(2, "Newstyle6",      30mil,    40mil, 30mil,    30mil, 50mil)
SetupRouteStyle(3, "Newstyle7",      40mil,    50mil, 40mil,    40mil, 60mil)

RouteStyle(1)
CreateVia(100, 200, mil)
RouteStyle(2)
CreateVia(200, 200, mil)
RouteStyle(3)
CreateVia(300, 200, mil)
RouteStyle(4)
CreateVia(400, 200, mil)

# This should save a pcb file with new style strings, and bump the file version.
SaveTo(LayoutAs, non-zero-apertures-save.pcb)

#
# The third test saves a pcb that has some non-zero mask apertures and some
# zero mask apertures. This should save with two old style strings, two new
# style strings, and the file version bumped.
#

SetupRouteStyle(2, "Newstyle8",      30mil,    40mil, 30mil,    30mil, 0mil)
SetupRouteStyle(3, "Newstyle9",      40mil,    50mil, 40mil,    40mil, 0mil)

RouteStyle(1)
CreateVia(100, 300, mil)
RouteStyle(2)
CreateVia(200, 300, mil)
RouteStyle(3)
CreateVia(300, 300, mil)
RouteStyle(4)
CreateVia(400, 300, mil)


# This should save a pcb file with two new strings and two old strings.
SaveTo(LayoutAs, mixed-apertures-save.pcb)

#
# The next set of tests test the loading the route strings from pcb files.
#

#
# First, load the old format. Add some vias to demonstrate the route styles
# that were loaded.
#

LoadFrom(Layout, zero-apertures-save.pcb)

RouteStyle(1)
CreateVia(100, 200, mil)
RouteStyle(2)
CreateVia(200, 200, mil)
RouteStyle(3)
CreateVia(300, 200, mil)
RouteStyle(4)
CreateVia(400, 200, mil)

SaveTo(LayoutAs, zero-apertures-load.pcb)

#
# Now load a new style one. We'll load the mixed one since that covers both
# cases.
#

LoadFrom(Layout, mixed-apertures-save.pcb)

RouteStyle(1)
CreateVia(100, 400, mil)
RouteStyle(2)
CreateVia(200, 400, mil)
RouteStyle(3)
CreateVia(300, 400, mil)
RouteStyle(4)
CreateVia(400, 400, mil)

SaveTo(LayoutAs, mixed-apertures-load.pcb)

Quit()