-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakeVariant3dIntermediates.il
More file actions
806 lines (663 loc) · 26.6 KB
/
makeVariant3dIntermediates.il
File metadata and controls
806 lines (663 loc) · 26.6 KB
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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
procedure( getVariantInfo()
let( ( (variantFile "Variants.lst" )
( state "findVariant" )
pattern inPort currentVariant variantTable alternateParts part partProperties refDes symbols )
pattern = pcreCompile("[\"\t+\\()]")
newLine = pcreCompile("\t\t")
newLineEnd = pcreCompile("\t\t \\)")
newLineWithinProperty = pcreCompile( "=\"\t\t " )
propertyStart = pcreCompile( "^\t\t\\(.*" )
propertySeparator = pcreCompile( "(\" )" )
blankSpace = pcreCompile( " " )
inPort = infile( variantFile )
if( inPort then
variantTable = makeTable( "variantTable" nil )
alternateParts = makeTable( "alternateParts" nil )
parts = makeTable( "parts" nil )
partProperties = makeTable( "partProperties" nil )
while( gets( line inPort )
case( state
(
"findVariant"
; parse for \"
subStrings = parseString( line "\"" )
when( length( subStrings ) == 3
currentVariant = nth( 1 subStrings )
state = "awaitStartCondition"
)
)
(
"awaitStartCondition"
when( strcmp( line "\t\t(base\n" ) == 0
state = "appendSymbols"
symbols = list()
)
)
(
"appendSymbols"
if( strcmp( line "\t\t)\n" ) == 0 then
state = "awaitEndCondition"
else
;append symbols to list
symbols = nconc( symbols parseString( line ) )
)
)
(
"awaitEndCondition"
if( strcmp( line "\t)\n" ) == 0 then
;remove ")" in list
symbols = remove( ")" symbols )
symbols = mapcar( lambda( ( symbol ) pcreReplace( pattern symbol "" 0 ) ) symbols )
; append components to array
variantTable[currentVariant] = symbols
alternateParts[currentVariant] = parts
; initialize parts (again, clear previous values)
parts = makeTable( "parts" nil )
state = "findVariant"
else
; alternate part properties
when( pcreMatchp( propertyStart line )
; find variant specific information
subStrings = parseString( line )
when( length( subStrings ) > 1
refDes = pcreReplace( pattern nth( 0 subStrings ) "" 0 )
; substrings without first element (refDes)
properties = buildString( cdr(subStrings) )
temp = pcreReplace( propertySeparator properties "\\\\" 0 )
subStrings = parseString( temp "\\\\" )
; check, if property information ends in this line
if( strcmp( car(last(subStrings)) ")\n" ) == 0 then
foreach( subString subStrings
; parse properties
valueKey = parseString( subString "=" )
when( length(valueKey ) == 2
partProperties[nth( 0 valueKey )] = pcreReplace( pattern nth( 1 valueKey ) "" 0 )
)
)
; set part properties, clear properties
parts[refDes] = partProperties
partProperties = makeTable( "partProperties" nil )
; append to symbol list
symbols = nconc( symbols list( nth( 0 subStrings ) ) )
else
state = "awaitMoreProperties"
)
)
)
)
)
(
"awaitMoreProperties"
; add more properties
; append line to properties and check
; newLineEnd needs to be replaced by space + ), because the last space is ignore by buildString (...) in previous loop
properties = strcat( properties pcreReplace( newLineEnd line " )" 0 ) )
properties = pcreReplace( newLineWithinProperty properties "=\"" 0 )
properties = pcreReplace( newLine properties "" 0 )
temp = pcreReplace( propertySeparator properties "\\\\" 0 )
temp = pcreReplace( newLineEnd temp "\\\\" 0 )
subStrings = parseString( temp "\\\\" )
; check, if property information ends in this line
when( strcmp( car(last(subStrings)) ")\n" ) == 0
foreach( subString subStrings
; parse properties
valueKey = parseString( subString "=" )
when( length(valueKey ) == 2
partProperties[nth( 0 valueKey )] = pcreReplace( blankSpace pcreReplace( pattern cadr( valueKey ) "" 0 ) "" 0 )
)
)
; set part properties, clear properties
parts[refDes] = partProperties
partProperties = makeTable( "partProperties" nil )
; append to symbol list
symbols = nconc( symbols list( nth( 0 subStrings ) ) )
properties = ""
state = "awaitEndCondition"
)
)
(
t
warn( "I should not be here ... " )
)
)
)
list( variantTable alternateParts )
else
error( "Can not read from file ... " )
nil
)
)
)
procedure( makeLine( segment )
let( ( extents xStart yStart xEnd yEnd element )
extents = segment->startEnd
xStart = caar( extents )
yStart = cadar( extents )
xEnd = caadr( extents )
yEnd = cadadr( extents )
element = strcat(
"{\n\t\"type\": \"segment\",\n"
"\t\"start\": [" sprintf( nil "%f" xStart ) ", " sprintf( nil "%f" yStart ) "],\n"
"\t\"end\": [" sprintf( nil "%f" xEnd ) ", " sprintf( nil "%f" yEnd ) "]\n"
"}"
)
)
)
procedure( makeArc( segment )
let( ( xy xCenter yCenter radius extents xStart yStart xEnd yEnd cw ccw angle1 angle2 startAngle endAngle element )
xy = segment->xy
xCenter = car( xy )
yCenter = cadr( xy )
radius = segment->radius
extents = segment->startEnd
xStart = caar( extents )
yStart = cadar( extents )
xEnd = caadr( extents )
yEnd = cadadr( extents )
cw = segment->isClockwise
if(cw then
ccw = "false"
else
ccw = "true"
)
angle1 = axlRadToDeg( atan2( ( yStart - yCenter ), ( xStart - xCenter ) ) )
; convert to positive angle
when( negativep( angle1 )
angle1 = angle1 + 360
)
angle2 = axlRadToDeg( atan2( ( yEnd - yCenter ), ( xEnd - xCenter ) ) )
; convert to positive angle
when( negativep( angle2 )
angle2 = angle2 + 360
)
if( cw then
startAngle = angle2
endAngle = angle1
else
startAngle = angle1
endAngle = angle2
)
element = strcat(
"{\n\t\"type\": \"arc\",\n"
"\t\"center\": [" sprintf( nil "%f" xCenter ) ", " sprintf( nil "%f" yCenter ) "],\n"
"\t\"radius\": " sprintf( nil "%f" radius ) ",\n"
"\t\"alpha\": " sprintf( nil "%f" startAngle ) ",\n"
"\t\"beta\": " sprintf( nil "%f" endAngle ) ",\n"
"\t\"ccw\": " ccw "\n"
"}"
)
)
)
procedure( makeCircle( xy diameter )
let( ( element )
element = strcat(
"{\n\t\"type\": \"circle\",\n"
"\t\"x\": " sprintf( nil "%f" xCoord( xy ) ) ",\n"
"\t\"y\": " sprintf( nil "%f" yCoord( xy ) ) ",\n"
"\t\"radius\": " sprintf( nil "%f" diameter/2 ) "\n"
"}"
)
)
)
procedure( rotateXY( origin xy angle )
let( ( angleRad dX dY dXY x y )
angleRad = axlDegToRad( angle )
dX = xCoord( xy ) - xCoord( origin )
dY = yCoord( xy ) - yCoord( origin )
dXY = list( dX dY )
x = xCoord( origin ) + xCoord( dXY ) * cos( angleRad ) - yCoord( dXY ) * sin( angleRad )
y = yCoord( origin ) + xCoord( dXY ) * sin( angleRad ) + yCoord( dXY ) * cos( angleRad )
list( x y )
)
)
procedure( makeSlot( pin padstack )
let( ( xy x y rotation drillOffset xDrillOffset yDrillOffset drillSizeWidth drillSizeHeight slot radius xCenter yCenter xyCenter alpha beta ccw segment )
; get coordinates
xy = pin->xy
x = xCoord( xy )
y = yCoord( xy )
rotation = pin->rotation
drillOffset = padstack->drillOffset
xDrillOffset = xCoord( drillOffset) + x
yDrillOffset = yCoord( drillOffset) + y
; calculate origin (drilloffset)
xy = rotateXY( list( x y ) list( xDrillOffset yDrillOffset ) rotation )
x = xCoord( xy )
y = yCoord( xy )
drillSizeWidth = padstack->drillSizeWidth
drillSizeHeight = padstack->drillSizeHeight
; if slot is actually a hole
if( drillSizeWidth == drillSizeHeight then
slot = makeCircle( x y drillSizeWidth )
else
; default state is drillSizeWidth < drillSizeHeight
; otherwise swap both and add 90 deg rotation
unless( drillSizeHeight >= drillSizeWidth
tmp = drillSizeWidth
drillSizeWidth = drillSizeHeight
drillSizeHeight = tmp
rotation = rotation + 90.0
)
; calculate radius
radius = drillSizeWidth / 2
; make first half circle
xCenter = x
yCenter = y + ( drillSizeHeight - drillSizeWidth ) / 2
; apply rotation
xyCenter = rotateXY( xy list( xCenter yCenter ) rotation )
xCenter = xCoord( xyCenter )
yCenter = yCoord( xyCenter )
; calculate angles
alpha = 0.0 + rotation
beta = 180.0 + rotation
alpha = modf( alpha 360.0 )
beta = modf( beta 360.0 )
ccw = "false"
segment = strcat(
"{\n\t\"type\": \"arc\",\n"
"\t\"center\": [" sprintf( nil "%f" xCenter ) ", " sprintf( nil "%f" yCenter ) "],\n"
"\t\"radius\": " sprintf( nil "%f" radius ) ",\n"
"\t\"alpha\": " sprintf( nil "%f" alpha ) ",\n"
"\t\"beta\": " sprintf( nil "%f" beta ) ",\n"
"\t\"ccw\": " ccw "\n"
"}"
)
slot = tconc( nil segment )
; make first line
xStart = x - radius
yStart = y + ( drillSizeHeight - drillSizeWidth ) / 2
xEnd = x - radius
yEnd = y - ( drillSizeHeight - drillSizeWidth ) / 2
; apply rotation
xyStart = rotateXY( xy list( xStart yStart ) rotation )
xStart = xCoord( xyStart )
yStart = yCoord( xyStart )
xyEnd = rotateXY( xy list( xEnd yEnd ) rotation )
xEnd = xCoord( xyEnd )
yEnd = yCoord( xyEnd )
segment = strcat(
"{\n\t\"type\": \"segment\",\n"
"\t\"start\": [" sprintf( nil "%f" xStart ) ", " sprintf( nil "%f" yStart ) "],\n"
"\t\"end\": [" sprintf( nil "%f" xEnd ) ", " sprintf( nil "%f" yEnd ) "]\n"
"}"
)
tconc( slot segment )
; make last half circle
xCenter = x
yCenter = y - ( drillSizeHeight - drillSizeWidth ) / 2
; apply rotation
xyCenter = rotateXY( xy list( xCenter yCenter ) rotation )
xCenter = xCoord( xyCenter )
yCenter = yCoord( xyCenter )
; calculate angles
alpha = 180.0 + rotation
beta = 360.0 + rotation
alpha = modf( alpha 360.0 )
beta = modf( beta 360.0 )
ccw = "true"
segment = strcat(
"{\n\t\"type\": \"arc\",\n"
"\t\"center\": [" sprintf( nil "%f" xCenter ) ", " sprintf( nil "%f" yCenter ) "],\n"
"\t\"radius\": " sprintf( nil "%f" radius ) ",\n"
"\t\"alpha\": " sprintf( nil "%f" alpha ) ",\n"
"\t\"beta\": " sprintf( nil "%f" beta ) ",\n"
"\t\"ccw\": " ccw "\n"
"}"
)
tconc( slot segment )
; make last line
xStart = x + radius
yStart = y - ( drillSizeHeight - drillSizeWidth ) / 2
xEnd = x + radius
yEnd = y + ( drillSizeHeight - drillSizeWidth ) / 2
; apply rotation
xyStart = rotateXY( xy list( xStart yStart ) rotation )
xStart = xCoord( xyStart )
yStart = yCoord( xyStart )
xyEnd = rotateXY( xy list( xEnd yEnd ) rotation )
xEnd = xCoord( xyEnd )
yEnd = yCoord( xyEnd )
segment = strcat(
"{\n\t\"type\": \"segment\",\n"
"\t\"start\": [" sprintf( nil "%f" xStart ) ", " sprintf( nil "%f" yStart ) "],\n"
"\t\"end\": [" sprintf( nil "%f" xEnd ) ", " sprintf( nil "%f" yEnd ) "]\n"
"}"
)
tconc( slot segment )
)
; return slot
car( slot )
)
)
procedure( boardGeometryParseSegment( segment )
let( ( element )
case( segment->objType
(
"line"
element = makeLine( segment )
)
(
"arc"
element = makeArc( segment )
)
(
t
warn( "Unknown segment ...\n")
)
)
element
)
)
procedure( calculateBoardThickness()
let( ( stackup padToPadThickness topSoldermaskThickness bottomSoldermaskThickness )
stackup = axlXSectionGet( nil 'all )
padToPadThickness = 0.0
topSoldermaskThickness = 0.0
bottomSoldermaskThickness = 0.0
foreach( layer stackup
case( layer->layerType
(
"CONDUCTOR"
padToPadThickness += layer->thickness
)
(
"DIELECTRIC"
padToPadThickness += layer->thickness
)
(
"MASK"
if( layer->name == "SOLDERMASK_TOP" then
topSoldermaskThickness = layer->thickness
else
bottomSoldermaskThickness = layer->thickness
)
; printf( "material: %s\n" layer->name )
)
(
"PLANE"
padToPadThickness += layer->thickness
)
(
t
)
)
)
list( topSoldermaskThickness padToPadThickness bottomSoldermaskThickness)
)
)
procedure( makePcbContour( dsn )
let( ( outline segments ( edges 'unbound ) ( cut 'unbound ) ( cuts 'unbound ) )
; make pcb geometry
outline = dsn->designOutline
segments = outline->segments
foreach( segment segments
; parse segment
element = boardGeometryParseSegment( segment )
if( boundp( 'edges ) then
tconc( edges element )
else
edges = tconc( nil element )
)
)
; make cutouts
cutouts = axlDBGetShapes( "BOARD GEOMETRY/CUTOUT" )
when( cutouts
foreach( cutout cutouts
segments = cutout->segments
foreach( segment segments
; parse segment
element = boardGeometryParseSegment( segment )
if( boundp( 'cut ) then
tconc( cut element )
else
cut = tconc( nil element )
)
)
cut = buildString( car( cut ) ",\n" )
cut = strcat(
"[\n"
addIndent( cut )
"\n]"
)
if( boundp( 'cuts ) then
tconc( cuts cut )
else
cuts = tconc( nil cut )
)
cut = 'unbound
)
)
unless( boundp( 'cuts )
cuts = nil
)
; return
list( edges cuts )
)
)
procedure( symbolReturn3DElements( refDes )
let( ( stepPackageMapping dbid sym mappingData stepFileName offset_x offset_y offset_z rotation_x rotation_y rotation_z isMirrored xy angle hole ( holes 'unbound ) )
stepPackageMapping = nil
; get symbol (dbid)
dbid = axlDBFindByName( 'refdes refDes )
sym = dbid->symbol
; step package mappingData
mappingData = axlStepGet( nil nil sym )
stepFileName = mappingData->step_name
offset_x = mappingData->offset_x
offset_y = mappingData->offset_y
offset_z = mappingData->offset_z
rotation_x = mappingData->rotation_x
rotation_y = mappingData->rotation_y
rotation_z = mappingData->rotation_z
; symbol
if( sym->isMirrored then
isMirrored = "true"
else
isMirrored = "false"
)
xy = sym->xy
angle = sym->rotation
; set step package mapping
when( stepFileName
stepPackageMapping = strcat(
"\"" sprintf( nil "%s" refDes ) "\": {\n"
"\t\"step_mapping\": {\n"
"\t\t\"step_name\": \"" sprintf( nil "%s" stepFileName ) "\",\n"
"\t\t\"rotation_x\": " sprintf( nil "%f" rotation_x ) ",\n"
"\t\t\"rotation_y\": " sprintf( nil "%f" rotation_y ) ",\n"
"\t\t\"rotation_z\": " sprintf( nil "%f" rotation_z ) ",\n"
"\t\t\"offset_x\": " sprintf( nil "%f" offset_x ) ",\n"
"\t\t\"offset_y\": " sprintf( nil "%f" offset_y ) ",\n"
"\t\t\"offset_z\": " sprintf( nil "%f" offset_z ) "\n"
"\t},\n"
"\t\"is_mirrored\": " isMirrored ",\n"
"\t\"x\": " sprintf( nil "%f" xCoord( xy ) ) ",\n"
"\t\"y\": " sprintf( nil "%f" yCoord( xy ) ) ",\n"
"\t\"angle\": " sprintf( nil "%f" angle ) "\n"
"}"
)
)
stepPackageMapping
)
)
procedure( symbolReturnPinHoles()
let( ( symbols sym hole padstack xy element ( holes 'unbound ) )
symbols = axlDBGetDesign()->symbols
foreach( sym symbols
; export pin holes
foreach( pin sym->pins
when( pin->isThrough
; reset hole
hole = nil
; retrieve padstack information
padstack = axlLoadPadstack( pin->name )
; get position
xy = pin->xy
if( padstack->usage == "Slot" then
element = makeSlot( pin padstack )
hole = strcat(
"[\n"
addIndent( buildString( element ",\n" ) )
"\n]"
)
else
; make a simple drill hole
hole = makeCircle( xy padstack->drillDiameter )
hole = strcat(
"[\n"
addIndent( hole )
"\n]"
)
)
when( hole
if( boundp( 'holes ) then
tconc( holes hole )
else
holes = tconc( nil hole )
)
)
)
)
)
if( boundp( 'holes ) then
holes = car( holes )
holes = buildString( holes ",\n" )
else
holes = nil
)
; return holes
holes
)
)
procedure( makePcb( thicknesses edges cuts )
let( ()
if( boundp( 'cuts ) then
edges = strcat(
"\"pcb\": {\n"
"\t\"thickness\": {\n"
"\t\t\"soldermask_top\": " sprintf( nil "%f" car( thicknesses ) ) ",\n"
"\t\t\"board\": " sprintf( nil "%f" cadr( thicknesses ) ) ",\n"
"\t\t\"soldermask_bottom\": " sprintf( nil "%f" caddr( thicknesses ) ) "\n"
"\t},\n"
"\t\"edges\": [\n"
"\t\t[\n"
addIndent(
buildString( car( edges ) ",\n" ),
3
)
"\n\t\t],\n"
addIndent(
buildString( car( cuts ) ",\n" ),
2
)
"\n\t]\n}"
)
else
edges = strcat(
"\"pcb\": {\n"
"\t\"thickness\": " sprintf( nil "%f" 1.67 ) ",\n"
"\t\"edges\": [\n"
"\t\t[\n"
addIndent(
buildString( car( edges ) ",\n" ),
3
)
"\n\t\t]\n\t]\n}"
)
)
)
)
procedure( create3dIntermediateFormat( thicknesses edgeCuts symbols fileName )
let( ( ( stepModelPlacements 'unbound ) ( edges 'unbound ) ( cut 'unbound ) ( cuts 'unbound ) )
; reset base board contour
when( car( edgeCuts )
edges = car( edgeCuts )
)
when( cadr( edgeCuts )
cuts = cadr( edgeCuts )
)
; export step package mapping information
foreach( symbol symbols
placement = symbolReturn3DElements( symbol )
when( placement
if( boundp( 'stepModelPlacements ) then
tconc( stepModelPlacements placement )
else
stepModelPlacements = tconc( nil placement )
)
)
)
; export symbol pin holes
cut = symbolReturnPinHoles()
when( cut
if( boundp( 'cuts ) then
tconc( cuts cut )
else
cuts = tconc( nil cut )
)
)
; make pcb (including all cutouts and holes)
pcb = makePcb( thicknesses edges cuts )
; write step model placement informations
stepModelPlacements = buildString( car( stepModelPlacements) ",\n" )
; write to file
outFile = fileName
outPort = outfile( outFile )
; to prevent fprintf insufficient memory error
lines = parseString( strcat( pcb ",\n" stepModelPlacements ) "\n" )
fprintf( outPort "{\n")
foreach( line lines
fprintf( outPort strcat( "\t" line ) )
fprintf( outPort "\n" )
)
fprintf( outPort "}\n")
close( outPort )
t
)
)
procedure( makeVariant3dIntermediates( dir )
let( ( ( variantFile "Variants.lst" ) dsnName dsn thicknesses edgeCuts variantInformation variantSymbolList alternateParts variant symbols fileName thicknesses elements placement outFile outPort pcb lines )
; get design and design name
dsnName = axlCurrentDesign()
dsn = axlDBGetDesign()
; create dir
unless( isDir( dir )
createDir( dir )
)
; calculate pcb thickness
thicknesses = calculateBoardThickness()
; make pcb contour
edgeCuts = makePcbContour( dsn )
if( isFile( variantFile ) then
; Read / parse variant list
variantInformation = getVariantInfo()
if( variantInformation then
variantSymbolList = car( variantInformation )
alternateParts = cadr( variantInformation )
foreach( variant variantSymbolList
printf( "Exporting .json for variant: %s\n" variant )
; if variant has alternate parts, add them to the symbol list
if( boundp( 'alternateParts ) then
symbols = append( variantSymbolList[variant] alternateParts[variant]~>? )
else
symbols = variantSymbolList[variant]
)
fileName = strcat( dir "/" dsnName "_" variant ".json" )
create3dIntermediateFormat( thicknesses edgeCuts symbols fileName )
)
print( "Export complete!" )
else
error( "No variant information could be read!" )
)
else
; export all symbols, if no variant.lst can be found
warn( "No variant information present!\n Exporting all components!" )
; get all symbols
symbols = mapcar( lambda( ( symbol ) when( symbol->refdes symbol->refdes ) ) dsn->symbols )
; remove nils
symbols = remd( nil symbols )
fileName = strcat( dir "/" dsnName "_CORE" ".json" )
create3dIntermediateFormat( thicknesses edgeCuts symbols fileName )
)
)
)