mcbridejc / kicad_component_layout Goto Github PK
View Code? Open in Web Editor NEWScripted component layout plugin for KiCad/pcbnew
License: MIT License
Scripted component layout plugin for KiCad/pcbnew
License: MIT License
I have a new installation of KiCad Version: 6.0.4+dfsg-1~bpo11+1, release build, python3
Getting an error:
line 167, in Run
167 mod.SetOrientationDegrees(rotation)
TypeError: in method 'FOOTPRINT_SetOrientationDegrees', argument 2 of type 'double'
Changing line 166 from
166 rotation = props['rotation']
to
166 rotation = props['rotation'][0]
gets the first element of the list into the rotation variable and the plugin works.
Is there any interest in adding file dialogs to this plugin to allow selecting a file with the placement yaml as well as dumping yaml to a file that stores all the part placement info?
Created based on feedback in Issue #3
Sometimes, when using the script with kicad nightly, it would fail with `TypeError: in method 'FOOTPRINT_SetPosition', argument 2 of type 'VECTOR2I const &'.
This is because nightly builds use a different type for positions. The plugin does a version check for '6.99' to handle this, but it seems
some versions of KiCad nightly, on some platforms, report a the version string enclosed in parenthese and these aren't handled by the plugin.
It seems like this tool uses the page origin and not one of the origins the user can set.
This makes it hard to have a PCB thats properly placed on the sheet when using this plugin.
I currently fixed this locally, but I am not sure how the version checking works. I am on 6.0.11 and it seems to pick the wxPoint path, even though the comment says that newer should use Vector2I.
https://github.com/mcbridejc/kicad_component_layout/blob/master/component_layout_plugin.py#L152
grid_origin = pcb.GetDesignSettings().GetGridOrigin()
## Latest needs a pcbnew.VECTOR2I, 6.0.1 needs wxPoint
if use_vector2:
mod.SetPosition(pcbnew.VECTOR2I_MM(x0 + x, y0 + y))
else:
mod.SetPosition(pcbnew.wxPointMM(x0 + x, y0 + y)+grid_origin)
Kind regards,
Riesi
Thanks for this script, it saves a ton of time and improves the accuracy of my layout.
Could you add an example of a script which generates the layout.yaml file? If you can't get to this soon, I'll build one and send it to you.
I'm currently building the text in a spreadsheet and copy-pasting it into the text file, which is tedious.
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.