-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpads2step.py
executable file
·602 lines (494 loc) · 21.6 KB
/
pads2step.py
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
#!/usr/bin/python
from datetime import datetime # Date and time representation
import sys # Handle command-line flags
import math # Math
W_DEFAULT = 0.02
def spliterator(line, sep=' ', filt=''):
''' Split a line, drop empty segments, return filtered list of results '''
def filterator(string):
return string != filt
return filter(filterator, line.rstrip().split(sep))
# PADS entities ---------------------------------------------------------------
class AttributeLabel(object):
def __init__(self, line1, line2):
items = ('x', 'y', 'rotation', 'mirror', 'height', 'width', 'layer',
'just', 'flags', 'font_info')
vals = spliterator(line1)
for i in range(len(vals)):
if i in (0, 1, 2, 4, 5):
item = float(vals[i])
elif i in (3, 6, 7, 8):
item = int(vals[i])
elif i == 9:
item = ''
for j in range(i, len(vals)):
item += vals[j] + ' '
setattr(self, items[i], item[:-1].replace('\"', ''))
break
setattr(self, items[i], item)
self.name = line2
class Piece(object):
def __init__(self, line, infile):
# Read piece header
items = ('type', 'numcoord', 'width', 'layer', 'linestyle')
header = spliterator(line)
for i in range(len(header)):
if i == 0:
attr = header[i]
elif i == 2:
attr = float(header[i])
else: # i == 1 or i > 2:
attr = int(header[i])
setattr(self, items[i], attr)
# Read piece body
self.segments = []
for i in range(self.numcoord):
segments = spliterator(next(infile).rstrip())
n = len(segments)
if n == 2:
self.shape = "line"
elif n == 8:
self.shape = "arc"
else:
print("ERROR: Wrong number of piece coordinates: " + l)
break
seg_iter = iter(segments)
for seg in seg_iter:
self.segments.append((float(seg), float(next(seg_iter))))
class Terminal(list):
def __init__(self, line):
items = iter(spliterator(line))
self.append((float(next(items).replace('T', '')), float(next(items))))
self.append((float(next(items)), float(next(items))))
self.pin = next(items)
class PadStack(object):
def __init__(self, line, infile):
class Layer(object):
def __init__(self, line):
items = iter(spliterator(line))
self.n = int(next(items))
self.width = float(next(items))
self.shape = next(items)
if self.shape == 'S': # Square normal pad
self.corner = float(next(items))
elif self.shape == 'A': # Annular pad
self.intd = float(next(items))
elif self.shape == 'OF': # Oval finger pad
self.ori = float(next(items))
self.length = float(next(items))
self.offset = float(next(items))
elif self.shape == 'RF': # Rectangular finger pad
self.corner = float(next(items))
self.ori = float(next(items))
self.length = float(next(items))
self.offset = float(next(items))
elif self.shape == 'RT' or self.shape == 'ST':
self.ori = float(next(items))
self.intd = float(next(items))
self.spkwid = float(next(items))
self.n_spk = int(next(items))
# Read header line
items = ('pin', 'n_layers', 'plated', 'drill', 'drlori', 'drllen',
'drloff')
header = spliterator(line)[1:]
self.slotted = len(header) > 4
for i in range(len(header)):
if i < 2:
attr = int(header[i])
elif i == 2:
attr = header[i]
elif i > 2:
attr = float(header[i])
setattr(self, items[i], attr)
# Read layers
self.layers = []
for i in range(self.n_layers):
self.layers.append(Layer(next(infile)))
# PADS file types -------------------------------------------------------------
class PadsItem(object):
def __init__(self, infile):
print("This file type is not supported")
class DraftingItem(PadsItem):
pass
class SchematicDecals(PadsItem):
pass
class PCBDecals(PadsItem):
def __init__(self, infile):
# Read header line as an iterator, dropping empty strings
header = spliterator(next(infile).rstrip())
# Save header data
header_attrs = ('name', 'units', 'x', 'y', 'n_attrs', 'n_labels',
'n_pieces', 'n_text', 'n_terminals', 'n_stacks',
'maxlayers')
for i in range(len(header)):
if i in (0, 1):
attr = header[i]
if i in (2, 3):
attr = float(header[i])
if i > 3:
attr = int(header[i])
setattr(self, header_attrs[i], attr)
# Read timestamp
timestamp = next(infile).rstrip().split(' ')[1].split('.')
self.timestamp = datetime(*list(map(int, timestamp)))
# Read attributes
self.attributes = {}
line = next(infile).rstrip()
while line[0] == '\"':
attribute = line[1:].split('\" ')
self.attributes[attribute[0]] = attribute[1]
line = next(infile).rstrip()
# Read attribute labels
self.attribute_labels = []
while line[-1] == '\"':
self.attribute_labels.append(
AttributeLabel(line, next(infile).rstrip()))
line = next(infile).rstrip()
# Read piece definitions
self.pieces = []
while spliterator(line)[0] in ('OPEN', 'CLOSED', 'CIRCLE', 'COPOPN',
'COPCLS', 'COPCIR', 'BRDCUT', 'BRDCCO',
'KPTCLS', 'KPTCIT', 'TAG'):
self.pieces.append(Piece(line, infile))
line = next(infile).rstrip()
# Skip text definitions
self.text = []
while line[0] != 'T':
line = next(infile)
# Read terminals
self.terminals = []
while line[0] == 'T':
self.terminals.append(Terminal(line))
line = next(infile).rstrip()
# Read pad stacks
self.pads = []
while line[0:3] == 'PAD':
self.pads.append(PadStack(line, infile))
line = next(infile).rstrip()
class PartTypes(PadsItem):
pass
# STEP writer -----------------------------------------------------------------
def pads2step(pads):
''' Write out .stp file.
Use double-quotes for everything here, .stp uses single quotes.
'''
with open(pads.name + '.stp', 'w') as stp:
# HACK: necessary to keep j in this scope, not global
class j():
j = 1
def write(line):
''' Take a line, add ";\n", write it out, increment j '''
stp.write(line + ";\n")
j.j += 1
def var(item):
''' Take an item, return it as '#item' '''
return "#{0}".format(item)
def var_list(*items):
''' Take a bunch of items, return '(#item1,#item2,#item3,...)' '''
return ','.join(map(var, items))
def vect(a, b):
''' Return 1 for positive distance, -1 for negative, 0 for 0 '''
dist = b-a
if dist > 0:
ret = '1'
elif dist == 0:
ret = '0'
else:
ret = '-1'
return ret
def write_shape_end(w):
write("#{0}=CURVE_STYLE('',#{1},POSITIVE_LENGTH_MEASURE({2}),#5)".format(j.j, j_font, w))
write("#{0}=PRESENTATION_STYLE_ASSIGNMENT((#{1}))".format(j.j, j.j-1))
write("#{0}=STYLED_ITEM('',(#{1}),#{2})".format(j.j, j.j-1, j.j-3))
ret = j.j
write("#{0}=COMPOSITE_CURVE_SEGMENT(.CONTINUOUS.,.T.,#{1})".format(j.j, j.j-4))
return ret
def write_line(x0, y0, w, seg):
x, y, = seg
d = math.sqrt((x-x0)**2 + (y-y0)**2)
if x0 != x and y0 != y:
print(y0, y)
write("#{0}=DIRECTION('',({1},{2},0.E0))".format(j.j, vect(x0, x), vect(y0, y)))
write("#{0}=VECTOR('',#{1},{2})".format(j.j, j.j-1, d))
write("#{0}=CARTESIAN_POINT('',({1},{2},0.E0))".format(j.j, x0, y0))
write("#{0}=LINE('',#{1},#{2})".format(j.j, j.j-1, j.j-2))
write("#{0}=TRIMMED_CURVE('',#{1},(PARAMETER_VALUE(0.E0)),(PARAMETER_VALUE(1.E0)),.T.,.UNSPECIFIED.)".format(j.j, j.j-1))
return write_shape_end(w)
def write_arc(x0, y0, w, seg):
x, y, ab, aa, ax1, ay1, ax2, ay2, = seg
r = (ax2-ax1)/2
xc, yc = (ax2 + ax1)/2, (ay2 + ay1)/2
write("#{0}=CARTESIAN_POINT('',({1},{2},0.E0))".format(j.j, xc, yc))
write("#{0}=DIRECTION('',(0.E0,0.E0,1.E0))".format(j.j))
write("#{0}=DIRECTION('',({1},{2},0.E0))".format(j.j, vect(x0, x), vect(y0, y)))
write("#{0}=AXIS2_PLACEMENT_3D('',{1})".format(j.j, var_list(j.j-3, j.j-2, j.j-1)))
write("#{0}=CIRCLE('',#{1},{2})".format(j.j, j.j-1, r))
write("#{0}=TRIMMED_CURVE('',#{1},(PARAMETER_VALUE({2})),(PARAMETER_VALUE({3})),.T.,.UNSPECIFIED.)".format(j.j, j.j-1, ab, aa))
return write_shape_end(w)
def write_comp(*items):
write("#{0}=COMPOSITE_CURVE('',({1}),.F.)".format(j.j, var_list(*items)))
return j.j-1
def write_shape(shape):
w = float(shape.width)
x0, y0, = shape.segments[0]
segs = []
for seg in shape.segments[1:]:
n = len(seg)
if n == 2: # Line
segs.append(write_line(x0, y0, w, seg))
elif n == 8: # Arc
segs.append(write_arc(x0, y0, w, seg))
else: # ?
print("ERROR: writing segment that isn't line or arc")
break
x0, y0, = seg
return write_comp(*segs)
def write_circle(shape):
w = shape.width
x0, y0, = shape.segments[0]
x1, y1, = shape.segments[1]
xc, yc = (x0 + x1)/2, (y0 + y1)/2
r = abs(xc - x0)
ax1, ay1 = xc-r, yc-r
ax2, ay2 = xc+r, yc+r
a = write_arc(x0, y0, w, [x1, y1, 0, 180, ax1, ay1, ax2, ay2])
b = write_arc(x1, y1, w, [x0, y0, 180, 180, ax1, ay1, ax2, ay2])
return write_comp(a, b)
def write_pad_circle(x, y, r):
w = W_DEFAULT
x0, y0 = x-r, y
x1, y1 = x+r, y
ax1, ay1 = x-r, y-r
ax2, ay2 = x+r, y+r
a = write_arc(x0, y0, w, [x1, y1, 0, 180, ax1, ay1, ax2, ay2])
b = write_arc(x1, y1, w, [x0, y0, 180, 180, ax1, ay1, ax2, ay2])
return write_comp(a, b)
def write_pad_rectangle(x, y, r, corner, ori, l, offset):
# TODO: support rounded/chamfered corners
# TODO: support offset
w = W_DEFAULT
r = r/2
l = l/2
sin, cos = math.sin(math.radians(ori)), math.cos(math.radians(ori))
x_f, y_f = r*sin + l*cos, r*cos + l*sin
x_l, x_r = x-x_f, x+x_f
y_t, y_b = y+y_f, y-y_f
a = write_line(x_l, y_t, w, (x_r, y_t)) # Top
b = write_line(x_r, y_t, w, (x_r, y_b)) # Right
c = write_line(x_r, y_b, w, (x_l, y_b)) # Bottom
d = write_line(x_l, y_b, w, (x_l, y_t)) # Left
return write_comp(a, b, c, d)
def write_pad_square(x, y, r):
return write_pad_rectangle(x, y, r, 0, 0, r, 0)
def write_pad_oval(x, y, r, ori, l, offset):
# TODO: support offset
w = W_DEFAULT
r = r/2
l = l/2 - r
sin, cos = math.sin(math.radians(ori)), math.cos(math.radians(ori))
x_f, y_f = (r*sin + l*cos), (r*cos + l*sin)
x_l, x_r = x-x_f, x+x_f
y_t, y_b = y+y_f, y-y_f
ax1_1, ay1_1 = x_r-r, y_b
ax2_1, ay2_1 = x_r+r, y_t
ax1_2, ay1_2 = x_l-r, y_b
ax2_2, ay2_2 = x_l+r, y_t
# top, right, bottom, left
a = write_line(x_l, y_t, w, (x_r, y_t))
b = write_arc(x_r, y_t, w, [x_r, y_b, 0, 180, ax1_1, ay1_1, ax2_1, ay2_1])
c = write_line(x_r, y_b, w, (x_l, y_b))
d = write_arc(x_l, y_b, w, [x_l, y_t, 0, 180, ax1_2, ay1_2, ax2_2, ay2_2])
return write_comp(a, b, c, d)
def write_pad_annular(x, y, r_out, r_in):
a = write_pad_circle(x, y, r_out)
b = write_pad_circle(x, y, r_in)
return write_comp(a, b)
j = j()
# Begin header
write("ISO-10303-21")
write("HEADER")
# FILE_DESCRIPTION
description = 'Converted drawing from pads file'
conformance = '2;1' # Conformance level to ISO-10303-21
write("FILE_DESCRIPTION(('{}'),'{}')".format(description, conformance))
# FILE_NAME
name = pads.name
timestamp = [
str(pads.timestamp.year),
str(pads.timestamp.month),
str(pads.timestamp.day) + 'T' + str(pads.timestamp.hour),
':' + str(pads.timestamp.minute),
':' + str(pads.timestamp.second)]
timestamp = '-'.join(timestamp)
author = 'PADS2STEP'
organization = 'Distant Focus Corporation'
preprocessor_version = 'pads2step.py'
originating_system = ''
authorization = ''
write("FILE_NAME('{}','{}',('{}'),('{}'),'{}','{}','{}')".format(
name, timestamp, author, organization, preprocessor_version,
originating_system, authorization))
# FILE_SCHEMA
schema = "'AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'"
write("FILE_SCHEMA(('" + schema + "'))")
# End header
write("ENDSEC")
# Begin data section
write("DATA")
j.j = 1
# Colors
colors = ( # name, R, G, B
('', 0.E0, 0.E0, 6.6E-1),
('', 0.E0, 6.6E-1, 0.E0),
('', 3.4E-1, 3.3E-1, 3.5E-1),
('', 3.9E-1, 5.6E-1, 8.1E-1),
('', 4.E-1, 4.509803921569E-1, 1.E0),
('', 4.4E-1, 5.E-1, 5.5E-1),
('', 5.09804E-1, 5.09804E-1, 5.09804E-1),
('', 6.E-1, 4.E-1, 2.E-1),
('', 6.952E-1, 7.426E-1, 7.9E-1),
('', 8.03922E-1, 5.88235E-1, 1.96078E-1),
('', 8.4E-1, 3.3E-1, 3.5E-1),
('', 8.8E-1, 1.6E-1, 1.6E-1),
('', 8.784E-1, 9.49E-1, 1.E0))
for color in colors:
write("#{0}=COLOUR_RGB{1}".format(j.j, str(color)))
# Origin
write("#{0}=CARTESIAN_POINT('',(0.E0,0.E0,0.E0))".format(j.j))
write("#{0}=DIRECTION('',(0.E0,0.E0,1.E0))".format(j.j))
write("#{0}=DIRECTION('',(1.E0,0.E0,0.E0))".format(j.j))
j_axis = j.j # Save this for later
write("#{0}=AXIS2_PLACEMENT_3D('DEFAULT_CSYS',{1})".format(j.j, var_list(j.j-3, j.j-2, j.j-1)))
j_font = j.j # Save this for later
write("#{0}=DRAUGHTING_PRE_DEFINED_CURVE_FONT('continuous')".format(j.j))
write("#{0}=CURVE_STYLE('',#{1},POSITIVE_LENGTH_MEASURE(2.E-2),#8)".format(j.j, j.j-1))
write("#{0}=PRESENTATION_STYLE_ASSIGNMENT(({1}))".format(j.j, var_list(j.j-1)))
write("#{0}=STYLED_ITEM('',({1}),#{2})".format(j.j, var_list(j.j-1), j_axis))
# Shapes
shapes = []
if shape_flag:
for piece in pads.pieces:
t = piece.type
if t in ("OPEN", "CLOSED", "COPOPN", "COPCLS", "KPTCLS",
"BRDCUT", "BRDCCO"):
shapes.append(write_shape(piece))
elif t in ("CIRCLE", "COPCIR", "KPTCIR"):
shapes.append(write_circle(piece))
# Find default pad stack for terminals
for pad in pads.pads:
if pad.pin == 0:
pad_0 = pad
break
else:
print("No pad 0 found!")
# Terminals
for i in range(1, len(pads.terminals)+1):
# Find matching pad stack
for stack in pads.pads:
if stack.pin == i:
stack_match = stack
break
else:
stack_match = pad_0
# Get top layer
for layer in stack_match.layers:
if layer.n == -2:
layer_match = layer
break
else:
print("No top layer found for pin {}!".format(i-1))
# Write drill hole
x, y = pads.terminals[i-1][0][0], pads.terminals[i-1][0][1]
if stack_match.drill > 0:
if hasattr(stack_match, 'drllen'):
shapes.append(write_pad_oval(x, y, stack_match.drill, stack_match.drlori, stack_match.drllen, stack_match.drloff))
else:
shapes.append(write_pad_circle(x, y, stack_match.drill))
# Write appropriate shape
if layer_match.shape in ('R', 'RA', 'RT'):
shapes.append(write_pad_circle(x, y, layer_match.width))
elif layer_match.shape in ('S', 'SA', 'ST'):
shapes.append(write_pad_square(x, y, layer_match.width))
elif layer_match.shape == 'A':
shapes.append(write_pad_annular(x, y, layer_match.width, layer_match.intd))
elif layer_match.shape == 'OF':
shapes.append(write_pad_oval(x, y, layer_match.width, layer_match.ori, layer_match.length, layer_match.offset))
elif layer_match.shape == 'RF':
shapes.append(write_pad_rectangle(x, y, layer_match.width, layer_match.corner, layer_match.ori, layer_match.length, layer_match.offset))
else:
print("WARNING: Skipped unrecognized pad shape {}".format(layer_match.shape))
# Finish shapes
j_set = j.j
write("#{0}=GEOMETRIC_SET('',({1}))".format(j.j, var_list(*shapes)))
# Footer
write("#{0}=PRESENTATION_LAYER_ASSIGNMENT('.BLACK_HOLE','',(#{1}))".format(j.j, j_axis))
write("#{0}=INVISIBILITY((#{1}))".format(j.j, j.j-1))
write("#{0}=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.))".format(j.j))
write("#{0}=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.))".format(j.j))
write("#{0}=PLANE_ANGLE_MEASURE_WITH_UNIT(PLANE_ANGLE_MEASURE(1.745329251994E-2),#{1})".format(j.j, j.j-1))
write("#{0}=(CONVERSION_BASED_UNIT('DEGREE',#{1})NAMED_UNIT(*)PLANE_ANGLE_UNIT())".format(j.j, j.j-1))
write("#{0}=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT())".format(j.j))
write("#{0}=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.477113140796E-3),#{1},'distance_accuracy_value','Maximum model space distance between geometric entities at asserted connectivities')".format(j.j,j.j-5))
write("#{0}=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#{1}))GLOBAL_UNIT_ASSIGNED_CONTEXT({2})REPRESENTATION_CONTEXT('ID1','3'))".format(j.j,j.j-1,var_list(j.j-6, j.j-3, j.j-2)))
write("#{0}=GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION('',(#{1}),#{2})".format(j.j, j_set, j.j-1))
write("#{0}=MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',({1}),#{2})".format(j.j, var_list(*shapes), j.j-2))
write("ENDSEC")
write("END-ISO-10303-21")
# main ------------------------------------------------------------------------
if len(sys.argv) not in range(2, 4) or '-h' in sys.argv:
print('pads2step.py: this tool converts .d decal files from PADS into .stp format.\n'
+ 'Usage: pads2step.py <pads filename> <flags>\n'
+ 'Flags:\n'
+ "-h: show this message, don't convert anything\n"
+ '-x: exclude part detail, only show pin pads and drill holes')
exit(2)
fn = sys.argv[1]
if '-x' in sys.argv:
shape_flag = False
else:
shape_flag = True
thing = None
with open(fn) as infile:
# Get data type, skip blank line
line = next(infile).rstrip()
next(infile)
# Check if data type recognized
if line == "*PADS-LIBRARY-LINE-ITEMS-V9*":
thing = DraftingItem(infile)
elif line == "*PADS-LIBRARY-SCH-DECALS-V9*":
thing = SchematicDecals(infile)
elif line == "*PADS-LIBRARY-PCB-DECALS-V9*":
thing = PCBDecals(infile)
elif line == "*PADS-LIBRARY-PART-TYPES-V9*":
thing = PartTypes(infile)
else: # Invalid data type
print("Unrecognized data type!")
pads2step(thing)
if __name__ == "__main__":
print("TESTS:")
tests = [
('name', 'MOLEX_1051330011'),
('units', 'M'),
('x', 0),
('y', 0),
('n_attrs', 2),
('n_labels', 3),
('n_pieces', 7),
('n_text', 0),
('n_terminals', 8),
('n_stacks', 4),
('maxlayers', 0),
('timestamp', datetime(2017, 10, 26, 14, 12, 31))]
for t in tests:
print(str(getattr(thing, t[0]) == t[1]) + ' - ' + t[0] + ": " + str(t[1]))
print(thing.attributes["Geometry.Height"])
for lbl in thing.attribute_labels:
print(lbl.name, lbl.y, int(lbl.flags))
for pc in thing.pieces:
print(pc.type)
for t in thing.terminals:
print(t.pin)
for p in thing.pads:
print(p.plated)
for l in p.layers:
print(l.shape)