Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Gerber file format...help please

Status
Not open for further replies.

boylesg

Advanced Member level 4
Advanced Member level 4
Joined
Jul 15, 2012
Messages
1,023
Helped
5
Reputation
10
Reaction score
6
Trophy points
1,318
Location
Epping, Victoria, Australia
Activity points
11,697
I am referring to this http://www.apcircuits.com/Portals/0/Assets/Downloads/the_gerber_file_format_specification.pdf?ver=2015-06-13-175030-363


But it is not entirely helpful.

I get these lines Y-508000D1* X-2286000Y-762000D2* - they are moveto and lineto with x and/or y coordinates.
But what are the units of the coordinates? It doesn't look like mm.

I get this bit %TA.AperFunction,ComponentPad*% %ADD15C,2.3*% - it is defining the diameter of my pads and giving it the ID of '15'

I sort of get this bit %TF.FileFunction,Copper,L2,Bot*% %TF.Part,Single*% - it is telling me singled sided copper clad. But what is 'L2'? and 'Bot'?

But I don't understand what this is telling me about the board: %TA.AperFunction,Conductor*% %ADD14C,2.0*%

Code:
%TF.GenerationSoftware,Novarm,DipTrace,3.2.0.1*%
%TF.CreationDate,2018-11-07T12:25:27+09:00*%
%FSLAX35Y35*%
%MOMM*%
%TF.FileFunction,Copper,L2,Bot*%
%TF.Part,Single*%
%TA.AperFunction,Conductor*%
%ADD14C,2.0*%
%TA.AperFunction,ComponentPad*%
%ADD15C,2.3*%
G75*
G01*
%LPD*%
X-2794000Y-254000D2*
D14*
Y-508000D1*
X-2286000Y-762000D2*
X-2540000D1*
X-2794000D1*
Y-508000D1*
Y-254000D2*
Y508000D1*
X-2286000Y-762000D2*
X-762000D1*
Y-747873D1*
Y-508000D1*
Y508000D2*
X-254000D1*
Y-762000D1*
X1016000D1*
X1524000D1*
Y508000D1*
X1016000D1*
X-762000Y-747873D2*
X-254000Y-762000D1*
X1016000Y-508000D2*
Y-762000D1*
X1524000Y1016000D2*
Y508000D1*
X-2032000Y-254000D2*
Y-508000D1*
Y-254000D2*
Y762000D1*
Y1016000D1*
X-2794000D1*
X-1524000Y762000D2*
X-2032000D1*
X0D2*
Y1016000D1*
X-2032000D1*
X1016000D2*
X0D1*
X-2286000Y-2286000D2*
X-3302000D1*
Y762000D1*
X-2032000D1*
X-2286000Y-2286000D2*
X-2032000D1*
X0Y254000D2*
Y762000D1*
X-1270000D2*
Y254000D1*
X-762000D1*
X508000Y762000D2*
Y254000D1*
X1016000D1*
X0Y0D2*
Y-254000D1*
X1016000D2*
Y0D1*
X762000D2*
X1016000D1*
X-762000Y-254000D2*
Y0D1*
X-508000D2*
X-762000D1*
X254000D2*
Y-254000D1*
X-2286000Y-1778000D2*
X-2032000D1*
X762000Y-1270000D2*
Y-1778000D1*
Y-1270000D2*
X-2286000D1*
Y-1778000D1*
X-1524000D2*
Y-2032000D1*
Y-2286000D1*
X-2286000Y-2032000D2*
X-1524000D1*
X-2286000D2*
X-2794000D1*
Y-762000D1*
X-1524000Y-2286000D2*
Y-2540000D1*
X-508000D1*
X508000Y-1778000D2*
Y-1524000D1*
X-1524000D1*
Y-1778000D1*
X-508000Y-2032000D2*
X0D1*
Y-1778000D1*
X1016000Y-1270000D2*
Y-1778000D1*
X0Y-2540000D2*
Y-2286000D1*
X-1016000D1*
X254000Y-2540000D2*
Y-1778000D1*
D15*
X-2794000Y-508000D3*
Y-254000D3*
X-2286000Y-2286000D3*
X-2032000Y-1778000D3*
X762000Y0D3*
X254000D3*
X-2032000Y-508000D3*
Y-254000D3*
X-2286000Y-762000D3*
X-2540000D3*
X-1270000Y762000D3*
X-1524000D3*
X1016000Y-254000D3*
Y-508000D3*
X-762000Y0D3*
Y508000D3*
X1016000D3*
Y254000D3*
X-2794000Y1016000D3*
X-762000Y254000D3*
X-2794000Y508000D3*
X1016000Y0D3*
X0Y-254000D3*
X254000D3*
X-762000Y-508000D3*
Y-254000D3*
X0Y762000D3*
X508000D3*
X0Y0D3*
X-2286000Y-2032000D3*
X-1524000Y-1778000D3*
X-2032000Y-2286000D3*
X-508000Y0D3*
X-2286000Y-1778000D3*
X1016000Y1016000D3*
X1524000D3*
X-1524000Y-2286000D3*
X0Y254000D3*
X508000D3*
X-254000Y-1778000D3*
X0D3*
X762000Y-1270000D3*
X1016000D3*
X-508000Y-2032000D3*
X254000Y-1778000D3*
X508000D3*
X1016000D3*
X762000D3*
X-508000Y-2540000D3*
X-1016000Y-2286000D3*
X0Y-2540000D3*
X254000D3*
M02*
 

