Rounded Tracks Reloaded ... again: RF Tools for KiCad

I’m not experienced in RF, but my gut instinct is because these different features you mention are acting like passive components (resistors, inductors, capacitors, etc) they would be better served as built as footprints. Additional benefit of locking them in as footprints is when doing the board layout nudging things around won’t risk changing the geometry of the RF elements.

@SembazuruCDE: Thank you for your insightful suggestion. I had not considered the possibility of such traces getting nudged. To follow your suggestion, would I need to create a separate footprint for every length of microstrip of a distributed element (such as a hairline filter)? That would be a lot of footprints! Maybe there could be a way to import the whole filter layout from the simulator as a footprint and then lock it? What about the case of stripline (RF trace between two ground layers; see, for example I am not sure you can have a footprint which is not on the top or bottom layer.

You are right, every element of a filter would be overboard. But, I was referring to what you got to, have the whole output of the simulator as a single footprint. I’m not sure about the stripline, as I said I really have no background in RF design for PCBs. I was just thinking that it might be similar to antenna design, where again it makes sense to have the fully simulated antenna as a single footprint.

I can’t really say it would or wouldn’t work. But I do occasionally have a good idea amongst all my questionable ones. :wink: This might or might not be one of those good ones.

@SembazuruCDE: Yes, I think it would be similar to importing the whole antenna as a footprint. The question is, what is the most efficient way to do that in KiCAD? That is not very clear to me.

There is this talk about how to import openEMS structures into KiCAD, but I still don’t understand how it is done and what KiCAD really imports. The guy in the talk shows the holes in the ground plane (the official term for this is “DGS” or “Degraded Ground Structures”), but I am not sure if KiCAD imported that from openEMS or whether KiCAD imported just the electrically “hot” traces (with the bowties in the video). . I have installed, via pip, a Python3 module ‘openems’, but when I try to import it, Python says it cannot find it. pip cannot find ‘pyopenems’, mentioned in Darrell’s github repo. So, I am stuck there…

The guy in the video above (Darrell Harmon) has a repository with examples: . I have also found this repo on github about importing KiCAD pcb files into openEMS (the reverse of the above): .

Usually you have two terminals with a copper connection between them. Unfortunately KiCad does not handle this well. Either you have the same pin number in and out and get ERC errors or you give different numbers and get DRC errors.

One option for getting externally defined (example dxf) shapes as a complex pad shape defined in a footprint is to do this in freecad and export to kicad Kicad StepUp: The Sketcher for Footprint generation

Or if you do not want to go via freecad and have it as dxf anyways then you can import the shape into the footprint editor on some helper layer and then use the snap to graphics feature to redraw it as a polygon which you then convert into a complex pad. (There is no direct way to get from dxf to polygon)


It seems that this library is a bit difficult to be installed on Win and OSX systems…
Would it be possible to package KiCad 5 and KiCad 6 with pyclipper?
that would help users with Via Fence plugins…

First off, your tool look quite nice and something I have been looking for myself. I can try to add it to the windows builds. Are the other dependencies required?

On a side note: For the curious, yes, un-bundled python dependencies are not easy with the MSYS2 setup as it seems that packages from the python python package index are built using msvc. But why don’t we build kicad with msvc? Because there not yet a nice way to build kicad with msvc. vcpkg looks cool, but it is still missing packages for wxpyhton (phoenix) such that we can support python3, and it misses opencascade. Any takers for fixing that in vcpkg? It is hacktoberfest now :stuck_out_tongue:

for the main Via Fencing tool ‘pyclipper’ is the only requirement.
For debugging and internal plotting, ‘mathplot’ and ‘numpy’ are also required…

Thanks for looking at this.

BTW are there plans to have kicad v5 or v6 on Windows with python 3?

Python 2 is only maintained for a few more months (It dies early 2020) so it would be quite embarrassing if v6 (which will definitely not come out before this deadline) is still on python 2.

@Rene_Poschl: Thank you for the info! I used @maui’s sketcher-to-footprint generation process last year with great success. My major question is how I would handle the case where the distributed structure is microstrip, that is on an inner layer (between ground planes). My understanding is that footprints can exist only on the outer layers. For example, I tried bringing a net tie (essentially a trace and two pads) onto an inner layer, but there was no such option. Could I hack the actual ASCII pcb file with an editor to bring a footprint onto an inner layer?

It is blocked by wxphython 4 aka version phoenix not being available for msys2. If I try to install it with pip3 install wxPython I get an error like:

{standard input}: Assembler messages:
{standard input}:1272: Error: invalid register for .seh_savexmm
{standard input}:1274: Error: invalid register for .seh_savexmm
{standard input}:1276: Error: invalid register for .seh_savexmm
{standard input}:1278: Error: invalid register for .seh_savexmm
{standard input}:1280: Error: invalid register for .seh_savexmm
{standard input}:1282: Error: invalid register for .seh_savexmm
{standard input}:1523: Error: invalid register for .seh_savexmm
{standard input}:1525: Error: invalid register for .seh_savexmm
{standard input}:1527: Error: invalid register for .seh_savexmm
{standard input}:1529: Error: invalid register for .seh_savexmm
{standard input}:1531: Error: invalid register for .seh_savexmm
{standard input}:1533: Error: invalid register for .seh_savexmm
{standard input}:1535: Error: invalid register for .seh_savexmm
{standard input}:1537: Error: invalid register for .seh_savexmm
error: Command "x86_64-w64-mingw32-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -D_WIN32_WINNT=0x0601 -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fwrapv -D__USE_MINGW_ANSI_STDIO=1 -D_WIN32_WINNT=0x0601 -DNDEBUG -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Ibuild/src.mingw-3.7/numpy/core/src/umath -Ibuild/src.mingw-3.7/numpy/core/src/npymath -Ibuild/src.mingw-3.7/numpy/core/src/common -Inumpy/core/include -Ibuild/src.mingw-3.7/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -IC:/msys64/mingw64/include/python3.7m -Ibuild/src.mingw-3.7/numpy/core/src/common -Ibuild/src.mingw-3.7/numpy/core/src/npymath -Ibuild/src.mingw-3.7/numpy/core/src/common -Ibuild/src.mingw-3.7/numpy/core/src/npymath -c build/src.mingw-3.7/numpy/core/src/umath/loops.c -o build/temp.mingw-3.7/build/src.mingw-3.7/numpy/core/src/umath/loops.o" failed with exit status 1
ERROR: Command errored out with exit status 1: C:/msys64/mingw64/bin/python3.exe -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:/Users/Build/AppData/Local/Temp/pip-install-krxfh1t1/numpy/'"'"'; __file__='"'"'C:/Users/Build/AppData/Local/Temp/pip-install-krxfh1t1/numpy/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record C:/Users/Build/AppData/Local/Temp/pip-record-dq4z3osp/install-record.txt --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

It has been fixed now thanks to @jsreynaud … please update the ViaStitching Plugin


@maui: Confirmed! Thank you for making KiCAD a professional-grade package!

1 Like

@nickoe any news on this?

As a temporary workaround for Via Fencing plugin, I’ve added the pyclipper library for the actual kicad deployed platforms:

  • win 64 py 2.7
  • osx 64 py 2.7
  • linux py 2.7 & 3.6

The plugin should try to first load the os pyclipper, if not available it will try to load the one included with the plugin itself.

@John_Pateman @davidsrsb @Anool
would you mind to update the plugin and, after having renamed/removed the pyclipper in your system, test the new plugin?

I’ve added also a check for DRC … it should be fine now :smiley:

1 Like

Tested and working, the DRC works too :ok_hand:

1 Like

Yes, this now seems to work in macOs with KiCad 5.1.4 without the dependency. Thank you!

1 Like

Looks much better.

Apart from that I noticed ‘something’ occasionally disconnects a fill zone from its assigned e.g. GND net. In this case there is only a filled zone on the top layer.

Thouth this might ‘just’ be an issue in the current master branch.

this shouldn’t be related to the plugin…
do you have a sample board to share to reproduce it?

I have found that the ‘master’ 5.99 branch has issues in deleting objects through python code, causing even a core dump on linux…

You more or less confirm that this is most likely a mastery developmental ‘temper tantrum’. I actually noticed that behavior, even without to deploy your plugin.

The GND fill zone got intermittently disconnected while messing around with fill zone geometry rearrangements.

Expect all sorts of unepected Python behaviour as the KiCad developers try to work around Python 2 being dropped in several OS