How does the Copper Zone Properties dialog work?

I’m probably being stupid but I can’t work this out. Originally, I created a copper pour on my top layer to tie to Ground - layer 2 is a ground plane. This worked to the extent it created the copper pour but running the DRC I got plenty of copper within copper errors - I need to set the zone priority of that copper pour to a lower number than the other zones.

The Copper Zone Properties shows me a list of layers top left and next to it, a list of nets. Selecting a layer doesn’t alter the list of nets - I’d assumed it would show me nets on that layer - so this list of nets does not change irrespective of the layer selected.

If I select the net I’m interested in - Ground - and set its priority zone priority level to, say 1, all other nets also become priority 1. That happens regardless of the net I actually set: changing its priority changes the priority of all other nets. Thus I can’t set a priority to prevent this DRC error.

I’m clearly missing something here: I removed the copper pour I created but that has also removed quite a few connections I had from partial ground pours I already had in place.

Can someone explain how that dialog works please - I couldn’t find any help on it.

Could you share a screenshot and your Kicad version ?

In the meantime, maybe this ones can help:
https://forum.kicad.info/t/how-to-create-a-power-plane-using-zones/16530

https://forum.kicad.info/t/tutorial-introduction-to-pcb-design-with-kicad-version-5-1-getting-started/20600/3

Actually, I am being stupid. For some reason I thought this was a global dialog (i.e. all zones) and it obviously isn’t. So whilst I had an expectation of how it might work based on that misunderstanding it makes sense given that it’s for just the selected zone. It didn’t help that I’d struggled with the Swap Layers dialog previously which definitely requires serendipity to work out how to use it!

It might be easier to fix the DRC copper-in-copper error if the priority could be set -ve or globally for all zones; fortunately, I only had two other small pours on the front so I could individually set their priority to 1 before re-doing the ground pour but it would be a bit of a pain if I had many pours on that layer.

Anyway, the main problem was my misunderstanding and I’ve just got it sorted.

There may be a way to set zone priority globally for all selected zones through the GUI. I’m honestly not sure. But I do know that this is the type of situation that I developed KiCommand for.

You can issue the following command string in KiCommand to set all zones’ priority to 1.

  • zones 1 int SetPriority callargs

Or if you want to set the priority of just the selected zones:

  • zones selected 1 int SetPriority callargs

That looks really useful Greg. I installed it, after working out where the scripts should go in MacOS, but it just beach balled the scripting console when I ran import kicommand.test so I’ll have to have a play around with it. I think perhaps some environment variables or similar needs adjusting because I’ve never managed to get the BOM scripts to work either.

What errors in KiCommand are you seeing? (I’m not familiar with the phrase “beach balled”)

Edit: it may be referring to stalling with a rotating “wait” kind of thing. It takes a few minutes to run kicommand.test. I’ve seen up to 5 minutes or so. It should run completely and print either “OK” at the end or give error messages within the output.

Just tried it again and no beach ball (yes, it’s typically indicative of a stuck process) but errors:

import kicommand
kicommand.KiCommandAction.getInstance().Run()
from kicommand.kicommand import kc
import kicommand.test

Manually verify result:

‘00040’:[‘int list’,
‘0,1 int’,
[0, 1],
‘int list’
],

#Test results have been updated. If all tests succeed, copy the new file
/Users/andrewjohnson/Library/Preferences/kicad/kicommand/tests.txt

over the golden copy in

/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/tests.txt

