4
\$\begingroup\$

Context

I am currently looking for alternative PCB manufacturers for my company and have sent Gerber files to some (Chinese) companies. These Gerber files have already been used in the past by various companies to manufacture PCBs and to date I have never had any problems with my files not opening correctly. Every Gerber viewer I can get my hands on displays the files as intended.

The Problem

Now, some manufacturers are having problems displaying circles correctly in their CAM software.

After some research, I found that the Gerber command "G75", which enables 360° circular interpolation, might not be implemented (correctly) in outdated CAM software.

There are quite some forum posts and discussions on the internet, stating that some companies use pirated or outdated CAM software and that the problem only exists for closed circles. It is suggested to divide circles into arc segments in the layout. But for me that would mean that I have to rework all PCBs that I want to send to one of those manufacturers or that many manufacturers would not be eligible.

Attempted Solution

I am looking for a way to apply a fix on the Gerber level and have written a Python script that searches a Gerber file for the corresponding sequence (drawing a closed circle with G75) and then replaces it with an equivalent consisting of 4 quarter circles.

This is an example of a gerber section that needs to be fixed:

X5000000Y0D02*              % set position to (5;0) -> start point of circle %
G75*                        % enable 360 circular interpolation %
G02*                        % CW circular interpolation %
X5000000Y0I-5000000J0D01*   % draw to (X;Y) around center point -> specified by (I;J)%

And this is what my Python script makes of it:

X5000000Y0D02*
G75*
G02*
X0Y-5000000I-5000000J0D01*
X-5000000Y0I0J5000000D01*
X0Y5000000I5000000J0D01*
X5000000Y0I0J-5000000D01*

I think I know how these Gerber commands work in general and the "fixed" file looks as expected (in GerbV), but I don't fully understand how G75 works.

Sure, there is an ambiguity:
Since the arc segments are defined by start point and end point, the Gerber command for a full 360° arc (=circle) would be the same as a 0° arc (=dot) - starpoint equals endpoint in both cases.
My assumption was, that G75 is needed to handle this exact case. However, after I removed all G75 commands from my Gerber file, it still displays correctly.

Question

Can someone explain to me what the G75 command actually does and what causes the "G75-Bug" on the CAM side?

I'd like to share my script on Github since I think it could be usefull to many others, but first I need to be confident enough that there aren't any pitfalls that cause the production of faulty PCBs...

\$\endgroup\$
1
  • \$\begingroup\$ PCB makers do not use Gerber files. The files you send are instructions that they use to create manufacturing files. If you aren't sure if they will understand a "circle" instruction, get someone who writes Chinese to tell them what you mean. Also, it's not surprising the PCB manufactures don't understand Groove instructions in your Gerber file: Groove instructions should be in the Routing layer, not in the Hole layer. \$\endgroup\$
    – david
    Commented Dec 2, 2023 at 9:07

0