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

@skuep started to develop on 2017 this action via fence plugin
I have updated the plugin adding some features and let it work with kicad 5.1.4 and did a PR, but ATM it is not merged.
You can test my version downloading my forked repo here:
Via Fence plugin

It should work fine if you select a Zone and after run the tool checking the related box.

@maui: Wow, the via fence plugin works beautifully!

As for the via stitching of a zone, I had to do the following to a zone on an inner layer, declared to be GND:

  1. Insert a couple of vias manually, and declare each of them to be part of the same net (GND); that enabled showing the whole zone filled and with the fillets at the corners.

  2. Delete the manually-placed vias, still keeping the filled display of the zone.

  3. Activate the via stitching tool, set the parameters, and then run it.

I think the crucial step was (1) above. Probably only one manually inserted via would have done it. Well, zones have always been quirky anyway. One more thing: The vias were not quite aligned (see pic). Could the grid settings have anything to do with that?

stitched_zone

Is there any way to use a different step size along different directions?

Once more, thank you for your excellent work, which elevates the value of KiCAD!

@hermit: Thank you for the suggestions. I do have python3 installed in my system. In fact, I have Ubuntu 16.04’s version, the snap version (both system-wide, of course), the anaconda version (locally, so this should not matter)… And yes, ~/usr/bin/python is a link to python2.7. I think the lack of python3 scripting is a packaging issue and I need to contact the packager—if I only knew how. Otherwise, I need to bite the bullet and compile KiCAD from source, which I’d rather avoid at the moment.

thanks… please consider that fencing vias plugin is still in development and ATM doesn’t check any DRC and can place vias on not allowed zones/pads.

Via Stitching plugin has instead already a DRC check when placing vias and it will place vias only on the selected net and allowed zones/places.

Not ATM.

Still if there is room for improvements, I think KiCAD can now handle many critical aspects that weren’t easily obtainable before.

I have done a small video to show the tools capabilities:

4 Likes

