Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Local/generated files
__pycache__/
*.pyc
.DS_Store
2 changes: 1 addition & 1 deletion trace_clearance/tc_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ width = 296
height = 359

[params]
clearance = 0.2
clearance = 2

5 changes: 4 additions & 1 deletion trace_clearance/trace_clearance.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ def set_keepouts(pcb, tracks, clearance):
keepout.AddPolygon(pts)
#keepout.SetIsKeepout(True)
keepout.SetIsRuleArea(True) # was SetIsKeepout
keepout.SetDoNotAllowCopperPour(True)
if hasattr(keepout, 'SetDoNotAllowZoneFills'):
keepout.SetDoNotAllowZoneFills(True) # KiCad 7+ renamed SetDoNotAllowCopperPour
else:
keepout.SetDoNotAllowCopperPour(True)
keepout.SetDoNotAllowVias(False)
keepout.SetDoNotAllowTracks(False)
keepout.SetLayerSet(layer)
Expand Down
2 changes: 1 addition & 1 deletion trace_solder_expander/tse_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ width = 465
height = 667

[params]
clearance = 0.2
clearance = 0.15

49 changes: 49 additions & 0 deletions via_fence_generator/python-pyclipper/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Standalone vendored `pyclipper` for the Via Fence Generator
===========================================================

Why this exists
---------------
`via_fence_generator` needs the compiled `pyclipper` extension. KiCad ships
its own sandboxed Python, so installing pyclipper with pip does not persist
(and is awkward to ask every user to do). This folder bundles the binary so
the plugin works as soon as it is copied — no pip, no admin rights.

How it works
------------
`viafence_action.py` detects the running KiCad Python (version / OS / arch)
and prepends the matching folder below to sys.path before importing
pyclipper. Folder naming:

py<MAJ><MIN>-<os>-<arch>/pyclipper/

py39-mac-universal2 macOS (Intel + Apple Silicon), Python 3.9 -> KiCad 10.x
py39-linux-x86_64 Linux x86_64, Python 3.9 (e.g. Ubuntu 20.04)
py310-linux-x86_64 Linux x86_64, Python 3.10 (e.g. Ubuntu 22.04)
py311-linux-x86_64 Linux x86_64, Python 3.11 (e.g. Debian 12, Flatpak)
py312-linux-x86_64 Linux x86_64, Python 3.12 (e.g. Ubuntu 24.04, Fedora)
py313-linux-x86_64 Linux x86_64, Python 3.13 (e.g. Arch, Fedora 40+)
py39-win-amd64 Windows x64, Python 3.9 (see Windows note)

Coverage: macOS and Linux x86_64 (KiCad 10.x) are bundled and tested.

Adding an uncovered setup (e.g. Linux ARM, a different Python)
--------------------------------------------------------------
1. Find KiCad's Python version: Tools > Scripting Console, then
import sys, platform; print(sys.version, platform.machine())
2. Download the matching wheel (no install needed):
pip download pyclipper --only-binary=:all: \
--implementation cp --abi cp<MAJMIN> \
--python-version <MAJ.MIN> --platform <tag>
3. Unzip the .whl and copy ONLY its `pyclipper/` package into a new
folder named `py<MAJ><MIN>-<os>-<arch>/` here.

Windows note
------------
`py39-win-amd64` uses a standard CPython (MSVC) wheel. KiCad's Windows
build uses an MSYS2/mingw Python whose extension ABI can differ, so this
binary may fail to import there. If it does, the simplest fix on Windows
is to run, in KiCad's Scripting Console: `pip install pyclipper`.

Source: pyclipper 1.3.0.post6 / 1.4.0 wheels from PyPI (MIT/BSD-licensed,
see each pyclipper/ package). Only the `pyclipper/` package is vendored
(no dist-info, no other platforms) to keep the plugin lean.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# file generated by setuptools-scm
# don't change, don't track in version control

