-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApertureFunction.java
More file actions
1274 lines (1198 loc) · 44.1 KB
/
ApertureFunction.java
File metadata and controls
1274 lines (1198 loc) · 44.1 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
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
/*
* Copyright (C) 2025 Tony Luken <tonyluken62+gerberfilereader.gmail.com>
*
* This file is part of GerberFileReader.
*
* GerberFileReader is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* GerberFileReader is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with GerberFileReader. If
* not, see <http://www.gnu.org/licenses/>.
*/
package standardAttributes;
import gerberFileReader.GerberLayerFormatException;
/**
* A class to represent the Gerber Standard Attribute {@value #GERBER_STANDARD_ATTRIBUTE_NAME}
*/
public class ApertureFunction extends StandardAttribute {
/**
* The string used in Gerber files as the name for Aperture Function Standard Attributes:
* {@value #GERBER_STANDARD_ATTRIBUTE_NAME}
*/
public static final String GERBER_STANDARD_ATTRIBUTE_NAME = ".AperFunction";
/**
* Constructs an empty Aperture Function Standard Attribute, call
* {@link StandardAttribute#initialize(Attribute)} to initialize the contents of this Aperture
* Function Standard Attribute
*/
public ApertureFunction() {
super();
}
/**
* Constructs an Aperture Function Standard Attribute from a Gerber TA extended
* command
*
* @param cmd the Gerber command
*
* @throws GerberLayerFormatException if the command does not properly define an Aperture
* Function Standard Attribute
*/
public ApertureFunction(String cmd) throws GerberLayerFormatException {
super(cmd);
validate();
}
/**
* An enumeration of possible aperture functions: {@link #ViaDrill}, {@link #BackDrill},
* {@link #ComponentDrill}, {@link #MechanicalDrill}, {@link #CastellatedDrill},
* {@link #OtherDrill}, {@link #ComponentPad}, {@link #SMDPad}, {@link #BGAPad},
* {@link #ConnectorPad}, {@link #HeatsinkPad}, {@link #ViaPad}, {@link #TestPad},
* {@link #CastellatedPad}, {@link #FiducialPad}, {@link #ThermalReliefPad}, {@link #WasherPad},
* {@link #AntiPad}, {@link #OtherPad}, {@link #Conductor}, {@link #EtchedComponent},
* {@link #NonConductor}, {@link #CopperBalancing}, {@link #Border}, {@link #OtherCopper},
* {@link #ComponentMain}, {@link #ComponentOutline}, {@link #ComponentPin}, {@link #Profile},
* {@link #NonMaterial}, {@link #Material}, {@link #Other}, and {@link #Unknown}
*/
public enum Function {
/**
* Identifies via holes, plated holes whose sole function is to connect different layers,
* where there is no intention to insert component leads or mechanical objects.
*/
ViaDrill,
/**
* Identifies holes used to remove plating over a sub-span by drilling that sub-span with a
* larger diameter.
*/
BackDrill,
/**
* Identifies holes that are used for the attachment and/or electrical connection of
* component terminations, including pins and wires, to a printed board.
*/
ComponentDrill,
/**
* Identifies holes with mechanical function (registration, screw, etc.) It applies to drill
* holes and rout slots.
*/
MechanicalDrill,
/**
* Identifies plated holes cut through by the board edge; used to join PCBs.
*/
CastellatedDrill,
/**
* Identifies holes with a function not otherwise specified by the Gerber Layer
* Format Specification.
*/
OtherDrill,
/**
* Identifies pads associated with component holes. Only used for through-hole components.
*/
ComponentPad,
/**
* Identifies pads belonging to the footprint of an SMD component, whether the corresponding
* lead is connected or not. Applies only for the normal electrical pads.
*/
SMDPad,
/**
* Identifies pads belonging to the footprint of a BGA component, whether the corresponding
* lead is connected or not. Applies only for the normal electrical pads.
*/
BGAPad,
/**
* Identifies edge connector pads. Only applicable for outer layers.
*/
ConnectorPad,
/**
* Identifies heatsink or thermal pads.
*/
HeatsinkPad,
/**
* Identifies via pads that provides a ring to attach the plating in the barrel. This is
* reserved for pads that have no other function than making the connection between layers.
*/
ViaPad,
/**
* Identifies test pads. Only applicable for outer layers.
*/
TestPad,
/**
* Identifies pads on plated holes cut through by the board edge.
*/
CastellatedPad,
/**
* Identifies fiducial pads.
*/
FiducialPad,
/**
* Identifies thermal relief pads electrically connected to the surrounding copper but in a
* manner that restricts heat flow.
*/
ThermalReliefPad,
/**
* Identifies pads around non-plated holes without electrical function. Typically for
* mechanical reenforcement.
*/
WasherPad,
/**
* Identifies pads with clearing polarity (LPC) whose purpose is to create clearance in a
* plane. It makes room for a drill pass without connecting to the plane.
*/
AntiPad,
/**
* Identifies pads with a function not otherwise specified in the Gerber Layer Format
* Specification
*/
OtherPad,
/**
* Identifies copper whose function is to electrically connect pads or to provide shielding,
* typically tracks and copper pours such as power and ground planes.
*/
Conductor,
/**
* Identifies etched components such a embedded inductors, transformers and capacitors.
*/
EtchedComponent,
/**
* Identifies copper that does not serve as a conductor, i.e., has no electrical function.
* Typically text in the PCB such as a part number and version.
*/
NonConductor,
/**
* Identifies copper added to balance copper coverage for the plating process.
*/
CopperBalancing,
/**
* Identifies copper used as the border of a production panel.
*/
Border,
/**
* Identifies copper used for some purpose not otherwise specified in the Gerber Layer Format
* Specification.
*/
OtherCopper,
/**
* Identifies the the centroid of a component.
*/
ComponentMain,
/**
* Identifies the outline of a component.
*/
ComponentOutline,
/**
* Identifies a pin or lead location of a component.
*/
ComponentPin,
/**
* Identifies the draws and arcs that exactly define the profile or outline of the PCB.
*/
Profile,
/**
* Identifies objects that do not represent physical material but rather drawing elements.
*/
NonMaterial,
/**
* Identifies objects that do represent physical material.
*/
Material,
/**
* Identifies objects with a function that is not otherwise specified in the Gerber Layer
* Format Specification.
*/
Other,
/**
* This value is only used to indicate the Gerber file contains an invalid or unknown
* function.
*/
Unknown;
/**
* Converts a string representation of the Function to the enumerated value of the Function
*
* @param attributeValue the attribute value as a string
*
* @return the Function as an enumeration
*/
protected static Function fromAttributeValue(String attributeValue) {
try {
return Function.valueOf(attributeValue);
}
catch (Exception e) {
return Unknown;
}
}
}
/**
* Gets the function of the object to which this attribute is attached.
*
* @return the object's function
*
* @see #isViaDrill()
* @see #isBackDrill()
* @see #isComponentDrill()
* @see #isMechanicalDrill()
* @see #isCastellatedDrill()
* @see #isOtherDrill()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
* @see #isConductor()
* @see #isEtchedComponent()
* @see #isNonConductor()
* @see #isCopperBalancing()
* @see #isProductionPanelBorder()
* @see #isOtherCopper()
* @see #isComponentMain()
* @see #isComponentOutline()
* @see #isComponentPin()
* @see #isProfile()
* @see #isNonMaterial()
* @see #isMaterial()
* @see #isOther()
*/
public Function getFunction() {
return Function.fromAttributeValue(getValues().get(0));
}
/**
* Checks if this attribute is attached to an object that defines a via drill hole.
*
* @return true if the object defines a via drill hole
*
* @see #getFunction()
* @see #hasViaIPC4761ProtectionLevel()
* @see #getViaIPC4761ProtectionLevel()
*/
public boolean isViaDrill() {
return getFunction().equals(Function.ViaDrill);
}
/**
* Checks if this attribute is attached to an object that defines a via drill hole and it
* has an IPC-4761 Protection Level specified. If so, the protection level can be obtained by
* calling {@link #getViaIPC4761ProtectionLevel()}.
*
* @return true if the via drill hole has an IPC-4761 Protection Level specified
* @throws UnsupportedOperationException if this attribute doesn't define via drill holes
* @see #isViaDrill()
*/
public boolean hasViaIPC4761ProtectionLevel() {
if (!isViaDrill()) {
throw new UnsupportedOperationException("Method hasViaIPC4761ProtectionLevel() is not available for " + toString());
}
return getValues().size() > 1;
}
/**
* An enumeration of IPC-4761 Protection Levels: Ia, Ib, IIa, IIb, IIIa, IIIb, IVa, IVb, V, VI,
* VII, None, and Unknown
*/
public enum ViaIPC4761ProtectionLevel {
Ia, Ib, IIa, IIb, IIIa, IIIb, IVa, IVb, V, VI, VII, None, Unknown;
protected static ViaIPC4761ProtectionLevel fromAttributeValue(String attributeValue) {
try {
return ViaIPC4761ProtectionLevel.valueOf(attributeValue);
}
catch (Exception e) {
return Unknown;
}
}
}
/**
* Gets the via's IPC-4761 Protection Level.
*
* @return the IPC-4761 Protection Level if the via drill hole has a protection level
* specified; otherwise returns null
* @throws UnsupportedOperationException if this attribute doesn't define via drill holes
* @see #isViaDrill()
* @see #hasViaIPC4761ProtectionLevel()
*/
public ViaIPC4761ProtectionLevel getViaIPC4761ProtectionLevel() {
if (!isViaDrill()) {
throw new UnsupportedOperationException("Method getViaIPC4761ProtectionLevel() is not available for " + toString());
}
if (!hasViaIPC4761ProtectionLevel()) {
return null;
}
return ViaIPC4761ProtectionLevel.fromAttributeValue(getValues().get(1));
}
/**
* Checks if this attribute is attached to an object that defines a hole to remove
* via plating over a sub-span by drilling that sub-span with a larger diameter.
*
* @return true if the hole is intended to remove via plating
* @see #getFunction()
*/
public boolean isBackDrill() {
return getFunction().equals(Function.BackDrill);
}
/**
* Checks if this attribute is attached to an object that defines a hole that is used
* for the attachment and/or electrical connection of component terminations, including pins and
* wires, to a printed board. The attribute applies to drill holes and rout slots.
*
* @return true if the hole is used for the attachment and/or electrical connection of
* component terminations
* @see #getFunction()
* @see #isComponentDrillPressFit()
*/
public boolean isComponentDrill() {
return getFunction().equals(Function.ComponentDrill);
}
/**
* Checks if this attribute is attached to an object that defines a hole for a press
* fit lead. Press fit leads are pressed in properly sized plated-through holes to realize
* electrical contact.
*
* @return true if the hole is for a press fit lead
* @see #isComponentDrill()
*/
public boolean isComponentDrillPressFit() {
return isComponentDrill() && getValues().size() > 1 &&
getValues().get(1).equals("PressFit");
}
/**
* Checks if this attribute is attached to an object that defines a hole with mechanical
* function (registration, screw, etc.) It applies to drill holes and rout slots.
*
* @return true if the hole has a mechanical function
* @see #getFunction()
* @see #hasMechanicalDrillPurpose()
* @see #getMechanicalDrillPurpose()
*/
public boolean isMechanicalDrill() {
return getFunction().equals(Function.MechanicalDrill);
}
/**
* An enumeration of possible mechanical drill purposes: {@link #Tooling}, {@link #BreakOut},
* {@link #Other}, and {@link #Unknown}
*/
public enum MechanicalDrillPurpose {
/**
* Holes placed on a PCB or a panel of PCBs for registration and hold-down purposes during
* the manufacturing process. Also called mounting holes.
*/
Tooling,
/**
* Non-plated holes forming a break out tab used in break routing.
*/
BreakOut,
/**
* Holes for some other purpose.
*/
Other,
/**
* This value is only used to indicate the Gerber file contains an invalid or unknown type
*/
Unknown;
protected static MechanicalDrillPurpose fromAttributeValue(String attributeValue) {
try {
return MechanicalDrillPurpose.valueOf(attributeValue);
}
catch (Exception e) {
return Unknown;
}
}
}
/**
* Checks if this attribute is attached to an object that defines a hole with mechanical
* function and that it has a mechanical drill purpose specified. If so, use
* {@link #getMechanicalDrillPurpose()} to get the specified mechanical drill purpose.
*
* @return true if the hole has mechanical function and has a purpose specified
* @throws UnsupportedOperationException if this attribute doesn't define mechanical drill holes
* @see #isMechanicalDrill()
*/
public boolean hasMechanicalDrillPurpose() {
if (!isMechanicalDrill()) {
throw new UnsupportedOperationException("Method hasMechanicalDrillPurpose() is not available for " + toString());
}
return getValues().size() > 1;
}
/**
* Gets the mechanical drill hole's purpose.
*
* @return the purpose of the mechanical drill hole if it has a purpose specified; otherwise
* returns null
* @throws UnsupportedOperationException if this attribute doesn't define mechanical drill holes
* @see #hasMechanicalDrillPurpose {@link #hasMechanicalDrillPurpose()}
*/
public MechanicalDrillPurpose getMechanicalDrillPurpose() {
if (!isMechanicalDrill()) {
throw new UnsupportedOperationException("Method getMechanicalDrillPurpose() is not available for " + toString());
}
if (!hasMechanicalDrillPurpose()) {
return null;
}
return MechanicalDrillPurpose.fromAttributeValue(getValues().get(1));
}
/**
* Checks if this attribute is attached to an object that defines a plated hole cut
* through by the board edge. Typically used to join PCBs.
*
* @return true if the plated hole is cut through by the board edge
* @see #getFunction()
*/
public boolean isCastellatedDrill() {
return getFunction().equals(Function.CastellatedDrill);
}
/**
* Checks if this attribute is attached to an object that defines a drill hole with a function
* not otherwise specified by the Gerber Layer Format Specification. If so, use
* {@link #getOtherDrillFunction()} to get an informal description of the function of the hole.
*
* @return true if the hole has a function not otherwise specified by the Gerber Layer Format
* Specification
* @see #getFunction()
*/
public boolean isOtherDrill() {
return getFunction().equals(Function.OtherDrill);
}
/**
* Gets an informal description of a hole's function that is not otherwise specified by the
* Gerber Layer Format Specification.
*
* @return the informal description
* @throws UnsupportedOperationException if this attribute doesn't define an other drill
* function
* @see #isOtherDrill()
*/
public String getOtherDrillFunction() {
if (!isOtherDrill()) {
throw new UnsupportedOperationException("Method getOtherDrillFunction() is not available for " + toString());
}
return getValues().get(1);
}
/**
* Checks if this attribute is attached to an object that defines a pad associated with
* a through-hole component.
*
* @return true if this attribute defines a through-hole component pad
* @see #getFunction()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isComponentPad() {
return getFunction().equals(Function.ComponentPad);
}
/**
* Checks if this attribute is attached to an object that defines a pad belonging to the
* footprint of an SMD component, whether the corresponding lead is connected or not. Applies
* only for the normal electrical pads.
*
* @return true if this attribute defines an SMD pad
* @see #getFunction()
* @see #getPadDefinitionMethod()
* @see #isComponentPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isSMDPad() {
return getFunction().equals(Function.SMDPad);
}
/**
* An enumeration of possible SMD and BGA pad definition methods: {@link #CopperDefined},
* {@link #SoldermaskDefined}, and {@link #Unknown}
*/
public enum PadDefinitionMethod {
/**
* The copper pad is completely free of solder mask. The area to be covered by solder paste
* is defined by the copper pad. This is by far the most common SMD pad definition method.
*/
CopperDefined,
/**
* The solder mask overlaps the copper pad. The area to be covered by solder paste is
* defined by the solder mask opening and not by the copper pad.
*/
SoldermaskDefined,
/**
* This value is only used to indicate the Gerber file contains an invalid or unknown type
*/
Unknown;
protected static PadDefinitionMethod fromAttributeValue(String attributeValue) {
switch (attributeValue) {
case "CuDef" :
return CopperDefined;
case "SMDef" :
return SoldermaskDefined;
default :
return Unknown;
}
}
}
/**
* Gets the pad definition method of an SMD or BGA pad.
*
* @return the pad definition method
* @throws UnsupportedOperationException if this attribute doesn't define an SMD pad or a BGA
* pad
* @see #isSMDPad()
* @see #isBGAPad()
*/
public PadDefinitionMethod getPadDefinitionMethod() {
if (!isSMDPad() && !isBGAPad()) {
throw new UnsupportedOperationException("Method getPadDefinitionMethod() is not available for " + toString());
}
return PadDefinitionMethod.fromAttributeValue(getValues().get(1));
}
/**
* Checks if a pad is {@link #isPadSoldermaskDefined()}.
*
* @return true if the pad is soldermask defined
* @see getPadDefinitionMethod()
* @see isPadCopperDefined()
*/
public boolean isPadSoldermaskDefined() {
return (isSMDPad() || isBGAPad()) &&
getPadDefinitionMethod() == PadDefinitionMethod.SoldermaskDefined;
}
/**
* Checks if a pad is {@link #isPadCopperDefined()}.
*
* @return true if the pad is copper defined
* @see getPadDefinitionMethod()
* @see isPadSoldermaskDefined()
*/
public boolean isPadCopperDefined() {
return (isSMDPad() || isBGAPad()) &&
getPadDefinitionMethod() == PadDefinitionMethod.CopperDefined;
}
/**
* Checks if this attribute is attached to an object that defines a pad belonging to the
* footprint of a BGA component, whether the corresponding lead is connected or not. Applies
* only for the normal electrical pads.
*
* @return true if this attribute defines a BGA pad
* @see #getFunction()
* @see #getPadDefinitionMethod()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isBGAPad() {
return getFunction().equals(Function.BGAPad);
}
/**
* Checks if this attribute is attached to an object that defines an edge connector pad. Only
* applicable for outer layers.
*
* @return true if this attribute defines an edge connector pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isConnectorPad() {
return getFunction().equals(Function.ConnectorPad);
}
/**
* Checks if this attribute is attached to an object that defines a heatsink or thermal
* pad, typically for SMDs.
*
* @return true if this attribute defines a heatsink pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isHeatsinkPad() {
return getFunction().equals(Function.HeatsinkPad);
}
/**
* Checks if this attribute is attached to an object that defines a via pad that provides a
* ring to attach the plating in a via barrel. This is reserved for pads that have no other
* function than making the connection between layers.
*
* @return true if this attribute is attached to a via pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isViaPad() {
return getFunction().equals(Function.ViaPad);
}
/**
* Checks if this attribute is attached to an object that defines a test pad. Only applicable
* for outer copper layers.
*
* @return true if the attribute defines a test pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isTestPad() {
return getFunction().equals(Function.TestPad);
}
/**
* Checks if this attribute is attached to an object that defines a pad for a plated hole
* cut through by the board edge. Typically used to join PCBs.
*
* @return true if this attribute defines a pad for a plated hole cut through by the board edge
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isCastellatedPad() {
return getFunction().equals(Function.CastellatedPad);
}
/**
* Checks if this attribute is attached to an object that defines a fiducial pad. If so,
* {@link #getFiducialType()} returns the fiducial's type.
*
* @return true if this attribute defines a fiducial pad.
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isFiducialPad() {
return getFunction().equals(Function.FiducialPad);
}
/**
* An enumeration of possible fiducial types: {@link #Local}, {@link #Global}, {@link Panel}, and
* {@link #Unknown}
*/
public enum FiducialType {
/**
* Fiducials used to locate the position of an individual component on a PCB
*/
Local,
/**
* Fiducials used to locate a PCB on the assembly panel
*/
Global,
/**
* Fiducials used to locate an assembly panel on the fabrication panel
*/
Panel,
/**
* This value is only used to indicate the Gerber file contains an invalid or unknown type
*/
Unknown;
protected static FiducialType fromAttributeValue(String attributeValue) {
switch (attributeValue) {
case "Local" :
return Local;
case "Global" :
return Global;
case "Panel" :
return Panel;
default :
return Unknown;
}
}
}
/**
* Gets the fiducial's type.
*
* @return the fiducial's type
* @throws UnsupportedOperationException if this attribute doesn't define a fiducial pad
* @see #isFiducialPad()
*/
public FiducialType getFiducialType() {
if (!isFiducialPad()) {
throw new UnsupportedOperationException("Method getFiducialType() is not available for " + toString());
}
return FiducialType.fromAttributeValue(getValues().get(1));
}
/**
* Checks if this attribute is attached to an object that defines a thermal relief pad, that is,
* a pad electrically connected to the surrounding copper but in a manner that restricts heat
* flow.
*
* @return true if this attribute defines a thermal relief pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isWasherPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isThermalReliefPad() {
return getFunction().equals(Function.ThermalReliefPad);
}
/**
* Checks if this attribute is attached to an object that defines a pad around a non-plated
* hole without electrical function. Typically for mechanical reinforcement, hence the term
* washer pad.
*
* @return true if this attribute defines a washer pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isAntiPad()
* @see #isOtherPad()
*/
public boolean isWasherPad() {
return getFunction().equals(Function.WasherPad);
}
/**
* Checks if this attribute is attached to an object that defines a pad with clearing
* polarity (LPC) for the purpose of creating a clearance in a plane. It makes room for a drill
* pass without connecting to the plane.
*
* @return true if this attribute defines an anti-pad
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isOtherPad()
*/
public boolean isAntiPad() {
return getFunction().equals(Function.AntiPad);
}
/**
* Checks if this attribute is attached to an object that defines a pad with a function not
* otherwise specified by the Gerber Layer Format Specification. If so,
* {@link #getOtherPadFunction()} returns an informal description of the function of the pad.
*
* @return returns true if this attribute defines a pad with an otherwise undefined function
* @see #getFunction()
* @see #isComponentPad()
* @see #isSMDPad()
* @see #isBGAPad()
* @see #isConnectorPad()
* @see #isHeatsinkPad()
* @see #isViaPad()
* @see #isTestPad()
* @see #isCastellatedPad()
* @see #isFiducialPad()
* @see #isThermalReliefPad()
* @see #isWasherPad()
* @see #isAntiPad()
*/
public boolean isOtherPad() {
return getFunction().equals(Function.OtherPad);
}
/**
* Gets an informal description of the function of the pad.
*
* @return the informal description
* @throws UnsupportedOperationException if this attribute doesn't define an other function pad
* @see #isOtherPad()
*/
public String getOtherPadFunction() {
if (!isOtherPad()) {
throw new UnsupportedOperationException("Method getOtherPadFunction() is not available for " + toString());
}
return getValues().get(1);
}
/**
* Checks if this attribute is attached to an object that defines copper whose function is to
* electrically connect pads or to provide shielding, typically tracks and copper pours such as
* power and ground planes.
*
* @return true if this attribute defines copper whose function is electrical conduction
* @see #getFunction()
* @see #isNonConductor()
*/
public boolean isConductor() {
return getFunction().equals(Function.Conductor);
}
/**
* Checks if this attribute is attached to an object that defines an embedded inductor,
* transformer, capacitor, or other component etched into the PCB copper.
*
* @return true if this attribute defines an etched component
* @see #getFunction()
*/
public boolean isEtchedComponent() {
return getFunction().equals(Function.EtchedComponent);
}
/**
* Checks if this attribute is attached to an object that defines copper that does not serve as
* a conductor and has no electrical function; typically text in the PCB such as a part number
* and version.
*
* @return true if the attribute defines copper that has no electrical function
* @see #getFunction()
* @see #isConductor()
*/
public boolean isNonConductor() {
return getFunction().equals(Function.NonConductor);
}
/**
* Checks if this attribute is attached to an object that defines copper whose purpose is
* to balance copper coverage for the plating process.
*
* @return true if this attribute defines copper to balance the plating process
* @see #getFunction()
*/
public boolean isCopperBalancing() {
return getFunction().equals(Function.CopperBalancing);
}
/**
* Checks if this attribute is attached to an object that defines the copper border of a
* production panel.
*
* @return true if this attribute defines the copper border of a production panel
* @see #getFunction()
*/
public boolean isProductionPanelBorder() {
return getFunction().equals(Function.Border);