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

Fix drawing PCBs without modules #64

Closed adamws closed 3 years ago

adamws commented 3 years ago

Drawing PCB without modules (for example edges only) were causing crash due to module variable not being None (empty list):

aws:PcbDraw/ (master✗) $ pcbdraw --filter "" test/test/test.kicad_pcb test.svg

> /home/aws/.local/lib/python3.9/site-packages/pcbdraw/pcbdraw.py(492)get_hole_mask()
-> if module.GetPadCount() == 0:
(Pdb) type(module)
<class 'pcbnew.MODULE_List'>
(Pdb) n
[1]    351541 segmentation fault (core dumped)  pcbdraw --filter "" test/test/test.kicad_pcb test.svg

Using pcbnew.MODULE_List.GetFirst() before iterating through elements seems to be fixing this issue.

Run once for empty board (outline only) and once for PCB with components and it is working.

yaqwsx commented 3 years ago

Thank you for the fix! I merged it into master.