Traceback (most recent call last):
File “”, line 1, in
File “/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/init.py”, line 1, in
from test import *
File “/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/test.py”, line 251, in
runtests()
File “/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/test.py”, line 45, in runtests
results = unittest.TextTestRunner(verbosity=100).run(fullsuite)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py”, line 151, in run
test(result)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/suite.py”, line 70, in call
return self.run(*args, **kwds)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/suite.py”, line 108, in run
test(result)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/suite.py”, line 70, in call
return self.run(*args, **kwds)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/suite.py”, line 108, in run
test(result)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py”, line 393, in call
return self.run(*args, **kwds)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py”, line 304, in run
result.startTest(self)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py”, line 53, in startTest
self.stream.write(self.getDescription(test))
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/python/site-packages/wx-3.0-osx_cocoa/wx/py/shell.py”, line 1247, in writeErr
self.write(text)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/FC1CCC48-FCE2-4ED0-81B6-DED9D6A97D50/d/kicad.app/Contents/Frameworks/python/site-packages/wx-3.0-osx_cocoa/wx/_core.py”, line 16711, in getattr
raise PyDeadObjectError(self.attrStr % self._name)
PyDeadObjectError: The C++ part of the Shell object has been deleted, attribute access no longer allowed.

Thank you!

I’ve just uploaded an update to KiCommand. Let me know if you get a chance to try it.

The “manually verify” part looks to be correct, but the new version shouldn’t show this message. I’ve updated KiCommand to hopefully take care of the issue of wxPythonDead. I’ve also reworked the tests to make them completely independent and now you can run kicommand.test.runtests_singly() in the Script Console (after import kicommand.test and waiting for the full test to complete).

I updated and it ran up to and including test 70, then:

======================================================================
ERROR: test_PCBBoundingbox_param (kicommand.test.test_012_board_class.TestBoardClass)

Traceback (most recent call last):
File “”, line 1, in
File “/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/init.py”, line 1, in
from test import *
File “/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/test.py”, line 261, in
runtests()
File “/Users/andrewjohnson/Library/Preferences/kicad/scripting/plugins/kicommand/test/test.py”, line 55, in runtests
results = unittest.TextTestRunner(verbosity=100).run(fullsuite)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py”, line 158, in run
result.printErrors()
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py”, line 108, in printErrors
self.printErrorList(‘ERROR’, self.errors)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py”, line 116, in printErrorList
self.stream.writeln("%s" % err)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/runner.py”, line 24, in writeln
self.write(arg)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/python/site-packages/wx-3.0-osx_cocoa/wx/py/shell.py”, line 1247, in writeErr
self.write(text)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/python/site-packages/wx-3.0-osx_cocoa/wx/py/shell.py”, line 1001, in write
self.AddText(text)
File “/private/var/folders/0x/9mt2shv13l3456s8dvjgmdtc0000gn/T/AppTranslocation/13A887AB-6FE5-4186-B6B8-84F73D853A6D/d/kicad.app/Contents/Frameworks/python/site-packages/wx-3.0-osx_cocoa/wx/stc.py”, line 2041, in AddText
return _stc.StyledTextCtrl_AddText(*args, **kwargs)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 799: ordinal not in range(128)

Are you able to load the files in the folders underneath share/kicad/demos? See if you can read in each of the *.kicad_pcb files into pcbnew.

Edit: by “load” I mean using the pcbnew GUI to load the files, not kicommand.

I don’t think I can - I’m using MacOS and I don’t think demos get installed, I certainly can’t find them.

See your message here: Where is the demos folder on MacOS? Is it normally installed?
which I see hasn’t been answered.

Is the error likely to be related to the design I have loaded into PCBNew?

I don’t think so. The KiCommand tests don’t rely on anything in the current pcbnew. You can run the tests with something/anything loaded (I do this regularly), and it shouldn’t matter.

If KiCommand doesn’t have access to the demos, then certain (maybe 2 or 3) tests will fail. It should have “ASCII” error, though. That’s part of what’s confusing to me. Any other indicators or output from the tests?

No, it all seemed fine up to that point and I copied and pasted everything after test 70 passed.

What about tests after that load_board test? I would hope that all tests pass except the small number that depend on the demos folder.

Edit: if everything else passes, you might consider just trying some basic commands and let me know what happens. The entry point for learning about KiCommand is the Readme.md on github. Or just let me know what you’re trying to accomplish and I can advise on any recommended commands to consider.

Nothing more - passed test 70, then the above stack trace. I’ll try some commands and let you know; I wasn’t aiming for anything in particular it just looked like a useful plugin.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.