-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPCBReview.il
2059 lines (1492 loc) · 54.9 KB
/
PCBReview.il
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
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;###########################################################################
;# #
;# sets useful views for reviewign a PCB
;#
;#
;# SIDE EFFECTS
;# - modifies colors 188-192 in the palette
;# - adds 5 text blocks
;###########################################################################
/*
History:
0.4 set form defaults for all but fixed text
0.5 re-wrote ignore fixed code to be like the rest of the code (use globals vars)
0.6 add display layers to processing
0.7 handle mirror/no-mirror of bottom layer text
0.8 started add color selection field
0.9 remove locked code (always perform)
0.10 remove mirror bottom checkbox (never mirror)
0.11 remove junk code and add display priority for all REFDES layers
0.12 apply color from assembly to other layers and add vicibility vars for each layer
0.13 add color swatch and processing for bottom layers
0.14 rename booleans for which layers ot process
0.15 use own text blocks deinfitions
0.16 fix centering of text based on height of text used
0.17 update view at start and after any form change
0.18 updated GUI for top layer
0.19 updated bottom layer GUI
1.0 released with "review" as command name
1.1 mostly done with V2.0 development
1.2 implemented rotation of text based on aspect ratio of the bounds
1.3 set board outline as active layer. don't change visible layers other than ref des layers
1.4 fixed bug: bounds gets destroyed the second time you run the script. fixed by only deleting text, not all
1.5 update GUI: separate buttons for copper
1.6 cteate rgb2HSL and HSL2rgb functions and dim the package boundry layers
1.7 add code for the bottom layer
2.0 change command from "r" to "review"
2.1 fixed - color hue bug
2.2 relabel pins on top
2.3 relabel pins on bottom
2.4 released
2.5 create new GUI
2.6 add hue and saturation buttons using objects functions for top copper
2.7 implemented everything for top copper. added color type and table of colors
2.8 top layer refs, outline and bounds.
2.9 added "Do All" button after refresh. have its own group to sectuion off from others. fixed bugs that caused it to crash durign relabel
2.10 added bottom layer and pin label functionality
2.11 fix pin label visibility. simplified code for pin labels. need to apply to rest. now two functions: initializeFromDatabase and updateView(apply changes from popup)
2.12 apply new code paradigm to top and bottom colors s well as refdes, outline, bounds
2.13 grid and custom colors checkboxes. updated help text and form layout.
2.14 shadow mode and controls. custom color sahdowing on/off
2.15 inner layers
2.17 redo refdes creation
instead of use package bounds list, get list of all symbols (figure out how to do this)
use bBox and xy from symbol props
test with 75G5-X2_1 REVC U33
fixed bug: Recolor was causing error because pin label color "BrightYellow" didn;t exist
2.18 list inner layers vertically
2.19 draw all outlines on package display layers. then use that instead so that we have outline not patches (this helps tremendously for printing out)
add these new layer to layer priority list
only change priority list when clickign "setview"
TODO:
recolor of inner layers:
- display vias and pins of inner layers
- define a bunch of colors (at least 14 more)
- implement all the colordefs functions
- recolor: choose 16-24 colors and then cycle through them if more than max amount
- implemnt DRC checkbox by looping through all layers
- set view: include display of assembly notes layer. check that it turns of registration in 68INT board
- include layers that show ground plane divisions (see MOD-SX2--DS-2CH-2-OUT-LO--REVA, MOD-SX2--DS-3CH-OUT-LO--REVA, MOD-SX2--REF-2CH-OUT-LO--REVC)
- create View>Colow View Save fiels (perhaps just hard code and write to files)
-display nets: doesn;t work because there are three variables in Setup window but only one in programming i/f. set works and controls Clines but get doesn't work. see cadence reply. open a ticket
-rats: have to loop through all nets "rats all"
axlClearSelSet()
axlSetFindFilter(?enabled list( "noall" "nets")
ratsnestOn is attrubute
name is another attribute
NOTES
- code indentation is made with tabs (not spaces)
*/
;##########################
;# Register Program Name #
;##########################
axlCmdRegister("r" 'pcbreview)
;axlCmdRegister("review" 'pcbreview)
;#############################
;# MAIN Program Starts Here. #
;#############################
(defun pcbreview ()
; ==== Initialize Global Variables ====
vers_major = 2
vers_minor = 19
; --------------- Text Style Objects ----------------------
axlDBTextBlockCompact(t)
numUnalteredTextBlocks = axlDBControl('maxTextBlock)
; define our text blocks structure
;printf( "txtstyle_t exists: %s\n", symeval( 'txtstyle_t ) )
if( symeval('txtstyle_t)=='unbound then
defstruct( txtstyle_t str_name blockNum width photoWidth lineSpace height charSpace )
)
; define our text block (ie fonts)
styleList = list()
printf(" length=%L \n", length(styleList))
txt_tiny = make_txtstyle_t( ?str_name "tiny" ?blockNum 0 ?width 4.0 ?height 6.0 ?lineSpace 8.0 ?photoWidth 1.0 ?charSpace 0.0 )
txt_xsmall = make_txtstyle_t( ?str_name "xsmall" ?blockNum 0 ?width 8.0 ?height 10.0 ?lineSpace 15.0 ?photoWidth 2.0 ?charSpace 2.0 )
txt_small = make_txtstyle_t( ?str_name "small" ?blockNum 0 ?width 15.0 ?height 20.0 ?lineSpace 25.0 ?photoWidth 3.0 ?charSpace 5.0 )
txt_medium = make_txtstyle_t( ?str_name "medium" ?blockNum 0 ?width 25.0 ?height 32.0 ?lineSpace 63.0 ?photoWidth 4.0 ?charSpace 9.0 )
txt_large = make_txtstyle_t( ?str_name "large" ?blockNum 0 ?width 38.0 ?height 50.0 ?lineSpace 63.0 ?photoWidth 7.0 ?charSpace 13.0 )
txt_xlarge = make_txtstyle_t( ?str_name "xlarge" ?blockNum 0 ?width 60.0 ?height 80.0 ?lineSpace 100.0 ?photoWidth 8.0 ?charSpace 20.0)
sym_savex = -1
sym_savey = -1
sym_saveparent = nil
; ---------- color definitions -------------------------------
if( symeval('colordef_t)=='unbound then
defstruct( colordef_t label hsl colorFamilies )
)
COLORFAMILY_RED = 1
COLORFAMILY_ORANGE = 2
COLORFAMILY_YELLOW = 3
COLORFAMILY_GREEN = 4
COLORFAMILY_BLUE = 5
COLORFAMILY_PURPLE = 6
COLORFAMILY_MAGENTA = 7
; colro names and definitions from here
;https://en.wikipedia.org/wiki/Web_colors#HTML_color_names
addColorDef("Red", '( 0.0 1.0 0.5), '(COLORFAMILY_RED))
addColorDef("BrightOrange", '( 20.125 1.0 0.5), '(COLORFAMILY_ORANGE))
addColorDef("PureOrange", '( 30.0 1.0 0.5), '(COLORFAMILY_ORANGE))
addColorDef("Orange", '( 38.82353 1.0 0.5), '(COLORFAMILY_ORANGE))
addColorDef("Yellow", '( 60.00 1.0 0.5), '(COLORFAMILY_YELLOW))
addColorDef("YellowGreen", '( 90.00 1.0 0.5), '(COLORFAMILY_YELLOW))
addColorDef("Chartreuse", '( 90.11765 1.0 0.5), '(COLORFAMILY_YELLOW))
addColorDef("Lime", '( 120.0 1.0 0.5), '(COLORFAMILY_GREEN))
addColorDef("SpringGreen", '( 149.8824 1.0 0.5), '(COLORFAMILY_GREEN))
addColorDef("GreenBlue", '( 150.0 1.0 0.5), '(COLORFAMILY_GREEN))
addColorDef("Cyan", '( 180.0 1.0 0.5), '(COLORFAMILY_GREEN))
addColorDef("DeepSkyBlue", '( 195.0588 1.0 0.5), '(COLORFAMILY_BLUE))
addColorDef("PrimarySchoolBlue", '( 210.0 1.0 0.5), '(COLORFAMILY_BLUE))
addColorDef("Blue", '( 240.0 1.0 0.5), '(COLORFAMILY_BLUE))
addColorDef("Purple", '(300.0 1.0 0.25), '(COLORFAMILY_PURPLE))
addColorDef("Magenta", '( 300.0 1.0 0.5), '(COLORFAMILY_MAGENTA))
addColorDef("White", '( 0.0 0.0 1.0), '())
addColorDef("Black", '( 0.0 0.0 0.0), '())
; --------------- Layer Objects ----------------------
if( symeval('layerObj_t)=='unbound then
defstruct( layerObj_t label isVisible colorNum defaultHSL defaultColorName layer tiedLayers hasVisibilityField hasColorField)
)
nextColorNum = 192
; --------- TOP LAYERS -----------
top_etch_layer = "ETCH/TOP"
top_pin_layer = "PIN/TOP"
top_via_layer = "VIA CLASS/TOP"
top_copper = make_layerObj_t( ?label "Top_Copper" ?layer top_etch_layer ?tiedLayers list(top_pin_layer, top_via_layer) ?colorNum nextColorNum ?defaultColorName "Lime" ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
; defualt color for top ref des
newHSLColor = getColorDefByLabel(top_copper->defaultColorName)->hsl
newHSLColor = incrLightnessBy(newHSLColor, 0.255)
newHSLColor = decrHueBy(newHSLColor, 30)
; we use the display layer for ref des so as to not mess up the gerber files
top_refdes_disp_layer = "REF DES/DISPLAY_TOP"
top_refdes_silk_layer = "REF DES/SILKSCREEN_TOP"
top_refdes_assy_layer = "REF DES/ASSEMBLY_TOP"
top_refdes_disp = make_layerObj_t( ?label "Top_RefDes_Disp" ?layer top_refdes_disp_layer ?tiedLayers list() ?colorNum nextColorNum ?defaultHSL newHSLColor ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
top_refdes_silk = make_layerObj_t( ?label "Top_RefDes_Silk" ?layer top_refdes_silk_layer ?tiedLayers list() ?colorNum getLayerColorNum(top_refdes_silk_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
top_refdes_assy = make_layerObj_t( ?label "Top_RefDes_Assy" ?layer top_refdes_assy_layer ?tiedLayers list() ?colorNum getLayerColorNum(top_refdes_assy_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
; defualt color for top outline
newHSLColor = getColorDefByLabel(top_copper->defaultColorName)->hsl
newHSLColor = decrLightnessBy(newHSLColor, 0.255)
top_package_outline_disp_layer = "PACKAGE GEOMETRY/DISPLAY_TOP"
top_package_outline_silk_layer = "PACKAGE GEOMETRY/SILKSCREEN_TOP"
top_package_outline_assy_layer = "PACKAGE GEOMETRY/ASSEMBLY_TOP"
top_package_outline_disp = make_layerObj_t( ?label "Top_Outline_Disp" ?layer top_package_outline_disp_layer ?tiedLayers list() ?colorNum nextColorNum ?defaultHSL newHSLColor ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
top_package_outline_silk = make_layerObj_t( ?label "Top_Outline_Silk" ?layer top_package_outline_silk_layer ?tiedLayers list() ?colorNum getLayerColorNum(top_package_outline_silk_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
top_package_outline_assy = make_layerObj_t( ?label "Top_Outline_Assy" ?layer top_package_outline_assy_layer ?tiedLayers list() ?colorNum getLayerColorNum(top_package_outline_assy_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
; defualt color for top placement bounds
newHSLColor = getColorDefByLabel(top_copper->defaultColorName)->hsl
newHSLColor = incrLightnessBy(newHSLColor, 0.255)
top_package_bounds = make_layerObj_t( ?label "Top_Bounds" ?layer "PACKAGE GEOMETRY/PLACE_BOUND_TOP" ?tiedLayers list() ?colorNum nextColorNum ?defaultHSL newHSLColor ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
; --------- BOTTOM LAYERS -----------
bottom_etch_layer = "ETCH/BOTTOM"
bottom_pin_layer = "PIN/BOTTOM"
bottom_via_layer = "VIA CLASS/BOTTOM"
bottom_copper = make_layerObj_t( ?label "Bottom_Copper" ?layer bottom_etch_layer ?tiedLayers list(bottom_pin_layer, bottom_via_layer) ?colorNum nextColorNum ?defaultColorName "DeepSkyBlue" ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
; defualt color for bottom ref des
newHSLColor = getColorDefByLabel(bottom_copper->defaultColorName)->hsl
newHSLColor = incrLightnessBy(newHSLColor, 0.255)
newHSLColor = decrHueBy(newHSLColor, 30)
; we use the display layer for ref des so as to not mess up the gerber files
bottom_refdes_disp_layer = "REF DES/DISPLAY_BOTTOM"
bottom_refdes_silk_layer = "REF DES/SILKSCREEN_BOTTOM"
bottom_refdes_assy_layer = "REF DES/ASSEMBLY_BOTTOM"
bottom_refdes_disp = make_layerObj_t( ?label "Bottom_RefDes_Disp" ?layer bottom_refdes_disp_layer ?tiedLayers list() ?colorNum nextColorNum ?defaultHSL newHSLColor ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
bottom_refdes_silk = make_layerObj_t( ?label "Bottom_RefDes_Silk" ?layer bottom_refdes_silk_layer ?tiedLayers list() ?colorNum getLayerColorNum(bottom_refdes_silk_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
bottom_refdes_assy = make_layerObj_t( ?label "Bottom_RefDes_Assy" ?layer bottom_refdes_assy_layer ?tiedLayers list() ?colorNum getLayerColorNum(bottom_refdes_assy_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
; defualt color for bottom outline
newHSLColor = getColorDefByLabel(bottom_copper->defaultColorName)->hsl
newHSLColor = decrLightnessBy(newHSLColor, 0.255)
bottom_package_outline_disp_layer = "PACKAGE GEOMETRY/DISPLAY_BOTTOM"
bottom_package_outline_silk_layer = "PACKAGE GEOMETRY/SILKSCREEN_BOTTOM"
bottom_package_outline_assy_layer = "PACKAGE GEOMETRY/ASSEMBLY_BOTTOM"
bottom_package_outline_disp = make_layerObj_t( ?label "Bottom_Outline_Disp" ?layer bottom_package_outline_disp_layer ?tiedLayers list() ?colorNum nextColorNum ?defaultHSL newHSLColor ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
bottom_package_outline_silk = make_layerObj_t( ?label "Bottom_Outline_Silk" ?layer bottom_package_outline_silk_layer ?tiedLayers list() ?colorNum getLayerColorNum(bottom_package_outline_silk_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
bottom_package_outline_assy = make_layerObj_t( ?label "Bottom_Outline_Assy" ?layer bottom_package_outline_assy_layer ?tiedLayers list() ?colorNum getLayerColorNum(bottom_package_outline_assy_layer) ?defaultHSL nil ?hasVisibilityField nil ?hasColorField nil)
; defualt color for bottom placement bounds
newHSLColor = getColorDefByLabel(bottom_copper->defaultColorName)->hsl
newHSLColor = incrLightnessBy(newHSLColor, 0.255)
bottom_package_bounds = make_layerObj_t( ?label "Bottom_Bounds" ?layer "PACKAGE GEOMETRY/PLACE_BOUND_BOTTOM" ?tiedLayers list() ?colorNum nextColorNum ?defaultHSL newHSLColor ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
; --------- INNER LAYERS -----------
Etch_Layers=(axlGetParam("paramLayerGroup:ETCH")->groupMembers)
Nlayers = length(Etch_Layers)
printf(" Nlayers=%L \n",Nlayers)
innerLayerCopperList = list()
printf(" length(innerLayerCopperList)=%L\n",length(innerLayerCopperList))
n=1
(foreach layer Etch_Layers
etch_layer = strcat("ETCH/",layer)
layerLabel = titleCase(layer)
printf(" layer=%s %s\n",layer, layerLabel)
if( n>1 && n<Nlayers then
printf(" make_layerObj_t=%s\n",layerLabel)
layerObj = make_layerObj_t( ?label layerLabel ?layer etch_layer ?tiedLayers nil ?colorNum nextColorNum ?defaultColorName "DeepSkyBlue" ?hasVisibilityField t ?hasColorField t)
innerLayerCopperList = append1(innerLayerCopperList, layerObj)
printf(" length(innerLayerCopperList)=%L\n",length(innerLayerCopperList))
nextColorNum = nextColorNum - 1
)
n = n + 1
);
(foreach layerObj innerLayerCopperList
printf("%s isVisible=%L \n",layerObj->label, layerObj->isVisible)
)
; --------- OTHER LAYERS -----------
;board outline
board_outline = make_layerObj_t( ?label "Board_Outline" ?layer "BOARD GEOMETRY/OUTLINE" ?tiedLayers '() ?colorNum nextColorNum ?defaultColorName "Red" ?hasVisibilityField nil ?hasColorField nil)
nextColorNum = nextColorNum - 1
; pin labels
pin_labels = make_layerObj_t( ?label "Pin_Labels" ?layer "PACKAGE GEOMETRY/PIN_NUMBER" ?tiedLayers '() ?colorNum nextColorNum ?defaultColorName "White" ?hasVisibilityField t ?hasColorField t)
nextColorNum = nextColorNum - 1
; these are set in initializeFromDatabase()
showNetLabels = nil
showGrid = nil
showCustomColors = nil
shadowModeOn = nil
dimActiveLayerOn = nil
dimCustomColorsOn = nil
brightnessPercent = 100
globalTransparencyPercent = 100
shapeTransparencyPercent = 100
; listOfNames = axlDBDisplayControl(nil)
; printf("\naxlDBDisplayControl NAMES: \n")
; foreach( dispName listOfNames
; printf(" %L \n",dispName)
; )
; listOfNames = axlDBControl(nil)
; printf("\naxlDBControl NAMES: \n")
; foreach( dispName listOfNames
; printf(" %L \n",dispName)
; )
initializeFromDatabase()
; ---------- Create the Form (popup window) ---------------------
;SetupDir(); Commented out DE 26-Jan-11
FormDir = "./"; Inserted DE 26-Jan-11
if( axlOKToProceed() then
; ==== Create and Display the User Interface ====
createModRDForm()
fFile = strcat( FormDir "modRDForm.form" )
Form = axlFormCreate( (gensym) fFile nil 'modRDForm_Action t)
updateView() ; sets the form values
axlFormDisplay( Form )
else
printf("E- Please terminate your interactive command .\n")
);endif OKToProceed
); end defun - MAIN Program
;###########################################################
;# Form CallBacks - Determine Allegro command to execute #
;# based on the user's selection #
;###########################################################
(defun modRDForm_Action (Form)
field = Form->curField
val = Form->curValue
; TOP GROUP
processActionForColorSet(field, val, top_copper)
processActionForColorSet(field, val, top_refdes_disp)
processActionForColorSet(field, val, top_package_outline_disp)
processActionForColorSet(field, val, top_package_bounds)
; BOTTOM GROUP
processActionForColorSet(field, val, bottom_copper)
processActionForColorSet(field, val, bottom_refdes_disp)
processActionForColorSet(field, val, bottom_package_outline_disp)
processActionForColorSet(field, val, bottom_package_bounds)
processActionForColorSet(field, val, pin_labels)
(foreach layerObj innerLayerCopperList
processActionForColorSet(field, val, layerObj)
)
(case field
("ShowNetLabels"
showNetLabels = val
printf("showNetLabels =%L \n", showNetLabels)
)
("ShowGrid"
showGrid = val
printf("showGrid =%L \n", showGrid)
)
("DisableCustomColors"
showCustomColors = !val
printf("showCustomColors =%L \n", showCustomColors)
)
("ShadowMode"
shadowModeOn = val
printf("shadowModeOn =%L \n", shadowModeOn)
)
("DimActiveLayer"
dimActiveLayerOn = val
printf("dimActiveLayerOn =%L \n", dimActiveLayerOn)
)
("DimCustomColors"
dimCustomColorsOn = val
printf("dimCustomColorsOn =%L \n", dimCustomColorsOn)
)
("Brightness"
brightnessPercent = val
printf("brightnessPercent =%L \n", brightnessPercent)
)
("GlobalTransparency"
globalTransparencyPercent = val
printf("globalTransparencyPercent =%L \n", globalTransparencyPercent)
)
("ShapeTransparency"
shapeTransparencyPercent = val
printf("shapeTransparencyPercent =%L \n", shapeTransparencyPercent)
)
("Relabel"
reLabel()
)
("Recolor"
reColor()
)
("SetView"
setView()
)
("Refresh"
initializeFromDatabase()
)
("RunAll"
reLabel()
reColor()
setView()
)
("Close"
(axlFormClose Form)
(axlCancelEnterFun)
deleteFile( fFile )
) ; end "Close"
) ; end case
updateView()
) ; end defun - modRDForm_Action
;#########################
;# End Form CallBacks #
;#########################
(defun processActionForColorSet (field, val, layerObj)
label = layerObj->label
colornum = layerObj->colorNum
color_field = strcat("Color_", label)
;printf("field=%L value=%L label=%L\n", field, val, label)
cond(
( equal(field, strcat("Show_", label))
layerObj->isVisible = val
)
( equal(field, strcat("Color_", label))
rgb = axlColorGet(colornum)
rgb = axlUIColorDialog(Form rgb) ; if user presses cancel button in popu, the return value is nil
when(rgb
updateColorNum(colornum, rgb)
)
)
( equal(field, strcat("Color_", label, "_HuePlus"))
rgb = axlColorGet(colornum)
hsl = incrHue(rgb2hsl(rgb))
updateColorNum(colornum, hsl2rgb(hsl))
)
( equal(field, strcat("Color_", label, "_HueMinus"))
rgb = axlColorGet(colornum)
hsl = decrHue(rgb2hsl(rgb))
updateColorNum(colornum, hsl2rgb(hsl))
)
( equal(field, strcat("Color_", label, "_SaturationPlus"))
rgb = axlColorGet(colornum)
hsl = incrSaturation(rgb2hsl(rgb))
updateColorNum(colornum, hsl2rgb(hsl))
)
( equal(field, strcat("Color_", label, "_SaturationMinus"))
rgb = axlColorGet(colornum)
hsl = decrSaturation(rgb2hsl(rgb))
updateColorNum(colornum, hsl2rgb(hsl))
)
( equal(field, strcat("Color_", label, "_LightPlus"))
rgb = axlColorGet(colornum)
printf( "RGB=%L HS=%L \n", rgb, rgb2hsl(rgb))
hsl = incrLightness(rgb2hsl(rgb))
updateColorNum(colornum, hsl2rgb(hsl))
)
( equal(field, strcat("Color_", label, "_LightMinus"))
rgb = axlColorGet(colornum)
hsl = decrLightness(rgb2hsl(rgb))
updateColorNum(colornum, hsl2rgb(hsl))
)
)
)
;###########################################################
;# createTitleBlockForm - Main User Interface Form #
;# Brought up by executing command. #
;###########################################################
(defun createModRDForm ()
fFile = strcat( FormDir "modRDForm.form" )
Form = outfile( fFile "w")
xcol1 = 3
xcol2 = 38
xgroup = 2
width_group = 66
fprintf(Form "FILE_TYPE=FORM_DEFN VERSION=2\n")
fprintf(Form "FORM \n")
fprintf(Form "FIXED\n")
fprintf(Form "PORT 75 1\n") ; height is automatically caluclated
fprintf(Form "HEADER \"PCB Review V%L.%L\"\n", vers_major, vers_minor)
fprintf(Form "TILE\n")
; TOP GROUP
yref = 0
fprintf(Form "GROUP \"Top Layer\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d 7\n", width_group)
fprintf(Form "ENDGROUP\n")
createFormColorSet(Form, xcol1, yref+2, top_copper->label, "Copper")
createFormColorSet(Form, xcol2, yref+2, top_refdes_disp->label, "RefDes")
createFormColorSet(Form, xcol1, yref+4, top_package_outline_disp->label, "Outline")
createFormColorSet(Form, xcol2, yref+4, top_package_bounds->label, "Bounds")
; BOTTOM GROUP
yref = 7
fprintf(Form "GROUP \"Bottom Layer\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d 7\n", width_group)
fprintf(Form "ENDGROUP\n")
createFormColorSet(Form, xcol1, yref+2, bottom_copper->label, "Copper")
createFormColorSet(Form, xcol2, yref+2, bottom_refdes_disp->label, "RefDes")
createFormColorSet(Form, xcol1, yref+4, bottom_package_outline_disp->label, "Outline")
createFormColorSet(Form, xcol2, yref+4, bottom_package_bounds->label, "Bounds")
; ------ pinsandnets -----------
yref = 14
fprintf(Form "GROUP \"\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d 5\n", width_group)
fprintf(Form "ENDGROUP\n")
createFormColorSet(Form, xcol1, yref+2, pin_labels->label, "Pin Labels")
fprintf(Form "FIELD \"ShowNetLabels\"\n")
fprintf(Form "FLOC %d %d \n", xcol2, yref+2)
fprintf(Form "CHECKLIST \"(Net Labels)\" \n")
fprintf(Form "ENDFIELD\n")
; ------ Misc -----------
yref = 19
fprintf(Form "GROUP \"\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d 7\n", width_group)
fprintf(Form "ENDGROUP\n")
fprintf(Form "FIELD \"DisableCustomColors\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+2)
fprintf(Form "CHECKLIST \"Disable Custom Colors\" \n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD \"DRC\"\n")
fprintf(Form "FLOC %d %d \n", xcol2, yref+2)
fprintf(Form "CHECKLIST \"(DRC) \" \n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD \"RatsNest\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+4)
fprintf(Form "CHECKLIST \"(Rats)\" \n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD \"ShowGrid\"\n")
fprintf(Form "FLOC %d %d \n", xcol2, yref+4)
fprintf(Form "CHECKLIST \"Grid\" \n")
fprintf(Form "ENDFIELD\n")
; ------ Shadow Mode -----------
; fprintf(Form "FIELD \"Brightness\"\n")
; fprintf(Form "FLOC 12 %d \n", ymisc+9)
; fprintf(Form "TRACKBAR 30 5\n")
; fprintf(Form "MIN 0\n")
; fprintf(Form "MAX 100\n")
; fprintf(Form "ENDFIELD\n")
yref = 26
fprintf(Form "GROUP \"\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d 8\n", width_group)
fprintf(Form "ENDGROUP\n")
fprintf(Form "FIELD \"ShadowMode\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+2)
fprintf(Form "CHECKLIST \"Shadow Mode\" \n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD \"DimActiveLayer\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+20, yref+2)
fprintf(Form "CHECKLIST \"Dim Active Layer\" \n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD \"DimCustomColors\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+41, yref+2)
fprintf(Form "CHECKLIST \"Dim Custom Colors\" \n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD \"Brightness\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+5)
fprintf(Form "INTSLIDEBAR 4 3\n")
fprintf(Form "MIN 0\n")
fprintf(Form "MAX 100\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "TEXT \"Brightness\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+8, yref+5)
fprintf(Form "FSIZE 10 2 \n")
fprintf(Form "ENDTEXT\n")
fprintf(Form "TEXT \"Transparency:\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+20, yref+5)
fprintf(Form "FSIZE 15 2 \n")
fprintf(Form "ENDTEXT\n")
fprintf(Form "FIELD \"GlobalTransparency\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+32, yref+5)
fprintf(Form "INTSLIDEBAR 4 3\n")
fprintf(Form "MIN 0\n")
fprintf(Form "MAX 100\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "TEXT \"Global\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+40, yref+5)
fprintf(Form "FSIZE 10 2 \n")
fprintf(Form "ENDTEXT\n")
fprintf(Form "FIELD \"ShapeTransparency\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+46, yref+5)
fprintf(Form "INTSLIDEBAR 4 3\n")
fprintf(Form "MIN 0\n")
fprintf(Form "MAX 100\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "TEXT \"Shape\"\n")
fprintf(Form "FLOC %d %d \n", xcol1+54, yref+5)
fprintf(Form "FSIZE 10 2 \n")
fprintf(Form "ENDTEXT\n")
; ---------------- INNER LAYERS -------------
yref = 34
Nby2 = Nlayers/2
;Ntotalrows = 2+2*(Nby2-2) + 3
Ntotalrows = 2*(Nlayers-2) + 3
fprintf(Form "GROUP \"Inner Layers\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d %d\n", width_group, Ntotalrows)
fprintf(Form "ENDGROUP\n")
yoffset = 2
xcol = (xcol1 + xcol2)/2
(foreach layerObj innerLayerCopperList
createFormColorSet(Form, xcol, yref+yoffset, layerObj->label, layerObj->label)
; if(xcol == xcol1 then
; xcol = xcol2
; else
; xcol = xcol1
; yoffset = yoffset + 2
; )
yoffset = yoffset + 2
)
; ---------------- BUTTONS -------------
yref = yref + Ntotalrows
fprintf(Form "GROUP \"\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE 53 5\n")
fprintf(Form "ENDGROUP\n")
fprintf(Form "FIELD Relabel\n")
fprintf(Form "FLOC 7 %d \n", yref+2)
fprintf(Form "MENUBUTTON \"Relabel\" 8 3\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD Recolor\n")
fprintf(Form "FLOC 18 %d \n", yref+2)
fprintf(Form "MENUBUTTON \"Recolor\" 8 3\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD SetView \n")
fprintf(Form "FLOC 29 %d \n", yref+2)
fprintf(Form "MENUBUTTON \"Set View\" 8 3\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "FIELD Refresh\n")
fprintf(Form "FLOC 40 %d \n", yref+2)
fprintf(Form "MENUBUTTON \"Refresh\" 8 3\n")
fprintf(Form "ENDFIELD\n")
fprintf(Form "GROUP \"\"\n")
fprintf(Form "GLOC 56 %d \n", yref)
fprintf(Form "GSIZE 12 5\n")
fprintf(Form "ENDGROUP\n")
fprintf(Form "FIELD RunAll\n")
fprintf(Form "FLOC 58 %d \n", yref+2)
fprintf(Form "MENUBUTTON \"Run All\" 8 3\n")
fprintf(Form "ENDFIELD\n")
; ---------------- NOTES -------------
yref = yref + 5
fprintf(Form "GROUP \"NOTES\"\n")
fprintf(Form "GLOC %d %d \n", xgroup, yref)
fprintf(Form "GSIZE %d 13\n", width_group)
fprintf(Form "ENDGROUP\n")
fprintf(Form "TEXT \"'Relabel' modifies and displays the reference designators on the RefDes display layer. Silkscreen and assembly layers are not changed.\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+2)
fprintf(Form "FSIZE 62 5 \n", width_group-2)
fprintf(Form "ENDTEXT\n")
fprintf(Form "TEXT \"'Recolor' re-colors all the layers shown above.\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+5)
fprintf(Form "FSIZE %d 2 \n", width_group-2)
fprintf(Form "ENDTEXT\n")
fprintf(Form "TEXT \"'Set View' sets view to default layer visibility, shadow, grid, etc.\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+7)
fprintf(Form "FSIZE %d 2 \n", width_group)
fprintf(Form "ENDTEXT\n")
fprintf(Form "TEXT \"'Refresh' refreshes this popup with any changes made from other windows.\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+9)
fprintf(Form "FSIZE %d 2 \n", width_group)
fprintf(Form "ENDTEXT\n")
fprintf(Form "TEXT \"+/- button pairs are for Hue, Saturation, and Lightness.\"\n")
fprintf(Form "FLOC %d %d \n", xcol1, yref+11)
fprintf(Form "FSIZE %d 2 \n", width_group)
fprintf(Form "ENDTEXT\n")
printf("Done: form setup\n")
fprintf(Form "ENDTILE\n")
fprintf(Form "ENDFORM\n")
close(Form)
); end defun - createModRDForm
(defun createFormColorSet (form, xref, yref, str, label)
fprintf(form "FIELD Show_%s\n", str)
fprintf(form "FLOC %d %d \n", xref, yref)
fprintf(form "CHECKLIST \"%s\" \n", label)
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s\n", str)
fprintf(form "FLOC %d %d \n", xref+11, yref)
fprintf(form "COLOR 3 1\n")
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s_HuePlus\n", str)
fprintf(form "FLOC %d %d \n", xref+14, yref)
fprintf(form "MENUBUTTON \"+\" 4 1\n")
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s_HueMinus\n", str)
fprintf(form "FLOC %d %d \n", xref+14, yref+1)
fprintf(form "MENUBUTTON \"-\" 4 1\n")
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s_SaturationPlus\n", str)
fprintf(form "FLOC %d %d \n", xref+18, yref)
fprintf(form "MENUBUTTON \"+\" 4 1\n")
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s_SaturationMinus\n", str)
fprintf(form "FLOC %d %d \n", xref+18, yref+1)
fprintf(form "MENUBUTTON \"-\" 4 1\n")
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s_LightPlus\n", str)
fprintf(form "FLOC %d %d \n", xref+22, yref)
fprintf(form "MENUBUTTON \"+\" 4 1\n")
fprintf(form "ENDFIELD\n")
fprintf(form "FIELD Color_%s_LightMinus\n", str)
fprintf(form "FLOC %d %d \n", xref+22, yref+1)
fprintf(form "MENUBUTTON \"-\" 4 1\n")
fprintf(form "ENDFIELD\n")
)
(defun reLabel ()
;--------- RES DEFS ----------
deleteLayerText(top_refdes_disp->layer)
deleteLayerText(bottom_refdes_disp->layer)
deleteLayerObjectsOfTypes(top_package_outline_disp->layer, (list "text" "shapes"))
deleteLayerObjectsOfTypes(bottom_package_outline_disp->layer, (list "text" "shapes"))
; next step is to loop through the objects and then call the label routine for each
; the updateRD
dbidList = axlDBGetDesign()->symbols
foreach( mySymbol dbidList
if( equal(mySymbol->type, "PACKAGE") then
createRD(mySymbol)
else
printf("IGNORED: DBID=%L objType=%L type=%L refdes=%L\n\n" , mySymbol, mySymbol->objType, mySymbol->type, mySymbol->refdes)
)
;printf(" props: %L\n", mySymbol->??)
)
;--------- PIN LABELS ----------
deleteLayerText(pin_labels->layer)
pinList = getLayerObjectList(top_pin_layer,(list "noall" "pins"), (list "pins"))
foreach( pin pinList
createPL(pin, pin_labels->layer)
)
pinList = getLayerObjectList(bottom_pin_layer,(list "noall" "pins"), (list "pins"))
foreach( pin pinList
createPL(pin, pin_labels->layer)
)
;--------- UPDATE VIEW ----------
top_refdes_disp->isVisible = t
top_refdes_assy->isVisible = nil
top_refdes_silk->isVisible = nil
top_package_outline_disp->isVisible = t
top_package_outline_assy->isVisible = nil
top_package_outline_silk->isVisible = nil
top_package_bounds->isVisible = nil
bottom_refdes_disp->isVisible = t
bottom_refdes_assy->isVisible = nil
bottom_refdes_silk->isVisible = nil
bottom_package_outline_disp->isVisible = t
bottom_package_outline_assy->isVisible = nil
bottom_package_outline_silk->isVisible = nil
bottom_package_bounds->isVisible = nil
updateView();
)
(defun reColor ()
; TODO: give back all colors
; set top and bottom
reColorLayer(top_copper)
reColorLayer(bottom_copper)
; INTERNAL LAYERS
; TODO: get color of adjacent layers (if previously defined)
; implement getColorDef(exclusionFamiles)
; loop through all inetrnal layers
; RECOLOR REF DES ETC
reColorLayer(top_refdes_disp)
reColorLayer(top_package_outline_disp)
reColorLayer(top_package_bounds)
reColorLayer(bottom_refdes_disp)
reColorLayer(bottom_package_outline_disp)
reColorLayer(bottom_package_bounds)