This website requires JavaScript.

How to Fix the ill Octagonal Gerber Aperture Macro by Proteus

How to Fix the ill Octagonal Gerber Aperture Macro by Proteus

The Problem

If you use octagonal pads (e.g. those chamfered rectangular pads) in Proteus, some versions of Proteus may export defective Gerber aperture macros for these graphic elements. See the figure below.

Figure 1. Defective octagonal pad

This aperture is made with Gerber’s outline (code 4) macro, for details please refer to section " Outline, Code 4" in the "The Gerber Layer Format Specification".

According to the specification:

An outline primitive is an area defined by its outline or contour. The outline is a polygon, consisting of linear segments only, 
defined by its start vertex and n subsequent vertices. The outline must be closed, i.e. the last vertex must be equal to the start vertex.


As the outline must be closed the last coordinates must be equal to the start coordinates.

So, an octagonal pad should have 9 vertexes, but some version of Proteus only outputs 8 vertexes.

Gerber files are nothing else but just some human-readable plain text files. So let’s open the problematic file in a text editor:

%AMDIL007*4,1,8,-0.0300,0.0380,-0.0180,0.0500,0.0180,0.0500,0.0300,0.0380,0.0300,-0.0380,0.0180,-0.0500,-0.0180,-0.0500,-0.0300,-0.0380,0*% <1>
%ADD17DIL007*% <2>

1. This long line defines the octagonal aperture macro, AM = Aperture Macro, DIL007 is the name of this macro.

2. This line defines an aperture D17 with DIL007.

To make the content easier to read, we can break the lines, like this:

4,1,8,           <1>
-0.0300,0.0380,  <2>
-0.0180,0.0500,  <3>
0.0180,0.0500,   <4>
0.0300,0.0380,   <5>
0.0300,-0.0380,  <6>
0.0180,-0.0500,  <7>
-0.0180,-0.0500, <8>
-0.0300,-0.0380, <9>
0*%              <10>
  1. 4: Outline macro; 1: Exposure on; 8: The number of vertices of the outline = the number of coordinate pairs minus one. An integer ≥3.
  2. Vertex 1
  3. Vertex 2
  4. Vertex 3
  5. Vertex 4
  6. Vertex 5
  7. Vertex 6
  8. Vertex 7
  9. Vertex 8
  10. Rotation angle.

Now, we are sure the aperture macro is wrong.

How to Fix

Just copy the coordinate of the first vertex (i.e. the line just after "4,1,8") and paste it before the "Rotation angle" line (i.e. the 0*% line):

Please don't copy the content here and paste it in your file, because your aperture may have different dimensions.
-0.0300,0.0380,  <1>
-0.0300,0.0380, <2>

1. The 1st vertex.

2. The 9th vertex. 1st and 9th should be the same.

Figure 2. Octagonal pad needs 9 vertexes

Now, correct all layers (for example, the top/bottom copper layers and the corresponding solder mask layers) which contain this type of aperture macro.

Figure 3. Octagonal pads fixed

Before you place the order, it’s strongly recommended to check every layer in a Gerber viewer, Gerbv is recommended.

Last updated on Jan 2, 2024