mitjanemec / kicad_action_plugins Goto Github PK
View Code? Open in Web Editor NEWKicad action plugins
Kicad action plugins
First: thank you for this plugin, I greatly appreciate your work!
I have the following issue running the latest c3395f2: my board has two copies of a single hierarchical sheet. I want both copies to each adapt layout and traces from the third (pre-configured) copy. But when I run the script, the two instances always end up at the same (overlapping) position. This also happens when I try to deselect one of the two copies in the dialog.
Am I doing something wrong, or is this a genuine issue with the plugin?
Demonstration: https://sukzessiv.net/~gohai/kicad/overlap.mp4
If this matters: here is my hierarchy
the datasheet archiving only works for open access links but some manufacturers and network storages only grant access to documents with a valid user account. so these datasheets can not be copied for now.
at least from my side a very low priority feature because I store my datasheets not with this feature, but some others may need it.
Hello,
I upgraded my computer from an older Mac Air running OS X 10.12.6 Sierra to MacBook Air running OS X 10.14.4 Mojave with 16 Gbytes of RAM.
The file "replicate_layout.log" for my current project is missing from my current computer. Ones from previous projects exist on my old computer, but none with dates more recent than March 9.
To determine where the problem was, I copied the KiCad project that produced a "replicate_layout.log" file on my previous computer to the new one. I then used the new machine to see if the "replicate_layout.log" would be produced when I ran "Place_footprints" and then "replicate_layout" again on a layout that was know to produce that file on the older machine. The log file was not created on the new machine.
So, things that have changed for that test case:
Things that have not changed:
I need to get the "replicate_layout.log" because I am trying to track down a few other issues. Any help would be greatly appreciated.
Best regards,
Peter
Replicate plugin not replicate filled zone corner smoothing.
It would be nice to have a function to undo the changes to the project done by archive footprint later if you want to do changes on the project again for bugfixing or a completely new version.
most important: change the modified paths for documentation, 3dmodels, schematic symbols back to their global origin. this probably would need to save this informations during the archiving process.
nice to have (but probably easier): remove the archived libs in the project directory (documentations and 3d-shapes folder, archive-lib)
Even if the Pcbnew units are set to IN (Imperial), the dialog shows mm.
swap_units fails when unit pins don't have a name. E.g. 74HC14 both pins have the same name "~" the result is swapped pins of one or both units only in layout (input is connected where output whs connected and vice versa)
The radio buttons at the top to select linear or circular overlap. Reported by sww1235 in #2
I am using german language and the closing of pcbnew at the end of the process doesn't work.
This is because the key combination changes with language. When I change the language to english it works fine.
I modified my .py file to use the german combination wich is Alt+d ->b ->tab ->enter and it works fine, too.
But nonetheless a great plugin, thanks for your work!
Hi,
I encounter a problem in my Kicad 5.0.1 installation on Windows 10, when I run your plugins I get an error "IndexError: list index out od range".
The problem seems to be in the followings code:
def Run(self):
_pcbnew_frame = \
filter(lambda w: w.GetTitle().startswith('Pcbnew'),
wx.GetTopLevelWindows()
)[0]
I replaced it with:
def Run(self):
_pcbnew_frame = wx.GetActiveWindow()
And now it seems to work correctly.
By the way, your plugins are very useful, in particular the replicator.
Thank you again for your great work.
A interesting feature would be replicate also (by one checkbox option) replicate the silk annotation inside the boundary of the hierarchical layout.
Procedure (internal idea to the algorithm):
pcbnew
package);Spotted in #36 (#36 (comment)) by @T0jan. It might be a python3 issue, but I'll have to check out the behavior under python2
Replicate parts doen't take account REF width / height / tickness.
To reproduce:
Propose:
Add a check box on the plugin: "replicate the silk configurations".
As the title says, a configured page layout file isn't archived so does not become portable.
I'd like the archive_project to copy the defined page layout file for both schematic and pcb to the project folder and then redirect the path to the project directory.
The setting for the page layout for both EEschema and PCBNew is in the project .pro file, so that might make this difficult...
I'm really excited to see this plugin work, but it isn't working for me.
I'm running Kicad 5.0 rc2 (June 21 version) on Windows 10 64-bit. With my schematic closed, I've selected 2 pads on a part and tried executing SwapPins through the Tools->External Plugins menu item, but I get an exception. I can't copy and paste the whole string of errors, but here is a summary:
Line 86: swap_pins.swap(board,pad1,pad2)
Line39: all_sch_files = find_all_sch_files(main_sch_file,all_sch_files)
Line 178: seznam = find_all_sch_files(sheet,list_of_files)
Line 177: for sheet in extract_subsheets(filename):
File "C:/Program Files/Kicad/share/kicad/scripting/plugings/swap_pins.py", line 136, in extract subsheets
with open(filename) as f:
IOError (2, 'No such file or directory', C:\path_to_project_dir\~M2OE')
~M2OE is a signal name, so the script shouldn't be trying to open it as a file.
Hope that helps debug the issue.
To reproduce the issue:
-Create a hierarchical sheet with some components in it (assign also footprints), don't save it.
-Copy and paste the hierarchical sheet (don't save).
Syncrhronize pcb (F8)
Use the script on one of the newly created sheets. An error pop up is shown with the message "u'5D76A583" and the "ok" button (that seems to be the unique timestamp of the new sheet with the components to be placed).
Tested on master branch kicad,
Cheers,
Dino.
Hello Again,
Although you fixed swap_pins, I've found that it fails to move a pin that has already been swapped. I think it's related to the way the nets are drawn on the schematic. When swap_pins moves a pin, it's moving the label to a non-existent net on top of the symbol pin instead of moving the label with it's attached net. If I fix the schematic to include a net, then the swap works.
The anchor for the label could use some adjustment if it's possible. Looks like labels have their anchor on the side of the text that is closest to the symbol, so when labels are moved from one side of a symbol to the other, maybe the anchor can move as well.
Here is the exception I get when I try swap a pin that has already been swapped before:
and here is what the schematic looks like as a result of swapped pins:
Hello:
I am grateful that you took on the challenge of updating mmccoo's replicate layout script and implemented it as a proper module. Your version at least partially works ๐ .
I attempted to use the master branch as of f763c1a and had the following behavior with version 2017-09-29-revision b6d54ac for Mac OS X.
I installed the plugin where it seems things work for now on mac, which is /Applications/KiCad/Kicad.app/Contents/SharedSupport/scripting/plugins
with the replicatelayout
directory inside plugins
.
It showed up in the plugins menu just fine and the dialog box appeared when I ran it. I entered a y offset but no x offset and selected linear offset.
When I clicked ok, I got the traceback inserted at the end in another dialog box, and when I clicked ok on it, the footprints were moved to their proper place but no tracks were replicated and all the replicated footprints had been rotated 45 degrees.
I also ran the replicatelayout.py file separately without moving it with the following result:
ฮฉ:python3 replicatelayout.py all
File "replicatelayout.py", line 666
print "passed all tests"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(print "passed all tests")?
It almost seems like part of the linear replicator is getting called, and part of the polar replicator is getting called.
From looking back through the Kicad launchpad git history, it seems like this commit broke the script, which was probably released hours after they compiled the windows daily release for 2017-9-19.
Traceback (most recent call last):
File "/Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/replicate_layout/action_replicate_layout.py", line 232, in Run
polar)
File "/Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/replicate_layout/replicatelayout.py", line 595, in replicate_layout
self.replicate_tracks(x_offset, y_offset, polar)
File "/Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/replicate_layout/replicatelayout.py", line 443, in replicate_tracks
net_pairs, net_dict = self.get_net_pairs(sheet)
File "/Applications/Kicad/kicad.app/Contents/SharedSupport/scripting/plugins/replicate_layout/replicatelayout.py", line 277, in get_net_pairs
pad_name = p_pad.GetPadName()
File "/Applications/Kicad/kicad.app/Contents/Frameworks/python/site-packages/pcbnew.py", line 9338, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, D_PAD, name)
File "/Applications/Kicad/kicad.app/Contents/Frameworks/python/site-packages/pcbnew.py", line 83, in _swig_getattr
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'D_PAD' object has no attribute 'GetPadName'
It would be nice, if selected footprint would serve as a starting point and footprints with lower reference number would be placed in reverse sense (for linear and circular layout this is obvious, while matrix layout would require some thought)
As mentioned in the kicad forum thread, there are open issues with the scripts on python3 systems. only swap_pins, swap_units and Pad2Pad_Distance plugin appear in the external plugin list after refreshing, every other plugin is missing.
Pad2Pad_distance raises an AttributeError: module 'pad2pad_track_distance' hads no attribute 'Distance' for code line 95 for action_pad2pad_track_distance.py
swap_pins raises an AttributeError: module 'wx' has no attribute 'wx' for line 49 in action_swap_pins.py
swap_units raises an AttributeError: module 'wx' has no attribute 'wx' for line 49 in action_swap_units.py
Kicad info:
Application: kicad
Version: 5.1.0-060a0da~80~ubuntu18.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-46-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
Boost: 1.65.1
OpenCASCADE Community Edition: 6.9.1
Curl: 7.58.0
Compiler: GCC 7.3.0 with C++ ABI 1011
Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=ON
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON
replicate_layout
already have the XY align and the circular align, so create a 'update mode' on replicate_layout
to just update the already created replicated layouts. Use the selected component in the base layout as offset/origin in all the other ones; so the position of these components will not change in Pcbnew.
This may be useful to update the various replicated layout after integrated in the big layout.
I copied relevant folder into ~/.kicad_plugins and refresh plugins. But these tools didn't show up in external plugins. I tried to copy kicad/demos/python_scripts_examples/action_plugin_test_undoredo.py there, this script works well. So I want to know some details about the installation.
Thank you!
Application: kicad
Version: 5.1.2+dfsg1-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.64.0 OpenSSL/1.1.1c zlib/1.2.9 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Platform: Linux 4.19.0-5-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.67.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.64.0
Compiler: Clang 7.0.1 with C++ ABI 1002
Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=ON
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON
use ZONE_CONTAINER.Move and ZONE_CONTAINER.Rotate instead
Hello!
This is a request for a YES/NO vote for the following proposal:
Shared development of tools, scripts, plugins for KiCad EDA
kicad-extra/arkon#1
Thank you, and apologies if you already responded or otherwise not interested.
Hello:
Using the Bugfix_circular_in_y_linear branch
Unfortunately, I didn't notice if this happened on nightly 2017-09-29, but it does happen on 2018-02-01.
Stupidly, I forgot to backup my 2017-09-29 copy before installing the new one over the top of it. I might be able to retrieve an older nightly, but am not hopeful.
What appears to happen is that the bounding box for replication appears to be just around the footprints and does not take tracks into account.
The top layout is the original layout, the bottom layout is the replicated layout but missing the top most and bottom most traces of the original.
It would be quite useful if the project archiver would pull all of the datasheets from the web and place them in a datasheets or docs folder, then update the datasheet field to point to the new path.
This way, if you open the project in 10 years, you will still have access to the datasheets.
Hello. I tried to use plugins both on MacOS and Win7.
First I want to say that it start working when I put it in different folder than specified in README.md
On MacOs it was inside the packet ~Kicad/contents/sharedsupport/scripting/plugins not in ~Library. On windows C:\Program Files\KiCad\share\kicad\scripting\plugins
On MacOS it's ok. But on Win7 all components goes to the same places, but no any traces create. And I have a message fatal error when making an instance of replicator.
It would be nice if archive_project could call the pcbNew internal function to archive the footprints on its own to provide a full snapshot of the used libraries.
I am using the last KiCad NIgthly on Ubuntu 16 and constantly getting the message: "More or less than 1 module selected. Please select exactly one module and run the script again.".
As far I know, I selected exactly the necessary one instance of the module. So, I don't known if it is a version compatibility error.
Could this message be improved to give me some tip about (each components are missing or were selected in excess).
I am also having the same error with the PCB examples.
08-20 08:09:23 place_footprints.action_place_footprints 687:Fatal error when executing place footprints
Traceback (most recent call last):
File "C:\Users\xiaoxu.niu.WONDERLAN\AppData\Roaming\kicad\scripting\plugins/place_footprints/action_place_footprints.py", line 682, in Run
placer.place_matrix(sorted_modules, step_x, step_y, nr_columns)
TypeError: place_matrix() takes exactly 6 arguments (5 given)
Last try of replicate plugins, I got the replicated placement but not the tracks and vias. The error:
Traceback (most recent call last):
File "/home/h/.kicad_plugins/replicate_layout/action_replicate_layout.py", line 302, in Run
polar)
File "/home/h/.kicad_plugins/replicate_layout/replicatelayout.py", line 943, in replicate_layout
self.replicate_tracks(x_offset, y_offset, polar)
File "/home/h/.kicad_plugins/replicate_layout/replicatelayout.py", line 764, in replicate_tracks
net_pairs, net_dict = self.get_net_pairs(sheet)
File "/home/h/.kicad_plugins/replicate_layout/replicatelayout.py", line 478, in get_net_pairs
index = match_len.index(max(match_len))
ValueError: max() arg is an empty sequence
Add tests to replicate layout to test:
Thanks for the plugins!
I am using the kicad 5rc2
It seems that the plugin dialog is broken here.
Clicking the radiobuttons does not change that both are ticked.
I can however switch to the circular window and back.
Observation 1:
I can input the linear data. If I execute the script, it is interpreted as circular data (x offset being the radius and y offset the angle)
Observation 2:
Circular execution is working as expected
My guess is that in the dialog initialization something is broken.
With a quick lock in the code didn't find the reason.
If you need any more informations or pics just let me know.
Thanks a lot!
Components on back side are rotated incorrectly. The replicated component is rotated the inverse of the pivot component. For example:
I am running KiCad 5.1.2-201904240820+f72e74a84ubuntu18.04.1 amd64.
swap_pins does not work when label (net name) is different than pin name and label is not at exact pin location see post in #36
Running the script fails if two and only two pads are not selected.
Since this is a net tool, allow selection of vias, tracks, and other elements that are part of a net. Or any combination of those elements. You mentioned at #29 that it is not going to work for zones so I didn't list them.
It would be great if replicate_layout would work with multi level hierarchies.
The existing functionality is impressive! Thank you!
Especially when doing designs that have primary circuits connected to an AC mains and secondary circuits which need isolation, there are creepage rules. This will apply to an entire net and not just the pads/tracks on the net (also zones, for example). It would be great to have the tool that checks the distance between one net and another net, combing through each element on the net to find the closest distance between nets.
After installing the replicate plugin in KiCad 5.02 (Ubuntu 18.04), PCBNew crashes on every start up.
Is there a log somewhere from where I can get more information?
Hi,
I've got a large VIA on my board, and I've noticed that the script doesn't replicate the inner (drilled) hole, only the outer part.
The replicate plugin have the X & Y offset but just do linear and diagonal placement. Would be nice a matrix placement.
Sometimes we duplicate a layout and forgot to check the "remove existing tracks/zones/drawings", making place of duplicated symbols / silks / tracks in each instance of the layout.
Should be interesting check for this occurrences and delete them, even in the source layout.
Test the swap_units and send me the log.
Test the swap_pins and send me the log.
And if you could also send me the partial .sch file contents in which the R8101 is located (everything between $Comp and $EndComp delimiters should be fine)
had to alter it a bit, hopefully it has some use for you
I was trying to duplicate a block of components/tracks/vias 5+ times and had a bit of trouble getting the plugin to work initially. I duplicated the hierarchical block in the top level sheet like so (stripped down for tests):
(They have unique timestamps, not sure if this is relevant or not). The tree looks similar to the example gif in the repo.
After selecting the main footprint in PCBnew and running the plugin, I get the following error when it attempts to find the levels:
Traceback (most recent call last):
File "/Applications/KiCad/kicad.app/Contents/SharedSupport/scripting/replicate_layout/action_replicate_layout.py", line 334, in Run
replicator.calculate_spacing(sheet_levels[-1])
IndexError: list index out of range
It took a while to figure out that I needed to:
I'm not a python/scripting person, but improving error handling to be a little more verbose in this particular error case would help a lot.
Alternatively, I could PR some more specific instructions into the readme (or separate guide document) if you want, its a great tool and I'd like to save someone the frustration I had!
Thanks!
System: Mac OSX 10.14, KiCAD 5.0.2, plugins are from current master branch 0e88015.
When using the KiCad version at the bottom of this post, from 24 Feb 2019, I see the following error message:
Note that net2net works for me.
Application: pcbnew
Version: (5.1.0-rc1-136-g8ad15b1d6), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.68.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.61.1
Compiler: GCC 8.2.0 with C++ ABI 1013
Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
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
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON
I've been exploring the capabilities of the new place_components and noticed it only moves the component selected. This is when 'Sheet Number' is selected in the "Place by?" dialog. I'm digging into the code, but I wanted to flag the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.