pcb

Name exported Gerber files with the layer name

Bug #700877 reported by Robert Jenssen
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
pcb
Fix Released
Wishlist
DJ Delorie

Bug Description

Here is a patch to a src/hid/common/flags.c (git repository clone'd 10th Jan 11) to name exported Gerber files with the layer name:

diff --git a/src/hid/common/flags.c b/src/hid/common/flags.c
index 30859fb..feda662 100644
--- a/src/hid/common/flags.c
+++ b/src/hid/common/flags.c
@@ -191,7 +191,7 @@ layer_type_to_file_name (int idx)
       else
        {
          static char buf[20];
- sprintf (buf, "group%d", group);
+ snprintf (buf, 20, "%s", PCB->Data->Layer[idx].Name);
          return buf;
        }
       break;

Revision history for this message
DJ Delorie (djdelorie) wrote :

What about groups with more than one layer? Which of the N names do you choose?
IIRC we used to use layer names for exports, but changed to group numbers because of this.

Revision history for this message
Robert Jenssen (r-jenssen) wrote : Re: [Bug 700877] Re: Name exported Gerber files with the layer name

1. I don't use groups of layers (group = collection of sub-layers =
physical PCB layer?)
2. I can't see an option to name a group. IMHO "groupN" is an invitation
to make an expensive mistake.

Revision history for this message
Peter Clifton (pcjc2) wrote :

No, I don't think there is an option.

Are you interested on working on a patch for this?

I think we would have to default group names for old files to match the old "group%d" naming though, to avoid breaking anyone's processing scripts which rely on the existing file-names.

We would need to extend the file format to name the groups and introduce some data-structure in PCB to store the naming.

Changed in pcb:
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
Robert Jenssen (r-jenssen) wrote :

> Are you interested on working on a patch for this?

Sure, if you think it would be accepted. I can't say how long as it
would be in personal time. As I understand it:
1. add an internal group name data structure
2. add group naming to the GUI panel for layer groups (default is
"groupN")
3. modify the pcb file format
4. add a command line option for group names
5. modify run_tests.sh

Revision history for this message
Peter Clifton (pcjc2) wrote :

I don't know whether it would be accepted until we see what it looks like!

Lets ping DJ and see what he thinks of the idea..

Changed in pcb:
assignee: nobody → DJ Delorie (djdelorie)
Revision history for this message
DJ Delorie (djdelorie) wrote :

An easier solution is to name it groupN if the group has more than one layer, or name it after the layer if the group has exactly one layer.

Revision history for this message
Robert Jenssen (r-jenssen) wrote :

On Wed, 2011-01-12 at 01:25 +0000, DJ Delorie wrote:
> An easier solution is to name it groupN if the group has more than one
> layer, or name it after the layer if the group has exactly one layer.
>
True. So:

diff --git a/src/hid/common/flags.c b/src/hid/common/flags.c
index 30859fb..cbf006c 100644
--- a/src/hid/common/flags.c
+++ b/src/hid/common/flags.c
@@ -191,7 +191,14 @@ layer_type_to_file_name (int idx)
       else
        {
          static char buf[20];
+ if (PCB->LayerGroups.Number[group] == 1)
+ {
+ snprintf (buf, 20, "%s", PCB->Data->Layer[idx].Name);
+ }
+ else
+ {
          sprintf (buf, "group%d", group);
+ }
          return buf;
        }
       break;

Revision history for this message
Peter Clifton (pcjc2) wrote :