Hi,

You have the specification PDF.... why don't you read it?

Hint: open the the PDF in a viewer.
Use the search function for "unit".
And you will have the answer within a couple of seconds.

Klaus
 

Hi,

You have the specification PDF.... why don't you read it?

Hint: open the the PDF in a viewer.
Use the search function for "unit".
And you will have the answer within a couple of seconds.

Klaus

Well Klaus why don't we have a closer look at that Gerber manual shall we????

<AM
command
>:
AM<Aperture macro name>*<Macro content>
<Macro content>:
{{<Variable definition>*}{<Primitive>*}}
<Variable definition>:
$K=<Arithmetic expression>
<Primitive>:
<Primitive code>,<Modifier>{,<Modifier>}|<Comment>
<Modifier>:
$M
|< Arithmetic expression>
<Comment>:
0 <Text>

Pertaining to 'OUTLINE0' in:

Code:
AMOUTLINE0*
4,1,8,
4.6194,1.91342,
4.6194,-1.91342,
1.91342,-4.6194,
-1.91342,-4.6194,
-4.6194,-1.91342,
-4.6194,1.91342,
-1.91342,4.6194,
1.91342,4.6194,
4.6194,1.91342,
0*%
%TA.AperFunction,Conductor*%
%ADD14C,2.0*%
%TA.AperFunction,ComponentPad*%
%ADD15C,2.3*%
%ADD16R,3.3X2.3*%
%ADD17R,2.3X2.3*%
%ADD18O,3.3X2.3*%
%ADD19C,4.1*%
%ADD35OUTLINE0*%

Aperture macro name....OK well that seems obvious 'AMOUTLINE0*' is the name of a polygon or aperture whose vertices are defined below.

But the rest of that explanation is simply useless.

What is '4,1,8,' about? Centre of polygon? Start vertice of polygon?
And what are these meant to be?

4.6194,1.91342,
4.6194,-1.91342,

The x,y coordinates of the vertices? Probably. But there is nothing in the gerber file or the user manual to tell me that this is precisely what they are. How can I be certain? It is the first time I have tried to read a gerber file.

By and large it is a POORLY written manual.....typical engineering gibberish by and large......by engineers who to lazy to write proper manuals!

I know because I once made the same mistake in my other life as a betting terminal programmer. But I made a conscious effort to write a decent manual after it was pointed out to me that my first attempt was engineering gibberish by those who were using it.
 
Last edited:

I get these lines Y-508000D1* X-2286000Y-762000D2* - they are moveto and lineto with x and/or y coordinates.
But what are the units of the coordinates? It doesn't look like mm.

It's encoded in these lines:
%FSLAX35Y35*%
%MOMM*%

For the FS interpretation, have a look at your file format document, chapter 4.9 Coordinate Format (FS)
 

It's encoded in these lines:
%FSLAX35Y35*%
%MOMM*%

For the FS interpretation, have a look at your file format document, chapter 4.9 Coordinate Format (FS)

Great. I overlooked that line entirely. Thankyou matey.

That bit of the manual was easy to wrap my head around at least.

This is all it takes to make it easy for a brand newby to the standard:

If the FS command defines N places for integer part and M for decimal part it means the maximum allowed length of a coordinate number is N+M. To interpret the coordinate string, it is first padded with zero’s in front until its length is equal to N+M. And then first N digits are interpreted as the integer part, and remaining M digits are interpreted as the decimal part.
For example, with the “24” coordinate format, “015” is padded to “000015” and therefore represents 0.0015.
At least one character must be output as omitting a value indicates that the previous value should be used. Zero therefore should be encoded as “0”.

I.E. Stepping through an example in adequate detail. But sadly examples for other commands or inadequately explained or none have been provided.



Its a pity Klaus does not spend more time helping people and less time making sarcastic comments!
 
