Automate some commands and use as shortcut? Python?

I have a board with 3 orthogonal regions. Each region is rotatet with a crooced angle (not 45°). To make it possible to route each region as usual with 0, 45, 90° angles I rotate at first by 26.2457°, do routing orthogonal and finally rotate back with -26.2457°. This are many keypresses and mouse actions and will be error prone. I have some python programming experiance, but the doc for it is either nearly not available, or so huge that I get lost in the docs. Can sameone help me?
Thanks in advance.

Checkout transformit plugin in plugin manager, it can rotate a bunch of things at once at a given angle. With 2, not 4 decimal digits precision but you likely don’t need more.

Thank you for the answer, but it saved me only some clicks but not as much as could be. I do it at the moment by: select all, positioning tools, move exactly, enter the angle. Many clicks! And I have to remember the angle! The same when rotating back. I do it often, when switching between regions. I thought it could be possible to do it with python: rotate+ and rotate- and the angle number is in the python script.

That plugin is in python and open source, you can modify it and hardcode the angle you want, then it will be just one click.

Thanks
can I include: select all" in the plugin? and deslect after? and how?

You mean you want it to always work on all objects, not just selection? In that case you don’t need to touch selection at all, just collect all objects from pcbnew. You want Drawings(), Footprints(), Tracks() and Zones(). KiCad Pcbnew Python Scripting: pcbnew.BOARD Class Reference

As I mention in my starting post, it is nearly impossible to write a script with BOARD Class Reference without a description of the fundamential functions of the plugin-API.
I inspected a simple pluginto get a feeling how to do. But there are to much unanswered questions, to write what I wanted to solve.
But what I really miss is a recorder to collect keystrokes in a list and execute these list with a single shortcut key. Thats all what I needed.

You have the api reference, you have 30 plugins to look how things work, you have specific example code that pretty much does what you want, you have to change like 5 lines to make it do what you want, and I gave you 4 of them but you say it’s nearly impossible. Ok, if you say so.

Kicad has built in scripting console that lets you inspect objects and try out things, that will answer majority of your questions if you tinker a bit. Also asking here is fine but you have to put in at least some effort to determine what are the actually important questions among the “to much unanswered” ones.

But what I really miss is a recorder to collect keystrokes in a list and execute these list with a single shortcut key. Thats all what I needed.

In that case you need a macro recording software, not a python script.

1 Like

What I do when I’m going to use an unusual angle frequently, I change the rotation step to that angle:

image

That way, when I rotate it is done by that amount.

1 Like

Thank you for your tipp!!!
That works fine for me, expecially I can rotate with r and rotate back with Shift-r! Super
There is only one drawback: The rotation center of a selection is not the mouse-cursor. Therefor the board is shifted in x and y when I use it with “select all” and “r” and “shift-r” without changing the mouse position.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.