That is still not consistent for old designs (perhaps we don't care), and doesn't feel particularly internally consistent either.

Changed in pcb:
assignee: DJ Delorie (djdelorie) → nobody
Revision history for this message
Robert Jenssen (r-jenssen) wrote :

For older designs, users (me, myself and I) had to manually rename a
single layer group gerber file from "groupN" to a meaningful layer name.

Revision history for this message
Robert Jenssen (r-jenssen) wrote :

How about naming the group gerber file with the name of the first layer
in the group?

  static char buf[20];
  int group_idx = PCB->LayerGroups.Entries[group][0];
  snprintf (buf, 20, "%s", PCB->Data->Layer[group_idx].Name);
  return buf;

Revision history for this message
Peter Clifton (pcjc2) wrote :

 My point is not how inconvenient it is for you..

Rather that some people may have set up automated work-flows which rely on the file-names used by the export up until now. If we change that, it needs to be a deliberate decision balancing inconvenience to an unknown number of existing users who might have relied on the old behaviour, vs. the obvious advantages of the new behaviour.

Naming based on the first layer in a group is somewhat of a kludge. I still perfer naming the groups explicitly.

TBH, I'd _LOVE_ to completely rip out the layer group functionality in favour of object tagging (and perhaps colouring rules) within a given layer.

Revision history for this message
Peter Clifton (pcjc2) wrote :

"So, the keyval can be given in two ways - as character or as keyname."

EEP!! I don't like the sound of that.. which keys does that affect primarily?

Revision history for this message
Peter Clifton (pcjc2) wrote :

For example, I explicitly don't want it to be possible to get ":" by typing "colon". Only the handful of modifier keys should be supported by name.

Peter Clifton (pcjc2)
tags: added: gerber-export
Revision history for this message
KaiMartin (kmk-familieknaak) wrote :

The underlying problem seems to be the lack of meaningful layer group names. Rather than choosing one of the names of the group, a new set of parameters "layer_group_name_N" should be introduced.

---<)kaimartin(>---

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for pcb because there has been no activity for 60 days.]

Changed in pcb:
status: Incomplete → Expired
Peter Clifton (pcjc2)
Changed in pcb:
status: Expired → Incomplete
Revision history for this message
Robert Jenssen (r-jenssen) wrote :

Is there a consensus on what to do about this? I'm uncertain of the benefits of adding code for group naming. I don't have a feel for how large such a change might be but I suspect it would have widespread effects. Being selfish, a one line change does what I need.

Are there plans for a pcb V.2 that isn't backwards compatible? V.2 could implement object tagging, as in Peter Clifton's comment #11. Object tagging might also solve my problem with determining footprint orientation for pick-and-place (see https://bugs.launchpad.net/pcb/+bug/756972).

Revision history for this message
Peter Clifton (pcjc2) wrote :

I'm not sure if there is any consensus.

We have vague plans for a more major file format revision at some point, so we could introduce the necessary file format changes to store group names (or move to a different alternative to grouping) when that happens.

I might be persuaded to apply your simple workaround from comment #7 if DJ concurs. We recently had a break in export file names anyway, as we changed front/back (component/solder) to top/bottom.

Changed in pcb:
assignee: nobody → DJ Delorie (djdelorie)
Revision history for this message
Peter Clifton (pcjc2) wrote :

Pinging DJ for a comment

Revision history for this message
DJ Delorie (djdelorie) wrote :

Given that I've been helping the Dorkbot folks auto-parse *.pcb files for their pcb fab service, I don't think I want to have arbitrary names in gerbers without a way to override it. Currently, the gerber names are fixed by the stacking order. Changing those to arbitrary names would make it much more difficult to scipt their service.

Revision history for this message
gpleda.org commit robot (gpleda-launchpad-robot) wrote :

A commit was made which affects this bug
git master commit 0adead1b4f810e066d547e7f603060348e45eef1
http://git.gpleda.org/?p=pcb.git;a=commit;h=0adead1b4f810e066d547e7f603060348e45eef1

commit 0adead1b4f810e066d547e7f603060348e45eef1
Author: DJ Delorie <email address hidden>
Commit: DJ Delorie <email address hidden>

    Add option to specify gerber output file style.

     --name-style <fixed|single|first|eagle>
                            Naming style for individual gerber files

    Default is "fixed" which uses a fixed name (foo.top.gbr) for each layer.
    "single" uses the layer's name if there's exactly one layer in that
    group, else the fixed name. "first" always uses the layer name,
    choosing the first layer in each group for the name. "eagle" mode adds
    a three-character suffix instead of a separate type and extension.

    Affects-bug: lp-700877

DJ Delorie (djdelorie)
Changed in pcb:
status: Incomplete → Fix Committed
Peter Clifton (pcjc2)
Changed in pcb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.