Last edited:

But sadly examples for other commands or inadequately explained or none have been provided.

Maybe you also overlooked the example on aperture macro (AM) on page 35.

AMOUTLINE0*
4,1,8,
4.6194,1.91342,
4.6194,-1.91342,
1.91342,-4.6194,
-1.91342,-4.6194,
-4.6194,-1.91342,
-4.6194,1.91342,
-1.91342,4.6194,
1.91342,4.6194,
4.6194,1.91342,
0*%

seems to refer to primitive 4 that is described on page 115 in chapter 4.12.4.5 Outline, Primitive Code 4

I have been programming Gerber tools long ago, but we didn't have AM at that time, so you will need to do some reading on your own. Good luck!
 
Last edited:

Maybe you also overlooked the example on aperture macro (AM) on page 35.

AMOUTLINE0*
4,1,8,
4.6194,1.91342,
4.6194,-1.91342,
1.91342,-4.6194,
-1.91342,-4.6194,
-4.6194,-1.91342,
-4.6194,1.91342,
-1.91342,4.6194,
1.91342,4.6194,
4.6194,1.91342,
0*%

seems to refer to primitive 4 that is described on page 115 in chapter 4.12.4.5 Outline, Primitive Code 4

I have been programming Gerber tools long ago, but we didn't have AM at that time, so you will need to do some reading on your own. Good luck!

<Macro content>
Macro content describes primitives included into the aperture macro. Can also contain definitions of new variables.

This is all it says in the manual. At least the macro name has a link to another section that explains the syntax of names.

IT would be rather nice to have a specific example here, with explanations of each line and with links to other sections that provide further details of the fields.

That is what I would do if I was tasked with writing a manual for this....from previous experience.

From my perspective 4,1,8 just looks like coordinates.

Found some adequate info about this in 4.12.3 Rotation modifier only by accident in searching for 'Aperture macro'.

Why would I look at 'Rotation Modifier' if I was searching for more info on 'Aperture macro' in the TOC?

This manual is poorly laid out in my view. I reckon I could do a better job of it given sufficient time and full understanding of gerber myself.

So

'4' = outline
'1' = exposure on or laser in my case I guess.
'8' = 8 x vertices.

And the rest of it does consist of X,Y coordinate pairs, although it is a pity they did not stick to the letters X and Y as they have with coordinates associated with D01, D02 and D03

But negative numbers here clearly mean relative to a centre point.

Don't think I will bother reading these these from my gbr file as it would be easier to just store the centre point and the radius of such a pad and just use the Visual C++ functions to calculate the vertices.
 
Last edited:

IT would be rather nice to have a specific example here, with explanations of each line and with links to other sections that provide further details of the fields.

That is what I would do if I was tasked with writing a manual for this....from previous experience.

From my perspective 4,1,8 just looks like coordinates.

Although the manual could be more systematic, there are examples for exactly this kind of polygon aperture macro, as said on page 115 (and 116). It clarifies that 4,1,8 are not coordinates, but codes for polygon, exposure on, 8 subsequent points. It takes longer than a few seconds to read and understand chapter 4.12 about aperture macros, you shouldn't take KlausST's comment literally in this regard.

It seems to me that your Gerber example can be completely decoded using the manual, don't be impatient.

- - - Updated - - -

See you have found about 4,1,8 in the meantime, that's good.
 

You complain too much. Nobody here is responsible for the document.

'4' = outline
'1' = exposure on or laser in my case I guess.
'8' = 8 x vertices.

And the rest of it does consist of X,Y coordinate pairs, although it is a pity they did not stick to the letters X and Y as they have with coordinates associated with D01, D02 and D03

X and Y are used for drawing. But this is co-ordinate in the macro definition, not the actual drawing yet! So this is indeed relative to the position where the macro items are inserted. Maybe the example helps to see the actual use.
 
Last edited:

Hi,

I've got a PM from boylesg about my post#2.

In my post#2 I missed to quote this sentence:
But what are the units of the coordinates?
This is what I was referring to.

Klaus
 

Apologies to boylesg that we volunteers didn't spend even more time to solve his problems by interpreting his documents in more detail.
 

Although the manual could be more systematic, there are examples for exactly this kind of polygon aperture macro, as said on page 115 (and 116). It clarifies that 4,1,8 are not coordinates, but codes for polygon, exposure on, 8 subsequent points. It takes longer than a few seconds to read and understand chapter 4.12 about aperture macros, you shouldn't take KlausST's comment literally in this regard.

It seems to me that your Gerber example can be completely decoded using the manual, don't be impatient.

- - - Updated - - -

See you have found about 4,1,8 in the meantime, that's good.