This is functionaly the same as the [Pad2pad action plugin](https://github.com/MitjaNemec/Kicad_action_plugins#pad2pad-track-distance. I should have put more resources in PR activities :grinning:

:smile:
Moreover track length feature is also available in kicad std menu (Route:Tune track length) , but I needed a very basic way to get the length without the risk to modify the track itself.

BTW I have to thank you for other code snippets :wink:
Particularly useful the hack for wxFormBuilder (which is generating incompatible dialog code for wxPython & python version 2) that I slightly modified.

I should have included contribution in my code as the hack regarding the SetSizeHints is not mine but from Qu1ck Length stats: action plugin

1 Like

please consider that fencing vias plugin is still in development and ATM doesn’t check any DRC and can place vias on not allowed zones/pads.

However, if I explicitly invoke DRC chekcing (say from the tool button), shouldn’t the errant vias be caught then?

The desired behavior would be not to place vias on not allowed places as via stitching plugin already does…
But yes, you can check DRC after invoking the fencing plugin and fix the issues.
So it is useful even if it is not complete …

1 Like

But yes, you can check DRC after invoking the fencing plugin and fix the issues.
So it is useful even if it is not complete …

Great! In reality, via fencing will most probably take place far away from non-RF components and traces, so there should be little chance of forbidden stitching anyway.

1 Like

Via fencing generates an immediate exception on Windows 5.1.4

Your exception should cite:

ModuleNotFoundError: No module named ‘pyclipper’

Via fencing plugin requires ‘pyclipper’ to be available.
Unfortunately pyclipper is not deployed on KiCAD win installation.
You need to add it using ‘pip’… open a command prompt and digit:

cd C:\Program Files\KiCad\bin
pip install pyclipper

(assuming you have installed KiCad on ‘C:\Program Files\KiCad\bin’)

@davidsrsb Please let me know if this will solve your issue on your system.

There is a further complication in MacOS as Kicad uses a specific bundled version of Python found at
/Applications/Kicad/kicad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python and does NOT use the system python. You can’t import pcbnew into the system python so you have to use the specific kicad version.

Unfortunately, the Kicad python version does not come bundled with pip or setup_tools.

If you try and run the Pyclipper setup.py using the Kicad version of python, this fails with
Download error on https://pypi.org/simple/setuptools_scm_git_archive/: unknown url type: https -- Some packages may not be found! which is a bit strange.

So I next tried /Applications/Kicad/kicad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python /usr/local/bin/pip install pyclipper

This fails as the ssl module is not available - which possibly explains the failure of the https download.

Trying to install these dependancies is becoming too much of a rabbit hole! Is the pyclipper dependancy essential for the functionality of the plug in or is it only used for the graphical display? If so, could this be made an option?

WRT the rounded tracks & taper action plug-ins, these work really well, thank you!!

Trouble here:

C:\Program Files\KiCad\bin>pip install pyclipper
Collecting pyclipper
Downloading https://files.pythonhosted.org/packages/20/a3/a60a7bad5246d66f3c54127b34b90e6d34b2cc006b84135bfcbfee4514b1/pyclipper-1.1.0.post1.zip (135kB)
100% |UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU| 143kB 728kB/s
Installing build dependencies … done
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “c:\users\david\appdata\local\temp\pip-build-env-cwepg6\lib\python2.7\site-packages/setuptools/init.py”, line 228, in
monkey.patch_all()
File “c:\users\david\appdata\local\temp\pip-build-env-cwepg6\lib\python2.7\site-packages/setuptools/monkey.py”, line 101, in patch_all
patch_for_msvc_specialized_compiler()
File “c:\users\david\appdata\local\temp\pip-build-env-cwepg6\lib\python2.7\site-packages/setuptools/monkey.py”, line 164, in patch_for_msvc_specialized_compiler
patch_func(*msvc9(‘find_vcvarsall’))
File “c:\users\david\appdata\local\temp\pip-build-env-cwepg6\lib\python2.7\site-packages/setuptools/monkey.py”, line 151, in patch_params
mod = import_module(mod_name)
File “C:\Program Files\KiCad\lib\python2.7/importlib/init.py”, line 37, in import_module
import(name)
File “C:\Program Files\KiCad\lib\python2.7/distutils/msvc9compiler.py”, line 306, in
raise DistutilsPlatformError(“VC %0.1f is not supported by this module” % VERSION)
distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in c:\users\david\appdata\local\temp\pip-install-ltz6bm\pyclipper\

C:\Program Files\KiCad\bin>

:grinning:

Unfortunately it is essential to get the trace expansion path.
mathplot and numpy are instead needed only for debugging.

I did managed to use pyclipper in kicad just installing pyclipper on OSX using the os python and then I just copied the lib ‘pyclipper.so’ to the plugins path.

This is strange… I managed to install pyclipper from kicad pip directly… I will investigate further.

The KiCad exception
(Why cannot these errors be cut and paste as text?)
Via_Fence_error

it seems you haven’t downloaded my fork, but the original not patched repo.
Here my forking repo:
via fence updated fork

One note, if possible, it would be great to get also the equivalent electrical length of the mitered or curved bend or ideally to set the required electrical length.
See also https://www.microwaves101.com/encyclopedias/mitered-bends or https://awrcorp.com/download/faq/english/docs/Elements/SMITER.htm
The reference books in the links are good, but I don’t have one available with me at the moment…

I fetched your fork, removed the old version and tried again. Now I get a warning about pyclipper needed.
The pip install still fails as before

5.1.4 build options are:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON

if you look inside the code of mitered wizard, you will see that is implementing already the optimal miter:

def OptimalMiter(self, w, h, angle):
    """Calculate optimal miter by interpolating from table.
    https://awrcorp.com/download/faq/english/docs/Elements/MBENDA.htm
    """

with this reference:
https://awrcorp.com/download/faq/english/docs/Elements/MBENDA.htm

For round corner length, I would suggest to use the Round Tracks plugin, instead of the Arc wizard. The plugin is more flexible and the resulting track can be measured also with Track Length plugin.
Moreover there is a check inside the Round Track corner code to test the following rule of thumb:

If you use a radius greater than three times the line width, you will have a transmission line that is almost indistinguishable in impedance characteristics from a straight section.

1 Like

@maui , Well, I’m running into the “No Module named pyclipper” error too. I’ve installed pyclipper and other dependencies via pip install. Other tools works well, including via stitching. What do I need to do to help you debug ?

Does it matter that your plugin folder is called action_viafence , while the main action file is called viafence_action ?