yaqwsx / PcbDraw

Convert your KiCAD board into a nicely looking 2D drawing suitable for pinout diagrams
MIT License
1.13k stars 90 forks source link

Fails to draw boards with circular edges #63

Closed elektroniikka closed 3 years ago

elektroniikka commented 3 years ago

I was just trying out this cool tool and it works perfectly fine with boards that have straight edges. But when the board edge is curved, it crashes.

Here's the sample board I tried,

and here's the crash log

Traceback (most recent call last):
  File "/home/marcus/.local/bin/pcbdraw", line 11, in <module>
    sys.exit(main())
  File "/home/marcus/.local/lib/python3.6/site-packages/pcbdraw/pcbdraw.py", line 793, in main
    board_cont.append(get_board_substrate(board, style, not args.no_drillholes, args.back))
  File "/home/marcus/.local/lib/python3.6/site-packages/pcbdraw/pcbdraw.py", line 445, in get_board_substrate
    process(container, f, os.path.join(tmp, svg_file), colors, boardsize)
  File "/home/marcus/.local/lib/python3.6/site-packages/pcbdraw/pcbdraw.py", line 329, in process_board_substrate_base
    clipPath.append(get_board_polygon(extract_svg_content(read_svg_unique(source))))
  File "/home/marcus/.local/lib/python3.6/site-packages/pcbdraw/pcbdraw.py", line 284, in get_board_polygon
    outline = [elements[0]]
IndexError: list index out of range
yaqwsx commented 3 years ago

Could you share the '*.kicad_pcb' file, so I can easily reproduce the issue?

elektroniikka commented 3 years ago

Here you go :) PCBDrawTest.zip

The command I tried was

$ pcbdraw PCBDrawTest.kicad_pcb PCBDrawTest.png
markasoftware commented 3 years ago

I can confirm this issue.

yaqwsx commented 3 years ago

Fixed in be3fbc8e464b4b220a22b3192be30b729eb08583.