__all__ = [
"__version__",
"__version_tuple__",
"version",
"version_tuple",
"__commit_id__",
"commit_id",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
COMMIT_ID = Union[str, None]
else:
VERSION_TUPLE = object
COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = '1.4.0'
__version_tuple__ = version_tuple = (1, 4, 0)

__commit_id__ = commit_id = 'gf99892036'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# file generated by setuptools-scm
# don't change, don't track in version control

__all__ = [
"__version__",
"__version_tuple__",
"version",
"version_tuple",
"__commit_id__",
"commit_id",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
COMMIT_ID = Union[str, None]
else:
VERSION_TUPLE = object
COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = '1.4.0'
__version_tuple__ = version_tuple = (1, 4, 0)

__commit_id__ = commit_id = 'gf99892036'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# file generated by setuptools-scm
# don't change, don't track in version control

__all__ = [
"__version__",
"__version_tuple__",
"version",
"version_tuple",
"__commit_id__",
"commit_id",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
COMMIT_ID = Union[str, None]
else:
VERSION_TUPLE = object
COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = '1.4.0'
__version_tuple__ = version_tuple = (1, 4, 0)

__commit_id__ = commit_id = 'gf99892036'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# file generated by setuptools-scm
# don't change, don't track in version control

__all__ = [
"__version__",
"__version_tuple__",
"version",
"version_tuple",
"__commit_id__",
"commit_id",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple
from typing import Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
COMMIT_ID = Union[str, None]
else:
VERSION_TUPLE = object
COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = '1.4.0'
__version_tuple__ = version_tuple = (1, 4, 0)

__commit_id__ = commit_id = 'gf99892036'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '1.3.0.post6'
__version_tuple__ = version_tuple = (1, 3, 0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '1.3.0.post6'
__version_tuple__ = version_tuple = (1, 3, 0)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ._pyclipper import *

try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '1.3.0.post6'
__version_tuple__ = version_tuple = (1, 3, 0)
8 changes: 4 additions & 4 deletions via_fence_generator/vf_config.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[params]
offset = 1
pitch = 0.8
via_drill = 0.26
via_size = 0.7
offset = 0.38
pitch = 0.5
via_drill = 0.15
via_size = 0.35

[options]
include_selected = True
Expand Down
49 changes: 35 additions & 14 deletions via_fence_generator/viafence_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,24 +373,45 @@ def Run(self):
# import pyclipper; pyclipper.__file__
except:
#error exception if pyclipper lib is missing
import sys, os
import sys, os, platform as _pf
from sys import platform as _platform
if sys.version_info.major == 2 and sys.version_info.minor == 7:
if _platform == "linux" or _platform == "linux2":
# linux
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),'python-pyclipper','py2-7-linux-64'))
elif _platform == "darwin":
#osx
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),'python-pyclipper','py2-7-mac-64'))
else:
#win
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),'python-pyclipper','py2-7-win-64'))
# --- standalone vendored pyclipper (KiCad 10.x ships Python 3.x) ---
# Per-platform binaries live in:
# python-pyclipper/py<MAJ><MIN>-<os>-<arch>/pyclipper/
# To support an uncovered setup, unzip the matching pyclipper
# wheel and drop its 'pyclipper/' package into such a folder.
_pp_base = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'python-pyclipper')
_pyver = '%d%d' % (sys.version_info.major, sys.version_info.minor)
_mach = (_pf.machine() or '').lower()
if _platform == 'darwin':
_cands = ['py%s-mac-universal2' % _pyver]
elif _platform.startswith('linux'):
_arch = 'aarch64' if _mach in ('aarch64', 'arm64') else 'x86_64'
_cands = ['py%s-linux-%s' % (_pyver, _arch)]
elif os.name == 'nt' or _platform.startswith('win'):
_cands = ['py%s-win-amd64' % _pyver]
else:
_cands = []
for _c in _cands:
_d = os.path.join(_pp_base, _c)
if os.path.isdir(_d) and _d not in sys.path:
sys.path.insert(0, _d)
try:
import pyclipper
pyclip = True
except:
msg = u"\u2718 ERROR Missing KiCAD \'pyclipper\' python module:\nplease install it using pip\nin your KiCAD python environment.\n[You may need administrative rights]"
wdlg = wx.MessageDialog(None, msg,'ERROR message',wx.OK | wx.ICON_WARNING)# wx.ICON_ERROR)
except Exception:
_want = _cands[0] if _cands else ('py%s-<os>-<arch>' % _pyver)
msg = (u"\u2718 'pyclipper' is not available for this setup.\n\n"
u"KiCad Python %d.%d | %s | arch: %s\n"
u"Expected bundled folder:\n python-pyclipper/%s/pyclipper/\n\n"
u"This standalone plugin bundles pyclipper for common\n"
u"macOS / Linux-x86_64 KiCad 10.x setups. For an uncovered\n"
u"setup, drop the matching pyclipper wheel's 'pyclipper/'\n"
u"package into that folder, or 'pip install pyclipper'\n"
u"into KiCad's Python environment."
% (sys.version_info.major, sys.version_info.minor,
_platform, _mach or 'unknown', _want))
wdlg = wx.MessageDialog(None, msg, 'pyclipper missing', wx.OK | wx.ICON_WARNING)
result = wdlg.ShowModal()
if pyclip:
#import pyclipper
Expand Down