Expressing bezier curves in a gerber file

Hi all !

I am considering to develop an utility which can convert gerber to SVG (a vector graphics format) and vice versa. It would be a nice little project to make me learn Ruby, the final goal being to be able to draw/edit a circuit board design with Illustrator or Inkscape.

The easy way would be to convert the gerber to SVG using shapes described by bezier curves. The problem is when we want to come back to the gerber format, because it can only describe straight lines or circles, but no random curves.

I suppose CAD software to overcome this by dividing curves into a lot of lines, but is it well handled by plotters ?

What could be the best resolution of the curve (minimal deplacement) ?

Would manufacturers accept files only composed of little lines, even for circles, pads, etc. ?

Thanks :slight_smile:

cyril_sy,

“I suppose CAD software to overcome this by dividing curves into a lot of lines, but is it well handled by plotters ?”

Modern photoplotters are very sophisticated devices these days and can handle just about any artwork with relative ease.

“What could be the best resolution of the curve (minimal deplacement) ?”

CAD software and photoplotters can easily handle 6 fractional digits in mm or inches.

“Would manufacturers accept files only composed of little lines, even for circles, pads, etc. ?”

It would probably depend on the complexity of your artwork / circuit.

If your designing small relatively simple circuits there should not be any issues with PCB manufacturers, however if your designing large complicated multilayer boards you may be charged extra due to the large amount of data of the Gerber files.

However, there are a few tricks you can use with Gerber to reduce the amount of data, such as using circular interpolation codes (G02, G03, G74, G75) & multiquadrant (360°) circular interpolation (G74, G75) for circles & arcs. Also, if you have large copper areas you can use polygon area fill codes (G36, G37) in place of vector fills.

Thanks, that’s exactly what I wanted to know !

Edit: it seems that it is possible to approximate curves with circular arcs, which will be more precise and will take less space than segments. [Approximation of a cubic bezier curve by circular arcs and vice versa](http://itc.ktu.lt/itc354/Riskus354.pdf)

cyril_sy,

If you need more Gerber info, you can download the “Gerber Format Plot Data Format Reference Book” here:

http://www.everythingpcb.com/p13426.htm