GerbView export_to_pcbnew cleanups needed

Bug #1646221 reported by PCB Wiz
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
KiCad
Expired
Wishlist

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 ...

Enhancements:
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)
ie

[] 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 http://swannman.github.io/pdf2gerb/

Tags: gerbview
tags: added: gerbview
Jon Evans (craftyjon)
Changed in kicad:
importance: Undecided → Wishlist
Jon Evans (craftyjon)
Changed in kicad:
assignee: nobody → Jon Evans (craftyjon)
milestone: none → 6.0.0-rc1
Jon Evans (craftyjon)
Changed in kicad:
assignee: Jon Evans (craftyjon) → nobody
Revision history for this message
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
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/2040

Changed in kicad:
status: In Progress → Expired
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.