pcb

Gerber exporter options

Bug #699454 reported by Ineiev on 2008-10-10
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gEDA project
Wishlist
Unassigned
pcb
Medium
Unassigned

Bug Description

Yesterday I talked to a man who made PCBs
at one of my workplaces. He told me all
their devices were metric. Also he required
outline in every layer. So I took the patch
from feature request 1663208, cleaned it up
and added some more flexibility.

In result, additional gerber exporter options are:

(1) metric output (separately in Gerbers and Excellons)
(2) 3.3 or 4.2 precision in metric Excellon output,
    0..6 (separately for X and Y axes) in Gerber
(3) decimal point in Excellon output
(4) outline in every Gerber (if `outline' layer is present)
(5) disable drills output in outline layers

Ineiev (ineiev) wrote :

A mainstream bug misfixed (sometimes
fab layer lacks an aperture)

--outline-gerbers made work when `outline'
layer is absent

Item that didn't work has been removed:
(5) disable drills output in outline layers

Some tests added:

HOW TO TEST
(copy your favourite board to ineiev-tests/gerber.features/test.pcb)
(1) check that default output is comparable with the unpatched
version:
 (build unpatched and patched versions of PCB);
 cd ineiev-tests/gerber.features
 gcc -Wall -o cmpgbr cmpgbr.c
 mkdir m n
 ${old_good_pcb} -x gerber -o m/b test.pcb
 ${misfeatured_pcb} -x gerber -o n/b test.pcb
 ./cmpgerber m n;rm -r m n

 the script will show if there is any significant
 difference

(2) check that different options are comparable with the default:
output a pcb gerber with different format options
(pcb -x gerber \
     --gerberfile out \
     --outline-gerbers \
     --metric-gerbers \
     --gerber-x-precision 5 \
     --gerber-y-precision 3 \
     --metric-drills \
     --4.2-metric-drills \
     --decimal-in-drills \
     test.pcb
);
check with several Gerber viewers if all is OK
(load respective layers exported with different options
and see no significant difference (well, --outline-gerbers
should change the picture evidently)), e.g.
 cd ineiev-tests/gerber.features;./cmpoptions

Ineiev (ineiev) wrote :

--4.2-metric-drills is replaced with
--drill-precision, which works both for
metric and imperial files;

--raw-drill-diameters is added, which
disables drill diameters rounding;
when the diameters are rounded, the "integer"
values are considered depending on the units system.

Ineiev (ineiev) wrote :

add --export-all-layers:
(merged with changes from tracker patch 1833934
submitted by Bert Timmerman lambert63;
feature request 1830064 filed by David Griffith)
export all layers including the empty ones

Changes from the original patch:
(1) empty drills are exported, too
(2) assembly and "invisible" layers are not exported
(3) an (unneeded) aperture added to empty Gerbers so
    gerbv wouldn't tell they are RS-274D.

danmc (danmc) wrote :

is it the 4th file that should be applied?

Shall I add the test scripts in with other utilities?

-Dan

Ineiev (ineiev) wrote :

I'm sorry for long delay; recently, my communication processes became particularly stochastic.

I think the best to apply is gerber.options.quater.diff; but I'm not sure it should be applied to the CVS at all; I'd test it once more before; also, I'd cut my name from the files: it should remain rather in VCS logs. I'll post a revised patch by the end of this week.

As of tests and scripts, it's you who knows better whether and how to add them; probably they should go to example/?

Best regards, Ineiev

Ineiev (ineiev) wrote :

This is the latest version of the patch.
I removed notes on my changes from gerber.c, so the patch
could be applied to CVS. I also corrected some spaces and
added maximum coordinates detection (e.g. when mm units are
requested and the board is larger than 100 mm, it is incorrect
to write `%FSLAX24Y24*%' - there should be something like
`%FSLAX34Y34*%').

Tests showed that --outline-gerbers option
was buggy: it used to output a lot of unused (and invalid)
apertures into every Gerber file; I fixed this issue, too.

The resulting commit message could look like this:

Add more output options:

(1) metric output (separately in Gerbers and Excellons)
(2) 0..6 precision both in metric Excellon output
    and (separately for X and Y axes) in Gerber
(3) decimal point in Excellon output
(4) outline every Gerber
(5) don't round drill diameters
(6) export empty layers, too
    (based on Bert Timmerman lambert63 patch 1833934)
(7) digits before the decimal point are autodetected
    (e.g. specify 3.x format when the maximum coordinates are
     less than 1000 and more than 100)

Fix bug [2162834]
Add URLs to Gerber and Excellon descriptions in comments

Ineiev (ineiev) wrote :
Ineiev (ineiev) wrote :

This is a set of tests. I'm not sure
if they should be added to PCB sources.
I think they are not automatic enough; actually
I have no sane idea on how to compare
gerber/drill files produced with different
precision/units specifications. I just did it visually
with XOR mode of gerbv.

Ineiev (ineiev) wrote :
Ineiev (ineiev) wrote :

merged current CVS trunk:

--export-all-layers renamed to --all-layers;
gerbers default precision changed from 4 to 5;
note on changes and the malefactor
returned to gerber.c

Ineiev (ineiev) wrote :
Ineiev (ineiev) wrote :
nobody (nobody-users) wrote :

Looks like some good features, although it does potentially increase the number of ways to get gerber output wrong for the user!

Perhaps we should add some default button to the exporter which greys out the other options, and retains PCB's old ways for exporting.

Now we're using GIT, it should be really easy to produce a rebased patch series for these changes, complete with log entries (no /*... */ history comments in the code please!)

Looking at the code, and the list of features added, I think this could sensibly be more than one patch.

Refactor output precision code,
Add externally visible options for adjusting the output precision
Add metric support
Option to add outline to all layers
"disable drills output in outline layers" (Isn't this was already done?)

I've never personally come across any requirement to have X and Y axis resolutions different in the gerber file. I'm not sure it is a useful option to export.

Ineiev (ineiev) wrote :

Dear nobody,

Thank you for your interest in this patch. once it was useful for me
and I want it to be as best as possible.

> Looks like some good features, although it does potentially increase the
> number of ways to get gerber output wrong for the user!

If the code is correct, it produces valid output only.

> Perhaps we should add some default button to the exporter which greys out
> the other options, and retains PCB's old ways for exporting.

Isn't it really enough that the default settings result in the output
identical to the output of the unpatched version? (actually there no
buttons in command line)

Frankly speaking, I just don't imagine neither what it
might look like to be convenient for users,
nor what work it will get.

> Now we're using GIT, it should be really easy to produce a rebased patch
> series for these changes, complete with log entries

Agreed, it should.

> (no /*... */ history comments in the code please!)

I still believe it is a formal requirement of the GNU GPL
for the contributor. It does not take too much time for
a developer to delete them, e.g. via requesting the
contributor; and if it is not a mainstream version,
these comments don't harm, do they?

> Looking at the code, and the list of features added, I think this could
> sensibly be more than one patch.

Yes, it could.

> Refactor output precision code,

I shall try.

> Add externally visible options for adjusting the output precision

To force invalid output? whoever is _that_ special,
this person certainly knows it can easily be made
with sed postprocessing.

I don't refuse, I just need a reason to know
how to implement it properly.

> Option to add outline to all layers
> "disable drills output in outline layers" (Isn't this was already done?)

"disable drills.." was a bug in earlier versions of the patch;
"outline all layers" had not been done yet when I posted it;
IIRC it was synchronised with mainstream in the latest patch version.

> I've never personally come across any requirement to have X and Y axis
> resolutions different in the gerber file. I'm not sure it is a useful
> option to export

I had never personally come across any requirement to have any
of these features until Oct 2008. I just read the specification and tried
to provide more flexibility.

Thank you again for your comments. they are really constructive.

Ineiev (ineiev) wrote :

Here it is. I split the stuff into series of patches; however, many of them are not orthogonal.

I also add --merge-drills option to produce single-sided
boards as mentioned in
http://archives.seul.org/geda/user/Feb-2009/msg00509.html

Ineiev (ineiev) wrote :
Ineiev (ineiev) wrote :
Peter Clifton (pcjc2) on 2011-01-15
tags: added: gerber-export
DJ Delorie (djdelorie) wrote :

The GPL does not require you to put changelog comments in sources when you submit patches. It only requires you to ensure that the END USER who receives a modified version of the WHOLE WORK is well informed that they do not have an official version, and how it differs from the official version.

Please do not put changelog comments in the source files. The sources describe what *is*, not what *was*.

DJ Delorie (djdelorie) wrote :

Also, the ChangeLog file is auto-generated from the commit logs. There's no need to patch it.

DJ Delorie (djdelorie) wrote :

patch 0001-add-outline-gerbers-option-to-gerber-exporter.patch is no longer needed.

In 0002, why did you take out the logic to select all groups and layers when all_layers?

I don't think we should have separate X and Y precision. Better would be to have an enum option with the available "formats" (like 3.2in, 5.3mm/tz, etc) that users are used to seeing, rather than making them figure out the various parts of the format individually. Also, having it be one option lets us put in "shortcuts" for popular fabs.

Why did you add find_option() ? The values are hard-coded at compile time, there should be no reason to have to search for them at runtime. Also, the fprintf() there should be an abort() - the error is for the developer, not the user, and returning a *valid* index leads to subtle bugs.

Also, I suspect the nanometer work will require changes to these patches as well.

Traumflug (mah-jump-ing) on 2015-09-27
Changed in geda-project:
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers