PcbDraw: Kicad 6.99 - Unknown layer ID

Hi,

I have encountered this issue while trying to use PcbDraw with nightly version 6.99.0-3148-gdb6c153ad9-dirty of Kicad.

wx._core.wxAssertionError: C++ assertion "false" failed at /home/ubuntu/tools/kicad/common/layer_id.cpp(190) in LayerName(): Unknown layer ID -1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/pcbdraw", line 11, in <module>
    load_entry_point('PcbDraw==0.9.0+36.g7118c48.dirty', 'console_scripts', 'pcbdraw')()
  File "/usr/local/lib/python3.8/dist-packages/click-8.1.3-py3.8.egg/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click-8.1.3-py3.8.egg/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click-8.1.3-py3.8.egg/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/dist-packages/click-8.1.3-py3.8.egg/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click-8.1.3-py3.8.egg/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/PcbDraw-0.9.0+36.g7118c48.dirty-py3.8.egg/pcbdraw/ui.py", line 174, in plot
    image = plotter.plot()
  File "/usr/local/lib/python3.8/dist-packages/PcbDraw-0.9.0+36.g7118c48.dirty-py3.8.egg/pcbdraw/plot.py", line 1028, in plot
    plotter.render(self)
  File "/usr/local/lib/python3.8/dist-packages/PcbDraw-0.9.0+36.g7118c48.dirty-py3.8.egg/pcbdraw/plot.py", line 650, in render
    self._plotter.execute_plot_plan(to_plot)
  File "/usr/local/lib/python3.8/dist-packages/PcbDraw-0.9.0+36.g7118c48.dirty-py3.8.egg/pcbdraw/plot.py", line 1182, in execute_plot_plan
    pctl.OpenPlotfile(action.name, pcbnew.PLOT_FORMAT_SVG, action.name)
  File "/usr/local/lib/python3/dist-packages/pcbnew.py", line 7173, in OpenPlotfile
    return _pcbnew.PLOT_CONTROLLER_OpenPlotfile(self, *args)
SystemError: <built-in function PLOT_CONTROLLER_OpenPlotfile> returned a result with an error set

This happens when calling OpenPlotFile where kicad calls StartPlotBoard which then calls ToLayerId passing it the layer attribute of the plot controller. At the time of calling the function, the layer attribute hasn’t been initialised yet and is equal to -1.

This issue should be resolved in Kicad in my opinion (see here), but a workaround could be to initialize the layer attribute manually before calling OpenPlotFile.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I’m not too surprised as EDA_ANGLES have not yet been introduced into the stable branch.

As a workaround, you could add this line to the version of PcbDraw you used in the first place.