Hello Stuart,

Current python api does not support interactive tool-like plugins, no mouse
or keyboard events are passed to the plugin. Plugin API is simple and
transactional, kicad instantiates a plugin object and calls its Run()
method. After the method completes, kicad checks if anything changed on the
board and updates the ui. That's it.

Hope that helps.

What you want to implement is a great feature and I would love to see it in
kicad too but it will have to be done in cpp.

Best,
Andrew

On Mon, Jul 3, 2023 at 3:49 AM Stuart Tyler <stuart.h.ty...@gmail.com>
wrote:

> Hi, this is my first ever post here. I am really impressed with the
> development of KiCad over the past few releases. The python interface is
> really good and I am keen to learn. I have been designing PCBs for a few
> decades now and keen to help improve KiCad.
>
> I have seen some discussion on supporting Flex/Rigid in Issue #12928 and
> #8118. This is way beyond my KiCad development ability, but this
> development is very important to taking KiCad to the next level - please
> reach out to me for any Beta testing on this development - I have designed
> many Flex/Rigid PCBs and know many of the implementation issues. This
> feature will open so many new development possibilities for KiCad.
>
> What I have been working on for the past few days is understanding how I
> can implement multiple track dragging from isssue #14983. I think this is
> something within my programming capability and is a feature that I really
> want. I cannot imagine having to route a decent sized PCB without this
> feature - and so I am keen to work on a simple solution.
>
> My solution works like this. If the drag mode is on and there are multiple
> items selected, then deselect everything that is not a straight track. Now
> if there is 0 straight tracks - no multi track routing to be done. If there
> is 1 straight track then do a currently implemented drag. If there is 2 or
> more tracks selected, wait for the user to do a down press on the left
> mouse button. Find the closest open track end. The mouse will jump to that
> track. All other selected open track ends will move in the same direction.
> Thats the easy bit. The harder bit is doing a 45deg turn. All the trace
> ends need to turn at 45deg and maintain the same distance between the
> traces.
>
> I started to look at the cpp code and the dev tools to do this. As a
> background I am a hardware designer and do embedded C and on the PC use
> Python to do all PC GUI (pySimpleGUI) and interfacing work. I dropped
> staying up with cpp many decades ago, and though I could do cpp, have
> chosen to stay away from it, focusing more on hardware - PCB design - and
> mech/electronic production processes - using Python for development testing.
>
> I see KiCad now supports Python based Action Plugins. I have watched a
> number of YouTube videos and done some reading of others developments using
> Python. The great work by Miles McCoo on routing his LED PCB mostly by
> Python scripts was very impressive. Also a number of other modules in
> Python - taking off.
>
> So how to implement the multiple track drag feature?
> 1. Implement in pcbnew in cpp. Need to have a handle on cpp development
> environment and pcbnew drag implementation. What scares me personally here
> is the cpp development environment.
> 2. Implement in Action Plugin in Python. Need to have a handle on Python,
> but does the Action Plugin interface support user mouse clicks and mouse
> movements across the PCB? What happens when the user wants to pan or zoom.
> I am not sure if the Python Action Plugins support PCB interaction while in
> Python.
>
> I really want to develop first in Python, but need some help on clarifying
> if Python can have the user interact with the PCB.
>
> If this is possible, then I will develop the drag algorithm in Python
> first. Then once the algorithm is robust, others can use it. If it is too
> slow from Python, then someone with cpp skill could take the algorithm and
> implement in cpp. That might be me, or could be a more skilled KiCad cpp
> developer.
>
> As a first step, could someone please clarify if Python Action Plugins
> could interact with user mouse movements on the PCB?
>
> Planning on being at KiCon later this year. Hope to see you there.
>
> Regards
> Stuart
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "KiCad Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to devlist+unsubscr...@kicad.org.
> To view this discussion on the web visit
> https://groups.google.com/a/kicad.org/d/msgid/devlist/baeb8e8a-27eb-43d9-a61c-d1b733fe3df1n%40kicad.org
> <https://groups.google.com/a/kicad.org/d/msgid/devlist/baeb8e8a-27eb-43d9-a61c-d1b733fe3df1n%40kicad.org?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"KiCad Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to devlist+unsubscr...@kicad.org.
To view this discussion on the web visit 
https://groups.google.com/a/kicad.org/d/msgid/devlist/CADn3vW2Z9B6xFAPRvAqC5MDGV8i2kKyqbneGyq93A5Uxt7b54Q%40mail.gmail.com.

Reply via email to