Self-Intersecting Polygons, or is it?

Have you recently purchased boards from a printed circuit board factory only to find that some complex solderable features on the board that you were going to assemble to didn’t come out correctly? The data you provided to the factory was in the Extended Gerber format (RS-274-X). You notify the manufacturer so that they can determine the root cause of the error. After a few days you are told that your data was loaded into several different CAM programs by the manufacturer and the data resulted in the same shape. Some manufacturers may have even come back to you and stated that different CAM stations running different programs came up with different results, one correct and the other incorrect. Ultimately you are told that your data has illegal self-intersecting polygons that are the culprit.

In my new position at The Bare Board Group (BBG) I have the opportunity to work on a wide range of technology ranging from simple single and double sided boards to advanced rigid-flex designs with HDI blind and buried vias. Its safe to say that we see it all since we are capable of providing boards to meet most design criteria. That being said we also came across the infamous self-intersecting polygon non-conformance on a board we provided. I have decades of experience working with the Gerber format and programming in general. I also like to understand how a problem occurs so that I can prevent it from happening again in the future. I started evaluating the non-conformance and was very surprised by what I discovered at the end of my investigation. To understand the non-conformance and the root cause of the problem you shall first need to understand some of the terminology.

What is a Gerber file?

Gerber is a photo-plotter program language originally used on photo-plotters manufactured by Gerber Scientific. Think of a photo-plotter as an expensive printer attached to your home computer. When you send a document to a printer an image is produced on a piece of paper. A photo plotter exposes a circuit image on a chemically treated polymer film. The exposed image is then chemically developed into a permanent image. The film base provides a dimensionally stable medium over long term use. The resolved image on the film is used in the manufacturing operation to transfer the circuit image to materials used in the manufacturing process. One Gerber file contains the data for one layer of the printed circuit board. For more information on the Gerber format click here.  Below is an example of a film commonly used by the printed circuit board industry…

EN_ti2585

What is a Polygon?

A polygon is a closed shape with three or more sides. In the Gerber format a polygon can be used to define the same complex shapes used in multiple locations. The boundary enclosed by the sides of the boundary (edge) are filled. A solid filled polygon square would be a copper pad on the finished board.

Polygon

Polygon

What is a Self-Iintersecting Polygon?

A self-intersecting polygon is where the boundary (edge) of a polygon crosses over itself to form a voided area.

Self-intersecting polygon

Self-Intersecting Polygon

Now the non-conformance…

In order to keep from violating some non-disclosure agreements we have in place and from offending some professionals I have redacted some names and numbers from this posting…

A BBG customer account supplied RS-274-X (Extended Gerber Format) files for one of their designs. The Gerber data was generated by the customer using a high end CAD program. The part was built by two BBG factories and then shipped to the customer. The customer called and notified BBG that there was an error with some custom pads provided on their boards on Wednesday March 16th. The customer sent in a view of what was received (incorrect) and a view of what is desired (correct).

Incorrect

Incorrect Pad Shape.

Correct

Correct Pad Shape

The BBG office in Taiwan started reviewing the problem at the factories and ultimately detected that different CAM software packages provided different results with regards to the custom pads. The BBG office in Largo Florida was also able to verify the difference between the way various CAM programs interpret the data within the customer’s data. In some cases the CAM program reported the presence of Self-Intersecting Polygons in the data. However, some CAM programs were able to interpret the customer’s data and form the desired shape whereas some did not. This implied that there was a potential misinterpretation of the Gerber specification.

Examination of the Gerber file for the layer in question revealed that the shapes in question were defined by complex custom apertures. The code was compared to the Gerber specification available for download from the UCAMCO company web site located here. After reviewing the Gerber specification it was determined that the customer file was applying a rotation factor within the code of the complex custom aperture. An excerpt from the custom shape including the aperture macro from the customer file is below…

%AMVB_Custom_TO263-7106_1*
$4 = $2X-0.0675*
$5 = $3X0.0000*
$6 = $2X0.0000*
$7 = $3X-0.0675*
21,1,0.2750,0.4200,$4-$5,$6+$7,$1*
%
%ADD43VB_Custom_TO263-7106_1,90.00000X0.00000X1.00000*%
%

The code is defined as follows…

ADD43 = Aperture Definition D-Code 43.
VB_Custom_To263-7106_1 = The name of the Macro.
90.00000 = $1 variable (This is the rotation factor of the D-Code for the $1 Variable)
0.00000 = $2 variable
1.00000 = $3 variable

AMVB_Custom_To263-7106_1 = Definition for the Aperture Macro named VB_Custom_To263-7106_1

$4, $5, $6 and $7 = Variable modifiers used to define macro parameters. These typically contain mathematical functions. Variable statements appear prior to the defined macro shape they are applied to.

