pcb-tools icon indicating copy to clipboard operation
pcb-tools copied to clipboard

Cannot render my PCB, cairo returned CAIRO_STATUS_INVALID_SIZE

Open linlun opened this issue 7 years ago • 1 comments

Hi,

I'm trying to render my current PCB created in kicad using the cairo_example.py script. I get the following output:

python cairo_example.py 

Traceback (most recent call last):
  File "cairo_example.py", line 64, in <module>
    ctx.dump(os.path.join(os.path.dirname(__file__), 'cairo_example.svg'))
  File "build/bdist.linux-x86_64/egg/gerber/render/cairo_backend.py", line 143, in dump
  File "/home/lilu/.local/lib/python2.7/site-packages/cairocffi/surfaces.py", line 574, in finish
    self._check_status()
  File "/home/lilu/.local/lib/python2.7/site-packages/cairocffi/surfaces.py", line 140, in _check_status
    _check_status(cairo.cairo_surface_status(self._pointer))
  File "/home/lilu/.local/lib/python2.7/site-packages/cairocffi/__init__.py", line 69, in _check_status
    raise exception(message, status)
cairocffi.CairoError: cairo returned CAIRO_STATUS_INVALID_SIZE: invalid value (typically too big) for the size of the input (surface, pattern, etc.)

gerbers.zip

I have disabled the drill files as there is some other issue with those, I have attached the gerber files to this issue.

linlun avatar Oct 14 '17 09:10 linlun

@linlun to be honest I haven't tried to render your files with the cairo_example.py script -- but I can't reproduce it with the following piece of code:

context = GerberCairoContext()
board = PCB.from_directory(gerbers_directory, verbose=True)
context.render_layers(layers=board.top_layers, filename='top.png',
                      verbose=True, max_width=1280, max_height=1280)

This should return something along the line of:

[PCB]: Added topsilk layer <silkscreen.GTO>
[PCB]: Added top layer <copper.GTL>
[PCB]: Added topmask layer <soldermask.GTS>
[Render]: Rendering Background.
[Render]: Rendering top Layer.
[Render]: Rendering topmask Layer.
[Render]: Rendering topsilk Layer.
[Render]: Writing image to top.png

And it assumes you have extracted the files into the location that you've set in gerbers_directory.

ju5t avatar Nov 11 '17 22:11 ju5t