yaqwsx / KiKit

Automation tools for KiCAD
https://yaqwsx.github.io/KiKit
MIT License
1.49k stars 200 forks source link

Stencil creation fails when used on a panelized PCB #685

Closed ConnorJarvis closed 3 months ago

ConnorJarvis commented 3 months ago

Prerequisites

KiKit version

1.5.1

KiCAD version

8.0.1

Operating system

Linux (Docker container)

Description

When attempting to generate a stencil for a PCB which has been paneIized receive the below errors:

NoneType: None An error occurred: 'MultiPolygon' object has no attribute 'exterior' No output files produced Traceback (most recent call last): File "/usr/local/bin/kikit", line 33, in <module> sys.exit(load_entry_point('KiKit==1.5.1', 'console_scripts', 'kikit')()) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/KiKit-1.5.1-py3.10.egg/kikit/stencil_ui.py", line 63, in create return execute_with_debug(stencil.create, kwargs) File "/usr/local/lib/python3.10/dist-packages/KiKit-1.5.1-py3.10.egg/kikit/common.py", line 417, in execute_with_debug raise e from None File "/usr/local/lib/python3.10/dist-packages/KiKit-1.5.1-py3.10.egg/kikit/common.py", line 412, in execute_with_debug return procedure(**kwargs) File "/usr/local/lib/python3.10/dist-packages/KiKit-1.5.1-py3.10.egg/kikit/stencil.py", line 380, in create topRegister = makeTopRegister(board, jigsize,jigthickness, pcbthickness, File "/usr/local/lib/python3.10/dist-packages/KiKit-1.5.1-py3.10.egg/kikit/stencil.py", line 255, in makeTopRegister return makeRegister(board, jigFrameSize, jigThickness, pcbThickness, File "/usr/local/lib/python3.10/dist-packages/KiKit-1.5.1-py3.10.egg/kikit/stencil.py", line 232, in makeRegister innerRing = createOffsetPolygon(board, - innerBorder).exterior.coords AttributeError: 'MultiPolygon' object has no attribute 'exterior'

Steps to Reproduce

Base PCB is panelized using this .json config

{ "layout": { "hspace": "1mm", "vspace": "1mm", "rows": "3" }, "source": { "stack": "2layer" }, "tabs": { "type": "fixed", "vwidth": "2mm", "vcount": "6", "hcount": "6" }, "cuts": { "type": "mousebites", "spacing": "1mm", "offset": "0.2mm", "prolong": "0.5mm" }, "framing": { "type": "railstb", "width": "4mm", "maxtotalheight": "8m" }, "tooling": { "type": "3hole", "hoffset": "2mm", "voffset": "2mm", "size": "1.5mm" }, "fiducials": { "type": "3fid", "hoffset": "5mm", "voffset": "2mm", "coppersize": "2mm" }, "text": { "type": "simple", "voffset": "1.5mm", "layer": "0", "text": "Removed for bug report" } } Then panelized using this command

kikit panelize -p kikit.json pcb.kicad_pcb pcb-panel.kicad_pcb

Then attempted to be turned into a stencil using

kikit stencil create --debug --pcbthickness 1.6 --jigsize 400 400 pcb-panel.kicad_pcb stencil-dir

yaqwsx commented 3 months ago

Whenever reporting an issue, please include precise instructions to follow to reproduce the problem — including the PCB. We provide a way of sharing the PCB confidentially. The bug you report happens only in specific type of PCBs. Time and energy saved by not having to create inputs that trigger erroneous behavior can be used to improve KiKit.

Fortunately, this one was quite easy to track down, and 36cad872b349069c0f1a980e0e584623b64b9f6e fixes it.