Yeah well I do get very impatient with the lousy manuals, and the lazy individuals responsible for writing them!

Because any product hinges of the quality of its user manual.

As I said I am confident I could do a superior job of that manual if I was sufficiently up to speed with all gerber functionality.
 

I believe that your complaints about this manual are all-in-all unsubstantiated, despite of minor potential for improvement.

The doubts presented in this thread are mainly brought up by incomplete reading.
 

I believe that your complaints about this manual are all-in-all unsubstantiated, despite of minor potential for improvement.

The doubts presented in this thread are mainly brought up by incomplete reading.

In my view you should be able to easily find the info you need, a bit at a time, without having to read the entire manual and try and remember where chunks of required info are located often in unrelated sections.

The manual is the most important part of the product and should be treated with the seriousness and effort it deserves. And this particular manual could have been handled a great deal better.

We will have to agree to disagree.
 

Some points are different here:

- A file specification isn't a user manual
- Although Gerber file format has been originally developed by Barco, it has changed into a quasi-industry standard that is maintained by voluntary work of Barco employees and an interested community.
- The subject is rather complex, particularly the extended functions like the discussed aperture macros. It's not fair to expect an intuitive understanding without even reading the related manual parts. The previous discussion until post #7 illustrates your guessing work before reading chapter 4.12 completely.
 

Some points are different here:

- A file specification isn't a user manual
- Although Gerber file format has been originally developed by Barco, it has changed into a quasi-industry standard that is maintained by voluntary work of Barco employees and an interested community.
- The subject is rather complex, particularly the extended functions like the discussed aperture macros. It's not fair to expect an intuitive understanding without even reading the related manual parts. The previous discussion until post #7 illustrates your guessing work before reading chapter 4.12 completely.

That is splitting hairs. User manual or file specification.....regardless of what you choose to call the document its purpose is to explain how to use of the product (in this case a text based protocol).

I am respectably technically minded but regardless, when learning something new, I like simplicity and efficiency in documents.
I hate wasting time trying to get my head around the way a document is structured and spending 10s of minutes trying to find one piece of info, in a long document, that I need right now.
Simplicity is often very hard to achieve in coding, but potentially very easy to achieve when writing user manuals and file specifications.
All you have to is put yourself in the shoes of someone who is not part of your coding team and has never seen or heard of your protocol before.
So if that means making the document like an 'idiots guide to...' then so be it. Lot's of case by case examples with any necessary links to other common sections for more detailed info.
The fundamental problem with their document, in my view, is that they have not included case by case examples of what you might see in a gerber file, with the syntax of each function.
E.G. D01, D02, D03.

Page 60

Coordinate data defining the X coordinate of the interpolation end point. For more details see 4.4.2 and 4.5.7
The X coordinate is then used to set the new current point
If missing then the previous X coordinate is used
<Number> is a coordinate number – see section 3.6.3

What does a 'missing' coordinate look like? Like this 'X0D1'? Or do I have the wrong idea? A few extra characters in this table (and repeated throughout the whole document) could have made my searches a lot less slow and painful.

I'll bet the only people they had trial their document (if at all) was each other. But that doesn't end well if want quality user manuals/file specs. You need to have such documents vet by outsiders who know nothing about the protocol. If they find it easy to follow it easily and are able to explain all the lines in a gerber file then it is probably a well structure document in the broader context.

And just because you might be a volunteer for a broad spectrum project it doesn't mean that you should not aim for quality user manuals/specs. Might take longer than if you were paid to write manuals but still the goal of a good quality manual should remain the same.
 
Last edited:

That is splitting hairs. User manual or file specification.....regardless of what you choose to call the document its purpose is to explain how to use of the product (in this case a text based protocol).

Yes, but it's designed for layout software specialists working on these formats, not end users. Because end users don't need to create readers/writers on their own. You had trouble even with the most basic Gerber concept, the definition of coordinates using leading/trailing zeroes. Gerber is among the easier (and documented) formats in layout transfer, there are much worse or undocumented that you need to reverse-engineer completely ...

Don't blame others if you are new to the job.
Good luck anyway.
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
LOL.
A bit of a joke thread, its like Teez in a different persona.
To be honest Gerber or more precisely RS-274 is a common G-code programming language and is not hard to follow (or even understand the manual),
what I can't understand is why... Never had Gerber go wrong and never had any reason to learn the format other than for interest, you would be stupid to start editing Gerber files in their text format and if you want to learn G-codes there is a wealth of information, maybe HPGL would be an easier start into the complex world of moving a pen/light/mill in 2D (2.5 if you count pen up/pen down (light off/light on))
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top