21,1,0.2750,0.4200,$4-$5,$6+$7,$1 = The defined macro primitive shape. The parameters are defined as follows from left to right…
    21 = Rectangle
    1 = Exposure, 1 is on for positive data (pencil) and 0 would be negative data (eraser)
    0.2750 = Width of rectangle.
    0.4200 = Height of rectangle.
    $4-$5 = Centroid position along X-axis.
    $6+$7 = Centroid position along Y-axis.
    $1 = Rotation angle (This is where the conflict originates).

I decided to test for a rotation error. Using a text editor I wrote a Gerber file (test1.gbr) with one flash at the file origin and using the custom pad macro exactly as it appeared in the customer Gerber file provided. I then loaded that image into CAM Program A and observed the image below…

CAM Program A view of the data.

I then loaded the same file into CAM Program B and observed the image below…

CAM Program B

CAM Program B view of the data.

CAM Program A did not interpret the macro in a way that matched the desired shape whereas CAM Program B did. I then proceeded to type in the macro commands onto a CAM layer as if they were standard aperture shapes. I loaded in the first 5 shapes and then rotated them all about X=0 and Y=0 of the layer origin. The data rotated and matched the loaded results of CAM Program A. See the image below…

1st five shapes

1st five shapes loaded and then all rotated about X=0 Y=0.

I then proceeded to load in the features and then rotated them about each individual feature centroid. I had to switch the width and height fields to simulate the rotation about the feature centroids. The results are viewed below…

All shapes

All shapes loaded and then all rotated about feature centroids.

I then sent the test1.gbr file to several colleagues using different CAM programs and requested that they load the file in and send me a screen shot of the result. I received a few screen shots that did not match the customer’s desired shape and some that did. It is apparent that there is a misinterpretation of how to apply the Rotation factor within a Gerber Macro. Based on my observations it is one of two ways.

  1. Rotation of the primitive shape about the macro origin (X=0, Y=0).
  2. Rotation of the individual primitive shapes about their independent shape center point (centroid) and not the macro origin.

Since there is a difference of opinion on how to interpret the rotation factor I contacted the authority of the Gerber specification The Company with ownership and responsibility for maintaining the Gerber specification is UCAMCO. Their web site may be found here.

UCAMCO is the ultimate authority of the Gerber specification and arbitrator of interpretation issues. UCAMCO did respond to my request and provided clarification of the specification with regards to the primitive shape macro. Per UCAMCO the rotation of the primitive shape IS about the macro origin (X=0, Y=0). Rotating the primitive shape about the centroid is incorrect.

Below is an excerpt from the Rs-274X (Gerber) Revision H specification…

Primitive Shape Definition.

Primitive shape definition from Rs-274X (Gerber) Revision H specification.

The image above contains the definition of the primitive shape from the Gerber specification of our example writen in the test1.gbr file. The $4 and $5 define the position of the primitive shape within the macro itself along a Cartesian coordinate system. The origin of the macro is at X=0, Y=0.

Example 1: For our primitive shape let $4=0 and $5=0. This places the part centroid at the macro origin of X=0, Y=0. The error would not be apparent when the centroid is located at the origin. This is because both interpretations of rotation, about the centroid and about the origin, are at the same location. See below…

 

Primitive Shape

Example 1 X=0, Y=0

Example 2: For our primitive shape above let $4=0.100 and $5=0.200. The part centroid is at a X=0.100, Y=0.200 offset from the macro origin. In this example the error becomes apparent. In the view below the primitive shape appears with just the offset.

Off-Set Primitive Shape

X=0.100, Y=0.200, No Rotation.

In the view below the primitive shape appears with the 90 degree rotation improperly applied about the centroid.

Bad Rotation

X=0.100, Y=0.200, Rotation of 90 degrees improperly applied to the shape centroid.

In the view below the primitive shape appears with the 90 degree rotation properly applied about the macro origin.

Primitive Shape Rotated Correctly

X=0.100, Y=0.200, Rotation of 90 degrees properly applied to the macro origin.

Conclusion:

  1. The file supplied by the customer was supplied with an improper interpretation of the rotation factor applied to the primitive shape within the macro code. The customer’s data had the rotation applied to the primitive shape centroids. The rotation factor applied to the primitive shape should have been about the macro origin (X=0, Y=0) as required by the RS-274X (Gerber) specification.
  2. The undesired shape is the result of an error supplied by the customer since their data was not 100% compliant to the Gerber specification.
  3. CAM Programs can be verified for compliance to the RS-274X (Gerber) specification by loading in the test1.gbr file listed in the post. The image shall match the CAM Program A view of the data.
  4. UCAMCO is in the process on notifying the programmers of the source of the rotation error. A request has been submitted to UCAMCO to clarify the RS-274X (Gerber) specification upon its next revision.
  5. CAD users should contact their program providers and verify how their software interprets the rotation factor applied to primitive shapes. In cases where the rotation factor is not interpreted properly to the RS-274X (Gerber) specification a request to correct the CAD software should be made.

Tags: , , , , ,

Leave a Reply