GerbView export_to_pcbnew cleanups needed

Bug #1646221 reported by PCB Wiz on 2016-11-30
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Seth Hillbrand

Bug Description

GerbView export_to_pcbnew works quite well, but makes some poor decisions and actually drops information.

Bugs / bad decisions :

In export_to_pcbnew.cpp line 426, it does
  int width = (aGbrItem->m_Size.x + aGbrItem->m_Size.y) / 2;

a) That average is guaranteed to be wrong on an oval pad.
Smarter is to use the _smaller_ (min) of Size.x and Size.y of the flashed pad.
The smaller size then allows b) to give a correct PADS shape, with hole co-ordinate, and has the same outcome on a round pad.

b) By doing the simple swap of Flash -> Via, that guarantees to _drop_ information on oval pads.
Smarter is to export the PAD as a Draw item and ALSO export the via, if decided.

c) Always doing Flash -> Via, results in Vias on SMD pads which is incorrect

Which leads to ...

Problems: Present export_to_pcbnew.cpp assigns only a Default Drill to the Via, and decision of _Always_ Flash->Via is incorrect for SMD parts.

Suggest instead :

1) When a Flash is found, export that as a Draw, to get correct outline, and _also_ check if to add a Via.
ie principle is all Gerber vectors should appear in PcbNew.

Right now, angled PADS _do_ export ok, as they do not flash, but 0/90' ones fail to import due to the flash-skip code.

2) Add a menu option, to extract VIA(hole) info _either_ from Flash(as now), or Drill File(new)

[] extract Dia(via) from Flash(min) and hole(default)
[] extract Dia(via) from Flash(min) and hole(via) from Drill File

Using the Drill file, for Via decisions, has 2 benefits
 i) You now easily _avoid_ the incorrect Via-on-SMD bug No drill -> no via, simple.
 ii) You can tag the _correct_ hole size to the Via Drill

Some designs may not have drill info (rare), so keeping the old pathway covers that.

Untested/longer term ideas :

a) Missing, for now, from this is any Slot-support, because currently PCB New coughs on a via line with
(drill oval 1.05 0.65)
- since that probably can be fixed, export_to_pcbnew.cpp should include commented code to allow Drill slot export, for when PcbNew can read it.

If PcbNew can also support Rect/Oval vias, that could further help such imports, but that may be more work than allowing slots-in-vias, which sounds easier to do.

b) Gerber files seem to be adding support for NET names.

If those NET names are present, export_to_pcbnew.cpp could tag the Via/segment with the NET name, instead of the present default (net 0)
That should be a simple menu option adder ?
[] Export with NET names if present

For a test example that is not kiCad generated, see

tags: added: gerbview
Jon Evans (craftyjon) on 2018-02-05
Changed in kicad:
importance: Undecided → Wishlist
Jon Evans (craftyjon) on 2018-03-01
Changed in kicad:
assignee: nobody → Jon Evans (craftyjon)
milestone: none → 6.0.0-rc1
Jon Evans (craftyjon) on 2019-05-05
Changed in kicad:
assignee: Jon Evans (craftyjon) → nobody
Seth Hillbrand (sethh) wrote :

Didn't notice this was already in the tracker. I have a few parts of this that are in progress and this is is generally a good baseline.

Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
status: New → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers