curtacircuitos / pcb-tools

Tools to work with PCB data (Gerber, Excellon, NC files) using Python.
Apache License 2.0
279 stars 135 forks source link

holes in inner copper layer #32

Closed CreativeSoftware closed 9 years ago

CreativeSoftware commented 9 years ago

When it has to handle internal holes in inner copper layers , pcb-tools uses lines instead of arcs. So the geometry becomes odd. Probably it is a problem with a gerber keyword

hamiltonkibbe commented 9 years ago

Can you give an example file that displays this behavior?

Some CAD programs (e.g. Altium) use gerber Region statements to define copper layers. Because region statements don't support arcs, circles are approximated by a series of straight lines. In altium there is a setting to configure how many lines to use when approximating circles, not sure about other cad programs. Have you compared the results with outputs from another gerber viewer?

CreativeSoftware commented 9 years ago

I can give you a simple example that illustrates what I'm saying :) Incorret rendering with pcb-tools:

https://dl.dropboxusercontent.com/u/710615/Bug.PNG

Correct rendering with gerbv : https://dl.dropboxusercontent.com/u/710615/CorrectRenderGerbv.PNG

hamiltonkibbe commented 9 years ago

Could you provide the Gerber file for that layer so I can try to figure out what's going on? Just for reference, what CAD program was used to generate the file?

CreativeSoftware commented 9 years ago

At this moment I don't know the name. I cannot provide the full gerber file( proprietary issue), however I think that you are able to use this one:

https://dl.dropboxusercontent.com/u/710615/Desktop.7z

hamiltonkibbe commented 9 years ago

Neither of those layers seem to have circular plane cutouts, could you just provide the layer that was rendering incorrectly?

CreativeSoftware commented 9 years ago

https://dl.dropboxusercontent.com/u/710615/LA1.gbx i.e.

hamiltonkibbe commented 9 years ago

Thanks I'll take a look at that tonight

CreativeSoftware commented 9 years ago

@hamiltonkibbe any news? I think that I can help if you need, I don't know how :)

hamiltonkibbe commented 9 years ago

I started taking a look at it over the weekend, I'll let you know when I get it figured out.

hamiltonkibbe commented 9 years ago

@CreativeSoftware Think I got it sorted out:

test

CreativeSoftware commented 9 years ago

Wel done ! It is correct ! :)

On 9 August 2015 at 20:11, Hamilton Kibbe notifications@github.com wrote:

Think I got it sorted out:

[image: test] https://cloud.githubusercontent.com/assets/1652994/9156461/f2e0084c-3ea8-11e5-8be7-f34956d4e30a.png

— Reply to this email directly or view it on GitHub https://github.com/curtacircuitos/pcb-tools/issues/32#issuecomment-129226884 .

CreativeSoftware commented 9 years ago

Could you post the sample code that generates this image? I'm not able to reproduce the same image. It could be a code problem or I've installed different libs or branches. (currently I have the branch from 9/08)

hamiltonkibbe commented 9 years ago

Can you try with the current version of master? A bunch of changes got merged in that affect rendering. The code to generate that image would be nearly identical to the cairo_examply.py script in the examples folder. Something like this should work:

from gerber import read
from gerber.render import GerberCairoContext
ctx = GerberCairoContext()
layer = read('LA1.gbx')
layer.render(ctx)
ctx.dump('LA1.png')